Index

    DEFINITION Math;
    (*General purpose mathematical functions

    Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Compiler Developers".*)

    	CONST
    		pi = 3.14159265358979;
    		e = 2.71828182845905;

    	PROCEDURE sqrt(x: REAL): REAL;
    (*returns the square root of x, where x must be positive*)

    	PROCEDURE power(base, exp: REAL): REAL;
    (*returns base raised to exp*)

    	PROCEDURE exp(x: REAL): REAL;
    (*returns the constant e raised to x*)

    	PROCEDURE ln(x: REAL): REAL;
    (*returns the natural logarithm of x with base e*)

    	PROCEDURE log(x, base: REAL): REAL;
    (*log(x, b) returns the logarithm of x with base b*)

    	PROCEDURE round(x: REAL): REAL;
    (*returns x rounded to the nearest integer. If the fraction part of x is in range 0.0 to 0.5 then the result is the largest integer not greater than x, otherwise the result is x rounded up to the next highest whole number. Note that integer values cannot always be exactly represented in REAL format.*)

    	PROCEDURE sin(x: REAL): REAL;
    (*returns the sine of a radian value x*)

    	PROCEDURE cos(x: REAL): REAL;
    (*returns the cosine of a radian value x*)

    	PROCEDURE tan(x: REAL): REAL;
    (*returns the tangent of a radian value x*)

    	PROCEDURE arcsin(x: REAL): REAL;
    (*returns the inverse sine of x in radians, where -1 <= x <= 1*)

    	PROCEDURE arccos(x: REAL): REAL;
    (*returns the inverse cosine of x in radians, where -1 <= x <= 1*)

    	PROCEDURE arctan(x: REAL): REAL;
    (*returns the inverse tangent of x in radians, where -1 <= x <= 1*)

    	PROCEDURE arctan2(y, x: REAL): REAL;
    (*returns the inverse tangent in radians of y/x based on the signs of both values to determine the correct quadrant.*)

    	PROCEDURE sinh(x: REAL): REAL;
    (*returns the hyperbolic sine of x*)

    	PROCEDURE cosh(x: REAL): REAL;
    (*returns the hyperbolic cosine of x*)

    	PROCEDURE tanh(x: REAL): REAL;
    (*returns the hyperbolic tangent of x*)

    	PROCEDURE arcsinh(x: REAL): REAL;
    (*returns the inverse hyperbolic sine of x*)

    	PROCEDURE arccosh(x: REAL): REAL;
    (*returns the inverse hyperbolic cosine of x*)

    	PROCEDURE arctanh(x: REAL): REAL;
    (*returns the inverse hyperbolic tangent of x*)

    END Math.