Next: 6.4 I/O Facilities Up: 6 Predefined Functions and Previous: 6.2 String Manipulation

6.3 Mathematical Functions

This library is an interface to some functions of the standard C math library. Moreover, it registers a fallback for the binary operator ^ which, when applied to numbers x^y , returns x^y.

The library provides the following functions:

abs acos asin atan atan2 ceil cos floor log log10
max min  mod  sin  sqrt tan random randomseed
Most of them are only interfaces to the homonymous functions in the C library, except that, for the trigonometric functions, all angles are expressed in degrees.

The function max returns the maximum value of its numeric arguments. Similarly, min computes the minimum. Both can be used with an unlimited number of arguments.

The function mod is equivalent to the % operator in C.

The functions random and randomseed are interfaces to the simple random generator functions rand and srand , provided by ANSI C. The function random returns pseudo-random numbers in the range [0,1).


Next: 6.4 I/O Facilities Up: 6 Predefined Functions and Previous: 6.2 String Manipulation