Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: dherring_at_[hidden]
Date: 2010-04-02 15:18:22


On Fri, 2 Apr 2010, Chad Nelson wrote:
> On 04/02/2010 02:32 PM, Jeffrey Hellrung wrote:
>> What are the arguments against a signed zero?
>
> That there's no need for it in an integer library. I may have gotten
> some things wrong, but I don't think anyone refuted that part. Quoting
> from my earlier message on the subject:
>
> - ----------------8<----------------
> Forgive any mathematical terminology errors, I'm only an armchair
> mathematician. But in the domain of natural numbers, zero, by
> definition, has no sign. It's neither positive nor negative (or if you
> prefer, it's both). Signed zero seems to be an invention of computer
> science, where it represents a fraction that's so small that the inexact
> computer representation is indistinguishable from zero, but where the
> number itself isn't necessarily true zero.
> - ----------------8<----------------
>
> As such, there's no real need for it in XInt.

I tend to agree. In a "real" valued float, there are cases where you want
to distinguish a value approaching 0 from the positive or negative. With
integers, there are no infinitesimals and hence no need for a distinction.
The integer zero is simply the only integer between +1 and -1; it also
happens to be the additive identity, and there is no other (hence -0 has
no meaning).

- Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk