Floating point numbers |
Floating point numbers of arbitrarily large size are available through
the class
|
The precision can be set thanks to the global variable
Lower and upper certified approximates can be obtained as follows:
|
The above floating type is glued to
Mmx] |
use "numerix"; type_mode? := true; |
Mmx] |
a: Floating == 1.0 |
:
Mmx] |
exp a |
:
Mmx] |
sin a |
:
Mmx] |
1 / 0.0 |
:
Mmx] |
bit_precision := 128 |
:
Mmx] |
exp 1.0 |
:
Interval are implemented within the class
|
The above interval type is glued to
Mmx] |
a == interval (0.999, 1) |
:
Mmx] |
exp a |
:
Mmx] |
radius a |
:
Mmx] |
lower a |
:
Mmx] |
upper a |
:
Complex numbers are available through the class
|
The above complex type is glued to
Mmx] |
I == complex (0, 1) |
:
Mmx] |
I * I |
:
Mmx] |
1 / (1 + I) |
:
Mmx] |
I == complex (0 :> Floating, 1 :> Floating) |
:
Mmx] |
exp I |
:
Balls are implemented in the class
|
The above ball type is glued to
Mmx] |
a : Ball (Floating, Floating) == ball (3.0, 0.1) |
Mmx] |
[ center a, radius a ] |
Mmx] |
M (n) == if n = 0 then ball 2.0 else if n = 1 then ball (-4.0) else 111 - 1130 / M (n-1) + 3000 / (M(n-1) * M(n-2)); |
Mmx] |
for n in 1 .. 15 do mmout << n << " " << M n << lf; |