use decimal
Mike Cowlishaw
MFC at uk.ibm.com
Fri Sep 19 01:18:16 PDT 2008
> "Mark S. Miller" <erights at google.com> wrote:
>
> On Thu, Sep 18, 2008 at 4:52 PM, Brendan Eich <brendan at mozilla.org>
wrote:
> > -0 and 0 are not the same "given floating point number". 1/-0 vs. 1/
> > 0 and Math.atan2(-0,0) vs. 0,0 are but two examples.
>
> Yes, I understand their operational difference. Whether that
> difference means they are not the same number depends on how you
> define "number". I would have defined "representing the same number"
> by correspondence to the reals. YMMV.
I was quoting the IEEE 754 definition of cohort, and that uses
'floating-point number'. The IEEE 754 definition of 'floating-point
number' is:
2.1.25 floating-point number: A finite or infinite number that is
representable in a
floating-point format. A floating-point datum that is not a NaN. All
floating-point
numbers, including zeros and infinities, are signed.
There's a helpful diagram at the beginning of subclause 3.2 that shows the
four layers; considering just the finites for now, these are:
1. Real numbers -- the mathematical underpinning.
2. Floating-point numbers -- the set of discrete values that a format can
represent (-0 and +0 are distinct, because of their relationship to +/-
Infinity).
3. Floating-point representations -- the set of number representations in
a format: {sign, exponent, significand}. For binary, there is only one
representation for each number in a format, for decimal there may be many.
4. Encodings -- the specific bit-strings that encode a representation.
> In any case, my question is, does there exist any similar
> operational difference between decimal floating point values that
> are considered to be in the same cohort?
Numerically, no. (There are operations that can distinguish between
different members of the same cohort, such as sameQuantum, but all members
of the same cohort always represent the same floating-point number.)
(IEEE 754 avoids the word 'value', because -0 and +0 have the same value
(they are numerically equal) but they are different numbers, but 'value'
and 'number' are often used loosely to mean the same thing.)
> If not, then I back Sam's proposal without compareTotal().
OK. ES needs to have a discussion about sign of NaNs, signaling NaNs,
payloads, etc. -- for binary as well as decimal -- but perhaps that's
better left until the Harmony timeframe.
Mike
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080919/6e8aefb1/attachment.html
More information about the Es-discuss
mailing list