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

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Tue Mar 19 16:46:03 CET 2013


Ciao,

Il Mar, 19 Marzo 2013 12:15 pm, Vincent Lefevre ha scritto:
> On 2013-03-19 11:59:17 +0100, Torbjorn Granlund wrote:
>> We need to decide how to define the edge conditions.
>>
>> We could either see at as "can be assigned to type without havoc" or "is
>> in the range of type" (or perhaps something other even better...).

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.

> 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)

_fits_uTYPE require the range 0 <= x < uTYPE_MAX + 1

Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list