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

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

bodrato at 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
After some  thought, I support I agree.

  > What is the behavior for MAXIMUM + eps (both for signed and unsigned
  > types)?
  _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.


More information about the gmp-devel mailing list