Value of MAXINT?

Post Reply
User avatar
Gordon
Posts: 12
Joined: Tue Mar 03, 2015 9:03 am
My devices: iPad mini

Value of MAXINT?

Post by Gordon »

I see from the manual (thanks to @Dutchman) that Smart BASIC uses standard 64-bit floating point numbers in 1-11-52 bit patterns for sign-power-mantissa parts.

Can I infer from this that any integer with an absolute value smaller than 2^52 will be represented exactly, without rounding, and that if I do arithmetic on integers in that range and the result is also an integer in that range, the result will also be represented exactly, without rounding?

Is this also true of the imaginary parts of complex numbers?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Value of MAXINT?

Post by Mr. Kibernetik »

Yes, because there are no special "integers" in smart BASIC.

Imaginary part has the same precision as real part.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Value of MAXINT?

Post by Mr. Kibernetik »

Actually you can easily check this. Code:

Code: Select all

k=2^52
m=k-150
n=k-50
PRINT n-m
returns: 100

User avatar
Gordon
Posts: 12
Joined: Tue Mar 03, 2015 9:03 am
My devices: iPad mini

Re: Value of MAXINT?

Post by Gordon »

Thank you. That was what I thought, but I wanted to be certain. :-)

Post Reply