[Haskell-cafe] What is a safe Haskell data type to store and manipulate Money values?

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Apr 5 03:20:17 UTC 2017


> On 5/04/2017, at 3:53 AM, Joachim Durchholz <jo at durchholz.org> wrote:
> 
> Yeah, floating point is a no-go for monetary values.
> They can be the right tool when combining percentages, or actualy any factor that is supposed to be multiplied with a monetary value.

*Binary* floats, yes.  But IEEE *decimal* floats were specifically designed to support
commercial calculations, and the current COBOL standard offers decimal floats as one
of three interpretations of COBOL fixed-point arithmetic.

It helps to have hardware that supports decimal floats, of course.  Probably no
surprise that current z/Series and Power machines do, most others don't (yet).



More information about the Haskell-Cafe mailing list