An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120710/d2d2a162/attachment.pl>
-1.1 - 0.1 + 1.2 is NOT null! Why?
13 messages · Richard M. Heiberger, William Dunlap, Rolf Turner +5 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120710/d89a51ff/attachment.pl>
It is for the same reason that if you must work with numbers stored with 2 significant decimal digits 1-(1/3+1/3+1/3) is 0.01 (== 10 ^ -2). Double precision numbers, supported by your computer hardware and used by R, are stored using 52 significant binary digits and 2^-52 is about -2.220446e-16. (By the way, in R zero and NULL are different things: the former is numeric and the latter is not.) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of ollestrat Sent: Tuesday, July 10, 2012 1:17 PM To: r-help at r-project.org Subject: [R] -1.1 - 0.1 + 1.2 is NOT null! Why? 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.
In addition to taking cognisance of Richard Heiberger's reply you
should also learn to distinguish between the concept of "null" and
"zero". They are not at all the same thing.
cheers,
Rolf Turner
On 11/07/12 08:17, ollestrat wrote:
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120710/7a7aff0e/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120711/bc43d4b9/attachment.pl>
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 >
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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120710/72c842ec/attachment.pl>
1 day later
On Tue, 10-Jul-2012 at 11:19PM +0200, Erdal Karaca wrote:
|> german "Null" == english "zero" :-) German "Gift" == English "poison" :-( |> |> 2012/7/10 Rolf Turner <rolf.turner at xtra.co.nz> |> |> > |> > |> > In addition to taking cognisance of Richard Heiberger's reply you |> > should also learn to distinguish between the concept of "null" and |> > "zero". They are not at all the same thing. |> > |> > cheers, |> > |> > Rolf Turner |> > |> >
|> > On 11/07/12 08:17, ollestrat wrote:
|> > |> >> 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 |> >> |> > |> > ______________________________________________ |> > 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. |> > |> |> [[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.
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Average minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Eleanor Roosevelt
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120712/ab9a0245/attachment.pl>
Thank you for the explanation. Good to know about the issue how double values are "constructed" by a bit system. This makes me handling double values with care in using it in R or aother languages control structures etc. Thank you also for the hint concerning the Null vs. Zero vs.. issue. Yes, the subject title is misleading.. -- View this message in context: http://r.789695.n4.nabble.com/1-1-0-1-1-2-is-NOT-null-Why-tp4636053p4636432.html Sent from the R help mailing list archive at Nabble.com.
Someone pointed me to this paper: http://www.validlab.com/goldberg/paper.pdf -- View this message in context: http://r.789695.n4.nabble.com/1-1-0-1-1-2-is-NOT-null-Why-tp4636053p4636433.html Sent from the R help mailing list archive at Nabble.com.