# [R] Bug in "is" ?

Michael Grant mwgrant2001 at yahoo.com
Tue Sep 30 06:33:51 CEST 2008

```Tie a rock to the 7 and tie another rock of equal mass to the 7.0. Throw them both into opposite ends of a large pond on the first Tuesday after after a new moon. If the former number floats it is not the integer 10. If the latter floats it likely is not the larger integer 13. This is because of the greater buoyancy of the '0'. Divide the difference (13-10) into 1 and you have 1/3, but you do not have 7 or even 7.0. Since this result is neither '7' nor '7.0', it absolutely must be a '7.'.  This is why pi is irrational.

Now, I hope that settles everything. It is easily demonstrated in four and a half lines of R code or one line of APL.

HTH :O)
Michael Grant

--- On Mon, 9/29/08, Lucke, Joseph F <Joseph.F.Lucke at uth.tmc.edu> wrote:

> From: Lucke, Joseph F <Joseph.F.Lucke at uth.tmc.edu>
> Subject: Re: [R] Bug in "is" ?
> To: "Stefan Evert" <stefan.evert at uos.de>, "R-help Mailing List" <r-help at r-project.org>
> Date: Monday, September 29, 2008, 10:24 AM
> Stefan
> You are right.  Briefly put, the existence of 7 requires
> only Peano's
> axiom for successive integers.  Strictly speaking, 7 is not
> an integer
> but a natural number. But natural numbers can be embedded
> in the
> integers which can be embedded in the rationals which can
> be embedded
> the reals which can be embedded in the complex. Little of
> this is
> relevant to a programming language's two basic storage
> modes for
> numbers. Confusing a variable type with a mathematical set
> is an
> elementary, if entertaining, logical error.
> Joe
>
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org]
> On Behalf Of Stefan Evert
> Sent: Saturday, September 27, 2008 12:27 PM
> To: R-help Mailing List
> Subject: Re: [R] Bug in "is" ?
>
> Hi everyone!
>
> Sorry for taking an already overlong discussion thread
> slightly off-
> topic, but ...
>
> > quote:
> > No doubt, 7.0 is integer in math. But if people can
> write 7 why people
>
> > need to write 7.0 (I do not see any reason to do
> this).
> > endquote
>
> > What is true in mathematics is not necessarily true in
> R.
>
> ... am I the only one who thinks that the integer 7 is
> something
> entirely different from the real number 7.0? (The latter
> most likely
> being an equivalence class of sequences of rational
> numbers, but that
> depends on your axiomatisation of real numbers.) Integers
> can be
> embedded in the set of real numbers, but that doesn't
> make them the same
> mathematically.
>
> So the original complaint should really have said that
> is.integer()
> doesn't do what a naive user (i.e. someone without a
> background in
> computer science or maths) might expect it to do. :-)
>
> That said, I've fallen into the same trap more than
> once, and painfully,
> myself (often in connection with MySQL).
>
>
> Best wishes, and with a tiny grain of salt, Stefan Evert
>
> [ stefan.evert at uos.de | http://purl.org/stefan.evert ]
>
>
>
>
> 	[[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.
>
> ______________________________________________
> 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.

```