This library provides Float
& TrigoFloat
modules which export the following funcitons.
Float
module
new
-int -> int -> Float.t
inverse
-Float.t -> Float.t
add
-Float.t -> Float.t -> Float.t
sub
-Float.t -> Float.t -> Float.t
lt
-Float.t -> Float.t -> bool
lte
-Float.t -> Float.t -> bool
gte
-Float.t -> Float.t -> bool
gt
-Float.t -> Float.t -> bool
mul
-Float.t -> Float.t -> Float.t
div
-Float.t -> Float.t -> Float.t
modulo
-Float.t -> Float.t -> Float.t
resolve
-Float.t -> nat -> int
TrigoFloat
module
sinus
-Float.t * nat -> Float.t
cosinus
-Float.t * nat -> Float.t
The floating poing numbers are represented by a pair (a,b) where n = a * 10^b. The scientifc notation considers that the a
is defined as a float between -10 and 10) and b
is a nat
. Since there is no native float type, the a
is a nat
and can be greater than 10. All operations are applied in order to keep the number as a pair (a,b) where n = a * 10^b.
Basde on floating-point representation, this library introduces an implementation of trigonometric functions (cosinus, sinus). The implementation of sinus is based on Chebychev polynoms interpolation.
A makefile is provided to launch tests.
make test