[R] Why is 0 not an integer?

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 7 09:19:08 CEST 2009


>>>>> William Dunlap <wdunlap at tibco.com>
>>>>>     on Thu, 6 Aug 2009 15:06:08 -0700 writes:

    >> -----Original Message-----
    >> From: r-help-bounces at r-project.org 
    >> [mailto:r-help-bounces at r-project.org] On Behalf Of Giovanni Petris
    >> Sent: Thursday, August 06, 2009 3:00 PM
    >> To: milton.ruser at gmail.com
    >> Cc: r-help at r-project.org; Daniel.Gerlanc at geodecapital.com
    >> Subject: Re: [R] Why is 0 not an integer?
    >> 
    >> 
    >> I ran an instant experiment...
    >> 
    >> > typeof(0)
    >> [1] "double"
    >> > typeof(-0)
    >> [1] "double"
    >> > identical(0, -0)
    >> [1] TRUE
    >> 
    >> Best,
    >> Giovanni

    > But 0.0 and -0.0 have different reciprocals

    >> 1.0/0.0
    > [1] Inf
    >> 1.0/-0.0
    > [1] -Inf

Yes, indeed!
Finally something interesting in this boring thread !

A few of us have agreed in the past that indeed, it would be
preferable if  identical()  *did* reflect this difference.

I'm going to discuss this -- it's about technical details and
future changes to R  in the appropriate mailing list :
--->  R-devel

Martin Maechler, ETH Zurich

    > Bill Dunlap
    > TIBCO Software Inc - Spotfire Division
    > wdunlap tibco.com  

    >> 
    >> > By the way:
    >> > 
    >> > Are there difference between -0 and 0?
    >>




More information about the R-help mailing list