big math

More advanced topics discussed.

Moderators: Susan Smith, admin, Gabriel

Post Reply
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

big math

Post 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'



:?: :?: :?: :?:
Kevin Klappstein
Posts: 25
Joined: Thu Jun 11, 2009 9:04 am
Location: Edmonton
Contact:

Post 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.
Kevin Klappstein
Western Canadian Software
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

okay. that makes perfect sense. thank you, Kevin.

-john
Post Reply