HomeContentsContents
abs() acos() asin() atan()
atan2() cos() exp() log()
max() min() pow() random()
round() sin() sqrt() tan()

abs()

INTEGER|FLOAT abs(INTEGER|FLOAT number)

This function returns the absolute value of number, where number can be either a float or an integer (and the same type of value is returned).


        abs(-6)
            => 6 
 
        abs(7)
            => 7 
 
        abs(-000.12)
            => 0.12
    
Top

Math

FLOAT acos(FLOAT x)

FLOAT asin(FLOAT x)

FLOAT atan(FLOAT x)

FLOAT atan2(FLOAT x, FLOAT y)

FLOAT cos(FLOAT x)

FLOAT exp(FLOAT x)

FLOAT log(FLOAT x)

FLOAT pow(FLOAT x, FLOAT y)

FLOAT sin(FLOAT x)

FLOAT sqrt(FLOAT x)

FLOAT tan(FLOAT x)

These functions perform the relevant mathematic functions on the argument(s) and return the results. Further information on each function can be found in the unix man page on the same relative functions in C. The precision of the function may vary by the implementation. If a floating point exception occurs, the error ~fpe is thrown.

Top

max()

FLOAT|INTEGER|STRING max(FLOAT|INTEGER|STRING arg, ...)

This function returns the maximum of its arguments. All of the arguments must be of the same type, and must be floats, integers or strings.


        max(3, 7, 9, 5)
            => 9
 
        max("Foo", "aardvark", "bar", "Quux")
            => "Quux"
    
Top

min()

FLOAT|INTEGER|STRING min(FLOAT|INTEGER|STRING arg, ...)

This function returns the minimum of its arguments. All of the arguments must be of the same type, and must be floats, integers or strings.


        min(3, 7, 9, 5)
            => 3
 
        min("Foo", "aardvark", "bar", "Quux")
            => "aardvark"
    
Top

random()

INTEGER random(INTEGER max)

This function returns a random integer between 1 and max.


        random(10)
            => 3
    
Top

round()

INTEGER round(FLOAT x)

This functions takes a float and rounds it to the nearest integer value.


        round(1.7)
            => 2
            
        round(1.3)
            => 1
    
Top

Contents Previous Next Index

Valid XHTML 1.0 Strict