[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implementation of rational numbers



Smalltalk-80 has both bignums and rationals; our implementation of rational
numbers converts to lowest terms after every operation.  Currently we just do the
operation in the straightforward way and apply Silver's gcd algorithm to the
result, although of course there are better ways than this to implement the
elementary arithmetic operations.  We don't have much experience with rationals,
so anything you learn would probably interest us.  It would be very easy for us
to switch over to the "lazy reduction" method you suggest, if that turned out to
be advantageous.