Floating-point extensions


Arithmetic functions

sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, sqrt, expt

Rounding functions

ceiling, floor, round, truncate

Type conversion



floatp, integerp

acos function

Syntax: (acos number)

Returns the arc cosine of number, in radians.

asin function

Syntax: (asin number)

Returns the arc sine of number, in radians.

atan function

Syntax: (atan number1 [number2])

Returns the arc tangent of number1/number2, in radians. If number2 is omitted it defaults to 1.

ceiling function

Syntax: (ceiling number [divisor])

Returns the smallest integer greater than or equal to number/divisor. If divisor is omitted it defaults to 1.

cos function

Syntax: (cos number)

Returns the cosine of number radians.

For example:

> (cos 3.14159)

cosh function

Syntax: (cosh number)

Returns the hyperbolic cosine of number.

exp function

Syntax: (exp number)

Returns e raised to the specified number.

expt function

Syntax: (expt number power)

Returns number raised to the specified power.

float function

Syntax: (float number)

Returns its argument converted to a floating-point number.

floatp function

Syntax: (floatp item)

Returns t if its argument is a floating-point number.

floor function

Syntax: (floor number [divisor])

Returns the greatest integer less than or equal to number/divisor. If divisor is omitted it defaults to 1.

integerp function

Syntax: (integerp item)

Returns t if its argument is an integer.

log function

Syntax: (number [base])

Returns the logarithm of number to the specified base. If base is omitted it defaults to e.

random function

Syntax: (random item)

The random function is extended so that with a floating-point argument it returns a random floating-point number between zero and that number.

round function

Syntax: (round number [divisor])

Returns the integer closest to number/divisor. If divisor is omitted it defaults to 1.

sin function

Syntax: (sin number)

Returns the sine of number radians.

For example:

> (sin 3.14159)

sinh function

Syntax: (sinh number)

Returns the hyperbolic sine of number.

sqrt function

Syntax: (sqrt number)

Returns the square root of number.

tan function

Syntax: (tan number)

Returns the tangent of number radians.

tanh function

Syntax: (tanh number)

Returns the hyperbolic tangent of number.

truncate function

Syntax: (truncate number [divisor])

Returns the integer part of number/divisor. If divisor is omitted it defaults to 1. For example:

(truncate x 100)

is equivalent to writing:

(truncate (/ x 100))