ratmath
Utilities for Rational Numbers in Common Lisp (rational approximations and interval arithmetic)

Usage examples:

Function ratmath:rat is akin to cl:rationalize with keyword arguments :limd and :limn representing the maximum numerator/denominator:

(ratmath:rat pi :limd 255) ;; => 355/113

Function ratmath:infsup can reduce bignum rational to a fixed bit rational interval (here, 16-bit):

CL-USER> (* (rational pi) (rational (exp 1.0))) 2520484590068807905375/295147905179352825856 CL-USER> (values (ratmath:infsup * :limd 65535 :limn 65535)) (23749/2781 . 50077/5864)

More details in README.

Repository: GitHub

License: MIT

See Also: computable-reals

Topics: mathematics