Suraj N. Kurapati wrote:
I don't care so much about performance; rather, I want to write code
quickly and elegantly using conceptual abstractions. If I really
need performance, I will profile the code and re-write the slow
parts in C.
I completely agree with this approach. However, you will find that you
can't have floats that behave the way you would like... For
Fixnum/Bignum the deal is really simple: when something goes too big,
you switch from one to the other. Simply because if not, you get an
arithmetic overflow. But for floats, it is completely different. I don't
think you'll ever get a too big float (do you often manipulate numbers
over 10**300 or below 10**-300 ?). But if you want to switch to
BigDecimals when you lose precision, then you should do it from the
beginning, because unless you compute with numbers in base 2, you always
lose precision with a float operation...
So my answer is: use BigDecimals, if you're worried about precision
(but that still will not take care of all the problems; maybe Rationnal
is what you're looking for ?).
Cheers !
Vince
PS: yes, I know it sucks to have to take care manually of the things in C...