Post
Topic
Board Development & Technical Discussion
Re: Stop using floating point!
by
Enochian
on 09/06/2011, 08:38:07 UTC
Please, just use integer (i.e. fixed point) arithmetic for financial data and stop writing shoddy code. It's a no brainer, really...

Floating point arithmetic which can represent the integer values exactly isn't going to give a different answer than fixed point arithmetic.  Look at all the actuarial  programs written in APL, whose numeric prototype is a double precision float or complex.

The alleged horrors of float for financial math are mostly FUD.  Lots of COBOL programs use a comp-3 floating type because it is faster than character or packed decimal arithmetic. 

As with all things, it helps if you know what you're doing, and one can always construct examples of failure that are poor programming practice or don't occur in real life.

On the list of things that need fixing in Bitcoin, floating compares to double 0.0 aren't anywhere near the top of the list.