I\'d like to play with those traps for educational purpose.
A common problem with the default behavior in numerical calculus is that we \"miss\" the Nan (or +-inf) that
Maple's programming language has a numeric model that respects IEEE-754 and allows you to set your own trap handlers, if you want. Here are some links:
An uncommon property of Maple is that default floating point numbers are decimal (not binary) and of arbitrary precision. If you want to deal with 64-bit binary floating point numbers, wrap them in HFloat
. For example, 0.2
represents the decimal number exactly, whereas HFloat(0.2)
represents the same number you'd get by assigning 0.2 to a double in C. This is evident by running, for example,
a := HFloat(0.2);
b := 0.2;
evalf[20](a - b);
This computes the difference between a
and b
using 20 decimal digit arithmetic, and the result is 0.11E-16
.