The IEEE 754 floating point standard is a very well thought out standard that is suitable for representing money as-is. If you have requirements such as compliance/legal/regulatory needs that mandate a minimum precision, then you can either opt to use decimal floating point or use binary floating point where you adjust the decimal place up to whatever legally required precision you are required to handle.
For example the common complaint about binary floating point is that $1.10 can't be represented exactly so you should instead use a fixed integer representation in terms of cents and represent it as 110. But if your requirement is to be able to represent values exactly to the penny, then you can simply do the same thing but using a floating point to represent cents and represent $1.10 as the floating point 110.0. The fixed integer representation conveys almost no benefit over the floating point representation, and once you need to work with and mix currencies that are significantly out of proportion to one another, you begin to really appreciate the nuances and work that went into IEEE 754 for taking into account a great deal of corner cases that a fixed integer representation will absolutely and spectacularly fail to handle.
I build cash registers, and I avoid floats like the plague.
I think the difference is where you need an exact result. Auditors have forced me to go through a years transactions to find an 1 cent error. They were right - at one point we weren't handling the fractional cents correctly. After finding that the bug was fixed. Had we been using floating point our answer would have been "shrug, if it's a problem chose another vendor".
You are working in finance so I suspect a 0.00001% error doesn't matter to you. Usually it doesn't. But occasionally, proofs of correctness are important. The can demonstrate for example one of your programmers isn't ripping you off by rounding (0, 0.5) to zero instead of (0, 0.5] and stealing the resulting cents. People have gone to jail for doing exactly that. Which is why, a good auditor can get very picky finding a 1 cent error. He doesn't care about value of that 1c any more that you do. What he cares about greatly is a machine whose job is to add up numbers reliably apparently can't get basic arithmetic right.
Programmer with battle scars from working in that environment are sick and tired of being told by others how much easier floats are to use 99.9999% of the time. Believe me, they know.
Integer arithmetic will never return NaN or infinity.
Integer (a*b)*c will always equal a*(b*c).
Integer (a+b)%n will always equal (a%n+b%n)%n, i.e. low-order bits are always preserved.
IEEE 754 is not bad and shouldn't be feared, but it is not a universal solution to every problem.
It's also not hard to multiply by fractions in fixed-point. You do a widening multiplication by the numerator followed by a narrowing division by the denominator. For percentages and interest rates etc., you can represent them using percentage points, basis points, or even parts-per-million depending on the precision you need.
I use C++ and what integer arithmetic will do in situations where floating point returns NaN is undefined behavior.
I prefer the NaN over undefined behavior.
>Integer (ab)c will always equal a(bc).
In every situation where an integer will do that, a floating point will do that as well. Floating point numbers behave like integers for integer values, the only question is what do you do for non-integer values. My argument is that in many if not most cases you can apply the same solution you would have applied using integers to floating points and get an even more robust, flexible, and still high performance solution.
>For percentages and interest rates etc., you can represent them using percentage points, basis points, or even parts-per-million depending on the precision you need.
And this is precisely when people end up reimplementing their own ad-hoc floating point representation. You end up deciding and hardcoding what degree of precision you need to use depending on assumptions you make beforehand and having to switch between different fixed point representations and it just ends up being a matter of time before someone somewhere makes a mistake and mixes two close fixed point representations and ends up causing headaches.
With floating point values, I do hardcode a degree of precision I want to guarantee, which in my case is 6 decimal places, but in certain circumstances I might perform operations or work with data that needs more than 6 decimal places and using floating point values will still accommodate that to a very high degree whereas the fixed arithmetic solution will begin to fail catastrophically.
Not if you need to represent more than about 170 kilo dollars.
On occasion I've seen people who didn't know any better use floats. One time I had to fix errors of single satoshis in a customer's database because their developer used 1.0 to represent 1 BTC.