forsyth20121205-174063a80cc13 years agoHistory
79 lines · 2.2 KB · Text
RawDownload
.TH MATH-INTRO 2.SH NAMEMath: intro \- elementary numerics.SH SYNOPSIS.EXinclude "math.m";math := load Math Math->PATH;.EE.SH DESCRIPTIONInferno's math module and Limbo compiler provide thefundamental floating point environment and ``elementary functions''..PPLimbo expressions involving only literal and named constants areevaluated at compile time with all exceptions ignored.However,arithmetic on variables is left to run-time, even if data path analysisshows the value to be a compile time constant.This implies that toolsgenerating Limbo source must do their own simplification, and notexpect the compiler to change.B x/xinto.BR 1 ,or.B -(y-x)into.BR x-y ,or even.BR x-0into.BR x ..PPSubexpression elimination and other forms of code motion may be done by thecompiler,but not across calls to the mode and status functions described in.IR math-fp (2).Removal ofparentheses or factoring is not performed by the compiler.The evaluationorder of.B a+b+cfollows the parse tree and is therefore the same as for.BR (a+b)+c .These rules are the same as for Fortran and C..PPContracted multiply-add instructions (with a single rounding) are notgenerated by the compiler, though they may be used in the native BLAS(linear algebra)libraries.All arithmetic follows the IEEE floating point standard, except thatdenormalized numbers may be replaced by flush-to-0, depending on whatthe hardware makes feasible..PPBinary/decimal conversion is properly rounded.In particular, printinga real using.B %gand reading it on a different machine is guaranteed torecover identical bits, includingconversions done by the compiler.The one exception is thatsmaller, faster, but sloppier run-time conversionroutines may be used when mandated bylimited memory embedded systems.Programmers may assume, however,that thefeatures described in these man pages are present in all Infernosystems intended for general computing..SH SOURCE.B /libinterp/math.c.SH SEE ALSOSee.IR math-fp (2)for floating point control and primitive arithmetic operations,.IR math-elem (2)for the classical elementary functions of applied mathematics,and.IR math-linalg (2)for basic linear algebra functions.