use decimal

Maciej Stachowiak mjs at apple.com
Thu Sep 18 14:05:48 PDT 2008


On Sep 18, 2008, at 7:35 AM, Mark S. Miller wrote:

> 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?

-0 === 0 is a quirk of the language that in my opinion we should not  
repeat. Other than that oddity, === is a useful identity operator. As  
Brendan said, 2^53 wrongs don't make a right.

But to answer your actual question, it seems to me they are not in the  
same cohort in the same sense 1.5m and 1.500m are, since they may give  
mathematically different answers under the same operation, answers  
that differ in more than just precision.

Regards,
Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080918/62537c59/attachment.html 


More information about the Es-discuss mailing list