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

Vincent Lefevre vincent at vinc17.net
Tue Mar 19 12:15:10 CET 2013


On 2013-03-19 11:59:17 +0100, Torbjorn Granlund wrote:
> Vincent Lefevre <vincent at vinc17.net> writes:
> 
>   > I haven't though a lot about this, but it is not clear that -1 + eps
>   > should be considered to fit an unsigned type.
>   
>   Why?
> 
> 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...).

"is in the range of type" could refer to the result (i.e. the obtained
integer) or the argument. Normally, when considering a range of a
function, it is the result that matters.

What is the behavior for MAXIMUM + eps (both for signed and unsigned
types)?

-- 
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 mailing list