[Haskell-cafe] [ANN] deka - decimal arithmetic

Omari Norman omari at smileystation.com
Sat Feb 8 23:25:37 UTC 2014

On Sat, Feb 8, 2014 at 5:00 PM, Roman Cheplyaka <roma at ro-che.info> wrote:

> * Omari Norman <omari at smileystation.com> [2014-02-08 16:45:02-0500]
> > 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...
> I see now. So this is a decimal floating-point numbers library, which
> also attempts to track the precision of numbers. Does this sound right?

That's roughly right, yes. I would say"attempts" is too soft a word.
decNumber and, therefore, deka, tracks every significant digit and at least
maintains that significance.  If it trashes significant digits without
notifying you, it's a bug; please report it.

The differences between Data.Fixed and this library are so huge (Fixed
manipulates Integers alone; decNumber stores numbers as binary-coded
decimal coefficients and integer exponents) that I didn't even think to
compare them, and I won't be the one to draw performance comparisons
between the two because deka is for situations where solutions like Fixed
are simply wrong.  Fixed does me no good, no matter how fast it is, so
there's no reason for me to know how it performs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140208/0dbce861/attachment.html>

More information about the Haskell-Cafe mailing list