Android calculator vs. JavaScript

Citește postarea în română

Share on:

Is about the phone’s calculator. I have a HTC Desire with Android 2.2. My default calculator app that’s called simply “Calc” amazes me. Very rarely happens to need to use it, end even less I’m using it with fractional numbers, but when I’m actually using it I tend to forget that it has an issue.

Let’s say:

12 – 11

In Calc = 1, in JavaScript = 1. Nothing out of the ordinary so far, right?

Let’s take:

1.2 – 1.1

Any elementary school student knows that the result is 0.1.

In Calc it is 0.099999999, weird? In JavaScript is even more interesting, the result is 0.09999999999999987.

It’s about float, and I assume that the difference comes from the digit number displayed on the screen. In both cases IEEE 754 standard is used.

Now… in JavaScript this is a known issue, but who made the Android app, made it transform to a scientific calculator if you rotate the phone and did not see this issue?