elem - elementary functions of applied mathematics
|
fp - floating point operations
|
linalg - linear algebra primitives
|
include "math.m"; math:= load Math Math->PATH;
Limbo expressions involving only literal and named constants are evaluated at compile time with all exceptions ignored. However, arithmetic on variables is left to run-time, even if data path analysis shows the value to be a compile time constant. This implies that tools generating Limbo source must do their own simplification, and not expect the compiler to change x/x into 1, or -(y-x) into x-y, or even x-0 into x. Negation, -x, changes the sign of x, as opposed to computing 0.-x, which gives a different result for x=0.
Subexpression elimination and other forms of code motion may be done by the compiler, but not across calls to the mode and status functions described in fp - floating point operations. Removal of parentheses or factoring is not performed by the compiler. The evaluation order of a+b+c follows the parse tree and is therefore the same as for (a+b)+c. These rules are the same as for Fortran and the C language.
Contracted multiply-add instructions with a single rounding are not generated by the compiler, though they may be used in the native BLAS (linear algebra) libraries. All arithmetic follows the IEEE floating point standard, except that denormalized numbers may be replaced by flush-to-0, depending on what the hardware makes feasible.