[erlang-questions] Any way to correct the round off errors?

Witold Baryluk baryluk@REDACTED
Sun Sep 20 18:12:31 CEST 2009


Dnia 2009-09-20, nie o godzinie 18:06 +0200, Masklinn pisze:
> On 20 Sep 2009, at 17:22 , Witold Baryluk wrote:
> >
> > If you want something which calculates correctly in decimal number,  
> > use
> > integers multiplied with some 10^k power. It is called fixed point
> > arithmetic.
> Or use a decimal floating-point library such as gmp.

Sure. But considering that Erlang already have arbitrary precision
integers, writing few functions for add/sub/mul/div isn't very hard :)
It will be more portable than linking to gmp, :) Still operations will
need to be called explicitly, because Erlang doesn't have operator
overloading. ;)


-- 
Witold Baryluk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: To jest cz??? wiadomo?ci podpisana cyfrowo
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090920/784da738/attachment.bin>


More information about the erlang-questions mailing list