On Sat, Feb 8, 2014 at 4:12 PM, Roman Cheplyaka <roma@ro-che.info> wrote:
So it is fixed, too? I'm not sure "Fixed" qualifies as a key word, then :)

Note that Data.Fixed doesn't put any restrictions on the (fixed)
precision. You could easily define E34.

No, it is not fixed.

>>> digits . unDeka . fromJust . strToDeka $ "3.00"
3

>>> digits . unDeka . fromJust . strToDeka $ "3.0000"
5

The precision is determined at runtime.  In contrast, with Data.Fixed, the programmer sets the precision at compile time.  There is no difference between

>>> 3 :: Fixed E6

and

>>> 3.00 :: Fixed E6

These issues are discussed at

http://speleotrove.com/decimal/decifaq1.html#tzeros

but if your reaction is "so what, it's just some extra zeroes and at compile time I can just use E34", then by all means, keep using Fixed :)

Also, note that you get 34 significant digits, but that doesn't mean the exponent is limited to 34.

>>> let x = fromJust . strToDeka $ "3E-200"
>>> let y = fromJust . strToDeka $ "4E-200"
>>> x + y
Deka {unDeka = 7E-200}

...which you could do in Fixed, true.  If you defined E200 first.  But, oops, now I need E250...

Really this is a binding to decNumber, which implements the General Decimal Arithmetic Specification, so see if decNumber and that specification scratch an itch.  If they don't, use Fixed, or Decimal (also on Hackage) or something else...