Next: , Previous: Bitwise Operations, Up: Numbers


3.9 Standard Mathematical Functions

These mathematical functions allow integers as well as floating point numbers as arguments.

— Function: sin arg
— Function: cos arg
— Function: tan arg

These are the ordinary trigonometric functions, with argument measured in radians.

— Function: asin arg

The value of (asin arg) is a number between −pi/2 and pi/2 (inclusive) whose sine is arg; if, however, arg is out of range (outside [-1, 1]), it signals a domain-error error.

— Function: acos arg

The value of (acos arg) is a number between 0 and pi (inclusive) whose cosine is arg; if, however, arg is out of range (outside [-1, 1]), it signals a domain-error error.

— Function: atan y &optional x

The value of (atan y) is a number between −pi/2 and pi/2 (exclusive) whose tangent is y. If the optional second argument x is given, the value of (atan y x) is the angle in radians between the vector [x, y] and the X axis.

— Function: exp arg

This is the exponential function; it returns e to the power arg. e is a fundamental mathematical constant also called the base of natural logarithms.

— Function: log arg &optional base

This function returns the logarithm of arg, with base base. If you don't specify base, the base e is used. If arg is negative, it signals a domain-error error.

— Function: log10 arg

This function returns the logarithm of arg, with base 10. If arg is negative, it signals a domain-error error. (log10 x) == (log x 10), at least approximately.

— Function: expt x y

This function returns x raised to power y. If both arguments are integers and y is positive, the result is an integer; in this case, overflow causes truncation, so watch out.

— Function: sqrt arg

This returns the square root of arg. If arg is negative, it signals a domain-error error.


Xah Signet