[erlang-questions] Rational arithmetic library?

John Hughes john.hughes@REDACTED
Thu Nov 20 12:40:04 CET 2008


Anyone have a good rational number arithmetic library? I can't be the first 
to need one, surely...

The background is that I need to do some EXACT arithmetic on non-integer 
numbers, so floating point won't do. Of course, rational arithmetic is easy 
to implement--and I've done so--but I realise there are choices over where 
exactly to take gcds, that may have a big impact on performance once the 
numbers involved start getting large. It would be nice just to use a library 
that has already been tuned, rather than need to tune my own.

I will say this for mine though: it's very thoroughly tested! If you're 
interested, it's at

http://www.cs.chalmers.se/~rjmh/rational.erl

John 




More information about the erlang-questions mailing list