fp - floating point operations — Inferno 1ed
fp - floating point operations
include "math.m"; math:= load Math Math->PATH; Infinity, NaN, MachEps, Pi, Degree : real; INVAL, ZDIV, OVFL, UNFL, INEX : int; RND_NR, RND_NINF, RND_PINF, RND_Z, RND_MASK: int; getFPcontrol, getFPstatus: fn() : int; FPcontrol, FPstatus: fn(r, mask: int) : int; ilogb : fn(x: real) : int; scalbn : fn(x: real, n: int) : real; copysign : fn(x, s: real) : real; finite, isnan : fn(x: real) : int; nextafter : fn(x, y: real) : real; fdim, fmin, fmax : fn(x, y: real) : real; fabs : fn(x: real) : real; ceil, floor : fn(x: real) : real; remainder : fn(x, p: real) : real; fmod : fn(x, y: real) : real; modf : fn(x: real) :(int, real); rint : fn(x: real) : real;
Description
These constants and functions provide control over rounding modes, exceptions, and other properties of floating point arithmetic.|
INVAL
|
invalid operation
|
0/0, 0+NaN, Infinity-Infinity, or sqrt(-1)
|
|
ZDIV
|
division by zero
|
1/0
|
|
OVFL
|
overflow
|
1.8e308
|
|
UNFL
|
underflow
|
1.1e-308
|
|
INEX
|
inexact
|
.3*.3
|
By default, INEX is quiet, OVFL, UNFL, and ZDIV are fatal, and rounding is to nearest even number. Limbo modules are entitled to assume this, and if they need to use quiet OVFL, UNFL, or ZDIV, they must either set and restore the control register or clearly document that the modules that call them must do so.
|
RND_NR
|
round to nearest even
|
|
RND_NINF
|
round toward negative infinity
|
|
RND_PINF
|
round toward infinity
|
|
RND_Z
|
round toward zero
|
|
FPcontrol(0, UNFL);
|
Make underflow silent.
|
|
FPstatus(0, INEX);
|
Check and clear the inexact flag.
|
|
FPcontrol (RND_PINF, RND_MASK);
|
Set directed rounding.
|
infernosupport@lucent.com Copyright © 1996,Lucent Technologies, Inc. All rights reserved.