MATH-INTRO(2)                                       MATH-INTRO(2)

     NAME
          Math: intro - elementary numerics

     SYNOPSIS
          include "math.m";
          math := load Math Math->PATH;

     DESCRIPTION
          Inferno's math module and Limbo compiler provide the
          fundamental floating point environment and ``elementary
          functions''.

          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.

          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 math-fp(2). 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 C.

          Contracted multiply-add instructions (with a single round-
          ing) 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.

          Binary/decimal conversion is properly rounded.  In particu-
          lar, printing a real using %g and reading it on a different
          machine is guaranteed to recover identical bits, including
          conversions done by the compiler.  The one exception is that
          smaller, faster, but sloppier run-time conversion routines
          may be used when mandated by limited memory embedded sys-
          tems.  Programmers may assume, however, that the features
          described in these man pages are present in all Inferno sys-
          tems intended for general computing.

     SOURCE
          /libinterp/math.c

     SEE ALSO

     Page 1                       Plan 9             (printed 3/28/24)

     MATH-INTRO(2)                                       MATH-INTRO(2)

          See math-fp(2) for floating point control and primitive
          arithmetic operations, math-elem(2) for the classical ele-
          mentary functions of applied mathematics, and math-linalg(2)
          for basic linear algebra functions.

     Page 2                       Plan 9             (printed 3/28/24)