Page 1 of 1

big math

Posted: Mon Feb 08, 2010 1:30 pm
by John
shouldn't this print tru?

if 2**64-1<2**64 then print 'tru'


or this

if (2**64-1)<(2**64) then print 'tru'


or this

if (2**64)-1<(2**64) then print 'tru'



:?: :?: :?: :?:

Posted: Mon Feb 08, 2010 1:33 pm
by Kevin Klappstein
You are running into problems because 2**64 is larger than the largest integer value that BR can represent. This then goes into scientific notation and the least signifigant digits get lost which is why the -1 essentially does nothing to the number.

Posted: Mon Feb 08, 2010 1:38 pm
by John
okay. that makes perfect sense. thank you, Kevin.

-john