# Abnormal result when calculate a value that have 7 or over 7 digits with decimal point value

I tried to build a simple calculator. When there is a value with decimal point after 7 or over 7 digits, the result of the calculation is displayed unnormal. But this doesn't occur for 6 digits or less with decimal value.

For example: 1234567.03 x 2, the result is 2.4691E6, but not 2469134.06 ; how can I fix it ?

Thank You !

1 Like

For an explanation of why you would lose accuracy after 7 digits, see

2 Likes

E6 is just an abbreviation of e+6, which stands for `(times) 10^6`.
The post above details why it's used.

Hi, thank you for your answer and it’s very helpful to me. But there is another error, when there is a value with decimal point after 7 or over 7 digits, the result of the calculation is displayed abnormal, the last 2 digits and the 2 decimal digits would become “0”, whatever the equation is plus/minus/multiplied/divided. But this doesn't occur for 6 digits or less with decimal value, or the value is more than 7 digits but no decimal places, the result of the calculation is also correct.

For example: 123456789 +2 = 123456791 ; it’s ok, no error;

123456.78 + 2 = 123458.78 ; it’s ok, no error.

But when : 1234567.89 + 2, the result is 1234600.00, but not 1234569.89 ;

Or when : 1234567.89 x 2, the result is 2469100.00, but not 2469135.78

Why this happen and how to fix it ?

Thank You !

I am not getting your error....

1 Like

Maybe you did it that way:

I don't see how else to get there.

2 Likes

Is this calculator intended for financial calculations, where each amount is in dollars and cents and indefinitely large numbers are expected and cents must be accounted for?

In such situations financial apps store their values in cents as integers, and only divide by 100 for display purposes.

1 Like