boris.steipe at utoronto.ca
Thu May 14 21:17:23 CEST 2015
Of course the number _is_ an integer. It seems you are asking whether that integer can be exactly _represented_ on a computer? That depends on your processor (eg. 32/64 bit) and the size of the number; alternatively you could calculate with arbitrary precision with the Rmpfr package.
For more insights, have a look at Pat Burs' summary of number representation in R (http://www.burns-stat.com/documents/tutorials/impatient-r/more-r-key-objects/more-r-numbers/) and/or read chapter one of his R inferno.
Or, maybe you can state more clearly what you are trying to achieve in the end, there might be other options.
On May 14, 2015, at 4:44 AM, chasiotisv at math.auth.gr wrote:
> I am Vasilis Chasiotis and I am a candidate Ph.D. student in Aristotle University of Thessaloniki in Greece.
> I have the following problem.
> I want to check if the square of a number ( for example the square of 1.677722e+29 ) is an integer.
> The problem is that this number is the calculation of the determinant (so the number should be an integer) of a matrix 22x22, which means it has an approximation ( the "real" number is 1.6777216e+29 but R gives to me 1.6777215999999849e+29 ), because R use LU-decomposition to calculate the determinant.
> That means that the radical of the number 1.6777215999999849e+29 is not an integer, but it should be.
> How can we overcome this problem?
> Thank you in advance.
> I look forward to hearing from you soon.
> Vasilis Chasiotis
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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