4 ms·
This type of thing coming from programmers really bothers me. Here is a more universal rule: Never say "never." Whether or not floating point numbers can be us
by riskneutral 7y ago
This type of thing coming from programmers really bothers me. Here is a more universal rule: Never say "never."
Whether or not floating point numbers can be used depends on the context. If you are talking about an accounting system, core banking system, ERP, or similar transactional systems, then sure you probably should use integers not floats.
However, if you're working on any financial model, like something as simple as discounted cash-flow model, then floating point is the correct choice and only choice.
I've had a programmer try to convince me that I had to use integers in financial modeling software that I was developing, and he used this same folksy argument with me. It was a genuine struggle to convince him that this was not a universal law and made no sense for the application at hand.
- Koshkin 7y agoRight. For example, potential insurance losses are only known approximately, so floating point is what should be used in their modeling.
- revicon 7y agoI’ve built two different payment platforms in the past, I’m curious why floating point is the correct and only choice for financial modeling.
- unlinked_dll 7y agoQuantization error is irrelevant in modelling so far as the datatype has the appropriate dynamic range. You don't care about the rounding errors, you care about the speed of execution of your model and how able it is to find trends/behaviors. Exact values aren't useful.
- jimmaswell 7y agoIt can't be worth any microscopic performance benefit to not just be safe/precise and substitute a decimal datatype in 99% of cases. Something crazy like HFT might be an exception, or if it's just a quick excel sheet. Otherwise it's still a perfectly good rule of thumb to keep money in decimal types if you're writing code.
- otabdeveloper4 7y agoIt's not about performance. Modeling (including financial modeling) requires transcedental functions and real numbers.