use decimal

Mike Cowlishaw MFC at uk.ibm.com
Thu Sep 18 08:00:14 PDT 2008


> On Wed, Sep 17, 2008 at 10:53 PM, Maciej Stachowiak <mjs at apple.com> 
wrote:
> I think it is a tenable position that 1.5m === 1.5000m based on the 
> "cohort" concept, since performing the same operation on both will 
> give answers that are in the same "cohort" equivalence class. But 1.
> 5 / 10.0 != 1.5m / 10.0, and indeed, the answers would not even be 
> in the same cohort. A notion of 'cohort' equivalence class based on 
> correspondence in the abstract to the same real number but divorced 
> from the actual semantics of the programming language strikes me as 
> incoherent. I think such a notion of equivalence class only makes 
> sense if performing identical operations on members of the same 
> cohort gives answers which are in the same cohort.
> 
> Are -0 and 0 in the same cohort?

In IEEE 754, no:

  2.1.10 cohort: The set of all floating-point representations that 
represent a given
    floating-point number in a given floating-point format. In this 
context ?0 and +0 
    are considered distinct and are in different cohorts.

(+0 and -0 are distinguishable in binary FP as well as in decimal FP; in 
fact this is the only case in binary where two finite numbers have the 
same value but different representations and encodings.)

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/20080918/6624fb6f/attachment-0001.html 


More information about the Es-discuss mailing list