# RealMath

Note: The functions defined here used to use to "*f" versions of the math functions. These turned out to be ISO C functions, and are not available on Mac OSX at the time of writing. Therefore, they were replaced with some C level type cast trickery, which prevent them from being used in a procedure variable, but should work fine otherwise.

Procedure Summary
arccos(REAL): REAL Returns the arccosine of x, in the range [0, pi] where -1 <= x <= 1.
arccosh(REAL): REAL arccosh(x) is the arc hyperbolic cosine of x.
arcsin(REAL): REAL Returns the arcsine of x, in the range [-pi/2, pi/2] where -1 <= x <= 1.
arcsinh(REAL): REAL arcsinh(x) is the arc hyperbolic sine of x.
arctan(REAL): REAL Returns the arctangent of x, in the range [-pi/2, pi/2] for all x.
arctan2(REAL, REAL): REAL arctan2(xn,xd) is the quadrant-correct arc tangent atan(xn/xd).
arctanh(REAL): REAL arctanh(x) is the arc hyperbolic tangent of x.
cos(REAL): REAL
cosh(REAL): REAL cosh(x) is the hyperbolic cosine of x.
exp(REAL): REAL Returns the exponential of x for x < Ln(MAX(REAL).
ln(REAL): REAL Returns the natural logarithm of x for x > 0.
power(REAL, REAL): REAL Returns the value of the number base raised to the power exponent for base > 0.
round(REAL): LONGINT Returns the value of x rounded to the nearest integer.
sin(REAL): REAL
sincos(REAL, VAR REAL, VAR REAL) More efficient sin/cos implementation if both values are needed.
sinh(REAL): REAL sinh(x) is the hyperbolic sine of x.
sqrt(REAL): REAL Returns the positive square root of x where x >= 0.
tan(REAL): REAL Returns the tangent of x where x cannot be an odd multiple of pi/2.
tanh(REAL): REAL tanh(x) is the hyperbolic tangent of x.

Constant Summary
exp1
pi

Procedure Detail

### arccos

    PROCEDURE arccos(x: REAL): REAL

> Returns the arccosine of x, in the range [0, pi] where -1 <= x <= 1.

### arccosh

    PROCEDURE arccosh(x: REAL): REAL

> arccosh(x) is the arc hyperbolic cosine of x. All arguments greater than or equal to 1 are legal.

### arcsin

    PROCEDURE arcsin(x: REAL): REAL

> Returns the arcsine of x, in the range [-pi/2, pi/2] where -1 <= x <= 1.

### arcsinh

    PROCEDURE arcsinh(x: REAL): REAL

> arcsinh(x) is the arc hyperbolic sine of x. All arguments are legal.

### arctan

    PROCEDURE arctan(x: REAL): REAL

> Returns the arctangent of x, in the range [-pi/2, pi/2] for all x.

### arctan2

    PROCEDURE arctan2(xn: REAL;
                      xd: REAL): REAL

> arctan2(xn,xd) is the quadrant-correct arc tangent atan(xn/xd). If the denominator xd is zero, then the numerator xn must not be zero. All arguments are legal except xn = xd = 0.

### arctanh

    PROCEDURE arctanh(x: REAL): REAL

> arctanh(x) is the arc hyperbolic tangent of x. |x| < 1 - sqrt(em), where em is machine epsilon. Note that |x| must not be so close to 1 that the result is less accurate than half precision.

### cos

    PROCEDURE cos(x: REAL): REAL

### cosh

    PROCEDURE cosh(x: REAL): REAL

> cosh(x) is the hyperbolic cosine of x. The argument x must not be so large that exp(|x|) overflows.

### exp

    PROCEDURE exp(x: REAL): REAL

> Returns the exponential of x for x < Ln(MAX(REAL).

### ln

    PROCEDURE ln(x: REAL): REAL

> Returns the natural logarithm of x for x > 0.

### power

    PROCEDURE power(base: REAL;
                    exponent: REAL): REAL

> Returns the value of the number base raised to the power exponent for base > 0.

### round

    PROCEDURE round(x: REAL): LONGINT

> Returns the value of x rounded to the nearest integer.

### sin

    PROCEDURE sin(x: REAL): REAL

### sincos

    PROCEDURE sincos(x: REAL;
                     VAR sin: REAL;
                     VAR cos: REAL)

> More efficient sin/cos implementation if both values are needed.

### sinh

    PROCEDURE sinh(x: REAL): REAL

> sinh(x) is the hyperbolic sine of x. The argument x must not be so large that exp(|x|) overflows.

### sqrt

    PROCEDURE sqrt(x: REAL): REAL

> Returns the positive square root of x where x >= 0.

### tan

    PROCEDURE tan(x: REAL): REAL

> Returns the tangent of x where x cannot be an odd multiple of pi/2.

### tanh

    PROCEDURE tanh(x: REAL): REAL

> tanh(x) is the hyperbolic tangent of x. All arguments are legal.

Constant Detail

### exp1

    CONST exp1

### pi

    CONST pi