Page 1 of 1

Calculator: Overflow Error!

Posted: Wed Jul 23, 2014 12:55 pm
by Raziel
Calculator Utility
Version 53.16 (12.9.2012)

Try to do this math: 111111111 * 111111111
The solution should be 12345678987654321

It will produce an Overflow Error! instead

Is this considered normal or a bug?

Re: Calculator: Overflow Error!

Posted: Wed Jul 23, 2014 1:10 pm
by tonyw
I don't know what floating point format the Calculator uses, but your product is about 54 bits long, and if the mantissa is limited to 48 bits, it's going to overflow.
If you perform the multiplication in hex. it works OK.

Re: Calculator: Overflow Error!

Posted: Wed Jul 23, 2014 1:21 pm
by Raziel
tonyw wrote:I don't know what floating point format the Calculator uses, but your product is about 54 bits long, and if the mantissa is limited to 48 bits, it's going to overflow.
If you perform the multiplication in hex. it works OK.
Hmm, ok, thanks for the info

If it is limited, might there be a way to hand over such products to hex on-the-fly...instead of throwing an Error?
Or maybe up the mantissa(?) size?

Re: Calculator: Overflow Error!

Posted: Wed Jul 23, 2014 3:20 pm
by tonyw
I suppose you *could* (if you were the calculator) recognise that both the multipier and multiplicand are integers, and perform the operation in integer arithmetic, but that would mean that if you then take 37% of the result, it would have to convert to a float again, with another overflow error.

Looking at the code, I see that it uses IEEE 754, which has 54 bits of mantissa or up to 15 decimal digits. That is a "Double" float in C.