Real
Module with operation on REAL type.
Const
FPZero* = Const.FPZero;
FPNormal* = Const.FPNormal;
FPSubnormal*= Const.FPSubnormal;
FPInfinite* = Const.FPInfinite;
FPNaN* = Const.FPNaN;
PI* = 3.1415926535897932384626433832795028841972;
E* = 2.7182818284590452353602874713526624977572;
Procedures
FPClassify
Categorizes floating point value
PROCEDURE FPClassify*(x : REAL): INTEGER;
IsNan
Return TRUE if x is a NaN (not a number), and FALSE otherwise.
PROCEDURE IsNan*(x : REAL): BOOLEAN;
IsInf
Return TRUE if x is a positive or negative infinity, and FALSE otherwise.
PROCEDURE IsInf*(x : REAL): BOOLEAN;
IsFinite
Return TRUE if x is neither an infinity nor a NaN, and FALSE otherwise.
PROCEDURE IsFinite*(x : REAL): BOOLEAN;
IsNormal
Return TRUE if x is neither an infinity nor a NaN or Zero, and FALSE otherwise.
PROCEDURE IsNormal*(x : REAL): BOOLEAN;
SignBit
Return TRUE if sign bit is set.
PROCEDURE SignBit*(x : REAL): BOOLEAN;
CopySign
Return a LONGREAL with the magnitude (absolute value) of x but the sign of y.
PROCEDURE CopySign*(x, y : REAL): REAL;
Abs
Return absolute value of x.
PROCEDURE Abs*(x : REAL): REAL;
Frexp
Decomposes given floating point value x into a normalized fraction and an integral power of two.
PROCEDURE Frexp*(x : REAL; VAR exp : LONGINT): REAL;
Scalbn
Multiplies a floating point value x by RADIX_FLT raised to power n
PROCEDURE Scalbn*(x : REAL; n : LONGINT): REAL;
Ldexp
Multiplies a floating point value arg by the number 2 raised to the exp power.
PROCEDURE Ldexp*(x : REAL; exp : LONGINT): REAL;
Max
Return largest of x & y
PROCEDURE Max* (x, y : REAL) : REAL;
Min
Return smallest of x & y
PROCEDURE Min* (x, y : REAL) : REAL;
Sin
Computes the sine of the angle REAL x in radians
PROCEDURE Sin* (x: REAL) : REAL ;
Cos
Computes the cosine of the angle REAL x in radians
PROCEDURE Cos* (x: REAL) : REAL ;
Tan
Computes the tangent of the angle REAL x in radians
PROCEDURE Tan* (x: REAL) : REAL ;
ArcSin
Computes the arc sine of the value REAL x
PROCEDURE ArcSin* (x: REAL) : REAL ;
ArcCos
Computes the arc cosine of the value REAL x
PROCEDURE ArcCos* (x: REAL) : REAL ;
ArcTan
Computes the arc tangent of the value REAL x
PROCEDURE ArcTan* (x: REAL) : REAL ;
ArcTan2
Computes the arc tangent of the value REAL x/y using the sign to select the right quadrant
PROCEDURE ArcTan2* (x, y: REAL) : REAL ;
Sqrt
Computes the square root of the REAL x
PROCEDURE Sqrt* (x: REAL) : REAL ;
Pow
Raises the Real argument x to power y
PROCEDURE Pow* (x, y: REAL) : REAL ;
Exp
Computes e raised to the power of x
PROCEDURE Exp* (x: REAL) : REAL ;
Log
Computes natural (e) logarithm of x
PROCEDURE Log* (x: REAL) : REAL ;
Log10
Computes common (base-10) logarithm of x
PROCEDURE Log10* (x: REAL) : REAL ;
Floor
Computes the largest integer value not greater than x
PROCEDURE Floor* (x: REAL) : REAL ;
Round
Computes the nearest integer value to x, rounding halfway cases away from zero
PROCEDURE Round *(x: REAL) : REAL ;
Random
Next psuedo random number between min and max or 0. -> 1. if both min & max = 0
PROCEDURE Random* (min := 0., max := 0. : REAL): REAL;
FromString
Convert string str to REAL in either decimal or hex format and optional start and length into str.
The benifit of the hex format is that the conversion is always exact.
- TODOFix overflow/underflow (return INF/-INF) and add rounding to many digits.
Skip trailing or leading zeros.
Return TRUE if success.
PROCEDURE FromString* (VAR result : REAL; str- : ARRAY OF CHAR; base := 10 : INTEGER; start := 0 : LONGINT ; length := -1 : LONGINT): BOOLEAN;