Does -0.5 fit an unsigned when truncated to an integer?
vincent at vinc17.net
Tue Mar 19 22:30:47 CET 2013
On 2013-03-19 22:11:31 +0100, bodrato at mail.dm.unipi.it wrote:
> Il Mar, 19 Marzo 2013 6:39 pm, Torbjorn Granlund ha scritto:
> > After some thought, I support I agree.
> > _fits_uTYPE require the range 0 <= x < uTYPE_MAX + 1
> > Which deviates.
> One we agree, it is simple to obtain the desired range, swaping two
It is also the choice made by MPFR (fixed in the trunk only for the
moment). It is also analogous to the conventional IEEE 754 rounding:
if an exact result x (real number to be rounded) is larger than the
maximum representable FP number, one gets an overflow only when its
rounding in an unbounded exponent range would yield an out-of-range
result in the target format.
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the gmp-devel