4.3 Floats

The module Float contains procedures operating on floating point numbers.

IsFloat

{Float.is +X ?B}

tests whether X is a float.

/

{Float.'/' +F1 +F2 ?F3}

returns F1 divided by F2.

Exp

{Float.exp +F1 ?F2}

returns F1 to the power of e.

Log

{Float.log +F1 ?F2}

returns the logarithm to the base e of F1.

Sqrt

{Float.sqrt +F1 ?F2}

returns the square root of F1.

Ceil

{Float.ceil +F1 ?F2}

returns the ceiling of F1 (rounding towards positive infinity).

Floor

{Float.floor +F1 ?F2}

returns the floor of F1 (rounding towards negative infinity).

Round

{Float.round +F1 ?F2}

returns the integral value closest to F1. If there are two candidates, F1 is rounded to the closest even integral value, e. g., {Float.round 1.5} and {Float.round 2.5} both return 2.0.

Sin

{Float.sin +F1 ?F2}

returns the sine of F1.

Cos

{Float.cos +F1 ?F2}

returns the cosine of F1.

Tan

{Float.tan +F1 ?F2}

returns the tangent of F1.

Asin

{Float.asin +F1 ?F2}

returns the arc sine of F1.

Acos

{Float.acos +F1 ?F2}

returns the arc cosine of F1.

Atan

{Float.atan +F1 ?F2}

returns the arc tangent of F1.

Atan2

{Float.atan2 +F1 +F2 ?F3}

returns the principal value of the arc tangent of F1 / F2, using the signs of both arguments to determine the quadrant of the return value. An error exception may (but needs not) be raised if both arguments are zero.

Float.sinh

{Float.sinh +F1 ?F2}

returns the hyperbolic sine of F1.

Float.cosh

{Float.cosh +F1 ?F2}

returns the hyperbolic cosine of F1.

Float.tanh

{Float.tanh +F1 ?F2}

returns the hyperbolic tangent of F1.

Float.asinh

{Float.asinh +F1 ?F2}

returns the inverse hyperbolic sine of F1.

Float.acosh

{Float.acosh +F1 ?F2}

returns the inverse hyperbolic cosine of F1.

Float.atanh

{Float.atanh +F1 ?F2}

returns the inverse hyperbolic tangent of F1.

FloatToInt

{Float.toInt +F ?I}

returns the integer closest to float F. If there are two candidates, F is rounded to the closest even integer, e. g., {FloatToInt 1.5} and {FloatToInt 2.5} both return 2.

Danger

In the current implementation, the value is converted through a signed 32-bit integer, so this function is bogus when applied to large floats.

FloatToString

{Float.toString +F ?S}

returns the string describing the float F in Oz concrete syntax.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)