Does -0.5 fit an unsigned when truncated to an integer?

Torbjorn Granlund tg at gmplib.org
Tue Mar 19 18:39:14 CET 2013


bodrato at mail.dm.unipi.it writes:

  I think mpf_fits_*long_p should return TRUE when mpf_get_*i is correctly
  defined. mpf_get_ convert "truncating any fraction part", documentation
  says.
  
After some  thought, I support I agree.

  > What is the behavior for MAXIMUM + eps (both for signed and unsigned
  > types)?
  
  Currently:
  
  _fits_sTYPE return TRUE in the range TYPE_MIN - 1 < x < TYPE_MAX + 1
  (strict inequalities)
  
Which is then what we want, it seems.

  _fits_uTYPE require the range 0 <= x < uTYPE_MAX + 1
  
Which deviates.

-- 
Torbjörn


More information about the gmp-devel mailing list