[R] -1.1 - 0.1 + 1.2 is NOT null! Why?

arun smartpink111 at yahoo.com
Wed Jul 11 00:42:13 CEST 2012


Hi,

Perl:
perl -e 'print -1.1-0.1+1.2. "\n";'
-2.22044604925031e-16
perl -e 'print -1.2-0.2+1.4. "\n";'
0


A.K.




----- Original Message -----
From: massimodisasha <massimodisasha at gmail.com>
To: ollestrat <stratman1 at gmx.de>; r-help at r-project.org
Cc: 
Sent: Tuesday, July 10, 2012 6:23 PM
Subject: Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

Il 7/10/12 4:17 PM, ollestrat ha scritto:
> Hello,
>
> I fear its a stupid question,..but here it is:
>
> If I do this simple calculation with the R  console, I surprisingly do not
> get a zero. Why?
>
>   -1.1-0.1+1.2
> [1] -2.220446e-16
>
>
> greetings, Ole
>
> --
> View this message in context: http://r.789695.n4.nabble.com/1-1-0-1-1-2-is-NOT-null-Why-tp4636053.html
> Sent from the R help mailing list archive at Nabble.com.
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
...

Python :
>>> -1.1-0.1+1.2
-2.220446049250313e-16
>>> -1.2-0.2+1.4
0.0
>>>

R :
> -1.1-0.1+1.2
[1] -2.220446e-16
> -1.2-0.2+1.4
[1] 0
>

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list