Next: , Previous:   [Contents][Index]


1.2 Numbers

Numbers are stored in double precision floating point format.

There’s no integer type. Whenever an integer argument is expected, the passed value is truncated.

Constant numbers consist in decimal digits and possibly a decimal dot. The dot may start the sequence; in this case the first digit is assumed to be a zero.

Numeric operators

x + y

Sum of x and y.

x - y

Difference of x and y.

x * y

Product of x and y.

x / y

Quotient of x and y.

x ^ y

x to the power y.

x mod y

Remainder after division of x by y.

Numeric functions

sqrt(x)

Square root of x.

exp(x)

Base-e exponential of x.

ln(x)

Natural logarithm of x.

sin(x), cos(x), tan(x)

Sine, cosine, tangent of x degrees.

asin(x), acos(x), atan(x)

Arcsine, arccosine, arctangent of x (in degrees).

deg(x)

Radians to degrees conversion.

rad(x)

Degrees to radians conversion.

abs(x)

Absolute value of x.

sign(x)

-1 if x < 0, 0 if x = 0, 1 if x > 0.

ceil(x)

Smallest integral value greater than or equal to x.

floor(x)

Largest integral value less than or equal to x.

round(x)

Integral value nearest to x.

min(x, y)

Minimum of x and y.

max(x, y)

Maximum of x and y.

clamp(x, y, z)

y if x < y, z if x > z, x otherwise.

Numeric constant

pi

Archimedes’ constant.


Next: , Previous:   [Contents][Index]