19 deleted 1 character in body
source | link
18 corrected spelling
source | link

From Josh BlochsBloch's effective java:

IEEE 754 simply can't store 0.1 precisely. But if you ask it to store 0.1 and then ask it to print then it will show 0.1 and you'll think every thingeverything is fine. It's not fine, but you can't see that because it's rounding to get back to 0.1 .

No one expects π to store precisely in a calculator and they manage to work with it just fine. So the problem isn't about even about precision. It's about expected precision. Computers display one tenth as 0.1 the same as our calculators do, so we expect them to store one tenth perfectly the way our calculators do. They don't. Which is surprising, since computers are more expensive.

Anyway, what you type and what you see are the decimals (on the right) but what you store is bicimals (on the left). Sometimes those are perfectly the same. Sometimes theirthey're not. Sometimes it LOOKS like they're the same when they simply aren't. That's the rounding.

From Josh Blochs effective java:

IEEE 754 simply can't store 0.1 precisely. But if you ask it to store 0.1 and then ask it to print then it will show 0.1 and you'll think every thing is fine. It's not fine, but you can't see that because it's rounding to get back to 0.1 .

No one expects π to store precisely in a calculator and they manage to work with it just fine. So the problem isn't about even about precision. It's about expected precision. Computers display one tenth as 0.1 the same as our calculators do, so we expect them to store one tenth perfectly the way our calculators do. They don't. Which is surprising, since computers are more expensive.

Anyway, what you type and what you see are the decimals (on the right) but what you store is bicimals (on the left). Sometimes those are perfectly the same. Sometimes their not. Sometimes it LOOKS like they're the same when they simply aren't. That's the rounding.

From Josh Bloch's effective java:

IEEE 754 simply can't store 0.1 precisely. But if you ask it to store 0.1 and then ask it to print then it will show 0.1 and you'll think everything is fine. It's not fine, but you can't see that because it's rounding to get back to 0.1 .

No one expects π to store precisely in a calculator and they manage to work with it just fine. So the problem isn't even about precision. It's about expected precision. Computers display one tenth as 0.1 the same as our calculators do, so we expect them to store one tenth perfectly the way our calculators do. They don't. Which is surprising, since computers are more expensive.

Anyway, what you type and what you see are the decimals (on the right) but what you store is bicimals (on the left). Sometimes those are perfectly the same. Sometimes they're not. Sometimes it LOOKS like they're the same when they simply aren't. That's the rounding.

17 added 7 characters in body; added 12 characters in body
source | link

The thing about inches is they're divided in halves. The thing about most kinds of currency is it'sthey're divided in tenths (some isn'tkinds aren't but let's stay focused).

The thing about inches is they're divided in halves. The thing about most currency is it's divided in tenths (some isn't but let's stay focused).

The thing about inches is they're divided in halves. The thing about most kinds of currency is they're divided in tenths (some kinds aren't but let's stay focused).

16 added 1 character in body
source | link
15 added 1 character in body
source | link
14 added 80 characters in body
source | link
13 added 178 characters in body
source | link
12 added 6 characters in body
source | link
11 added 31 characters in body
source | link
10 edited body
source | link
9 added 57 characters in body
source | link
8 deleted 1 character in body
source | link
7 edited body
source | link
6 added 69 characters in body
source | link
5 added 6 characters in body
source | link
4 added 6 characters in body
source | link
3 added 148 characters in body
source | link
2 added 148 characters in body
source | link
1
source | link