Live data from Hacker News

Floats Don't Work for Storing Cents

moderntreasury.com

1–3 of 3 posts

Re: Floats Don't Work for Storing Cents

#2
My father showed me the assembly language for a minicomputer, and I can remember being puzzled why the computer--a binary machine--had instructions for decimal arithmetic.

He smiled and had me add $0.02 + $0.03. When I didn't get $0.05, I was enlightened :-) It was like a koan.

Re: Floats Don't Work for Storing Cents

#3
post #2

My father showed me the assembly language for a minicomputer, and I can remember being puzzled why the computer--a binary machine--had instructions for decimal arithmetic. He smiled and had me add $0.02 + $0.03. When I didn't get $0.05, I was enlightened :-) It was like a koan.

because those are hundredths of a dollar, not cents