This library provides Rational
& TrigoFloat
modules which export the following funcitons.
Rational
module
new
-int -> int -> Rational.t
inverse
-Rational.t -> Rational.t
add
-Rational.t -> Rational.t -> Rational.t
sub
-Rational.t -> Rational.t -> Rational.t
lt
-Rational.t -> Rational.t -> bool
lte
-Rational.t -> Rational.t -> bool
gte
-Rational.t -> Rational.t -> bool
gt
-Rational.t -> Rational.t -> bool
mul
-Rational.t -> Rational.t -> Rational.t
div
-Rational.t -> Rational.t -> Rational.t
modulo
-Rational.t -> Rational.t -> Rational.t
resolve
-Rational.t -> nat -> int
TrigoRational
module
sinus
-Rational.t * nat -> Rational.t
cosinus
-Rational.t * nat -> Rational.t
The rational numbers are represented by a pair (p, q) where n = p / q. All operations are applied in order to keep the number as a product and division of rationals.
Based on rational numbers representation, this library introduces an implementation of trigonometric functions (cosinus, sinus). The implementation of sinus is based on Chebychev polynomials interpolation.
A makefile is provided to launch tests.
make test