[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 22:18:00 UTC 2017

> On 5/04/2017, at 5:08 PM, Joachim Durchholz <jo at durchholz.org> wrote:
> What languages besides Cobol actually make use of [decimal floats]?

Aside from obvious things like PL/I and ABAP,
there is an official way to use decimal floats in C,
if you have them.  gcc is *part* of the way there.

Having used gcc on a machine with no hardware binary floats,
where binary floats were emulated, I'd rather like to use
decimal floats on my Macs.  However gcc 5.3.0 on my laptop
*recognises* decimal floats but just says that it's not
supported on this target.  The decNumber library's licences
are perfectly compatible with gcc.

Solaris Studio supports decimal floats on SPARCX[+] processors,
for some value of "support" strictly between 0 and 1.  (It knows
the _Decimal64 type but you have to call special intrinsics to
get the arithmetic instructions, though you _do_ get them.)

> Are there any plans by Intel or AMD to support them?
> I'm not aware of any, but you never know.

Perhaps if Microsoft realised that _Decimal128 is exactly what
they want for Excel, and put pressure on Intel?
Intel do provide a decimal floating point *library*
so in *some* sense they already support decimal floats.
The date in the README file is "August 15, 2011", so we've
had an "official" decimal floating point library for Intel
systems for nearly 8 years (first release in 2009).
[Amusingly, the only difference between LIBRARY/RUNOSX and
LIBRARY/RUNLINUX is that the OSX version has a space after
"./linuxbuild".]   The code is in C and has support for
big-endian machines, and eula.txt is very permissive, so
it looks very much as though nobody needs to go without.

More information about the Haskell-Cafe mailing list