math

Mathemtical functions for real numbers.

Summary
mathMathemtical functions for real numbers.
Constants
PiThe value of Pi to 34 significant digits.
Functions
absAbsolute value.
acosInverse cosine (arc cos).
acoshInverse hyperbolic cosine (arc cosh).
asinInverse sine (arc sin).
asinhInverse hyperbolic sine (arc sinh).
atanInverse tangent (arc tan).
atanhInverse hyperbolic tangent (arc tanh).
atan2Inverse tangent (arc tan) of y/x.
cbrtCube root.
ceilCeiling function.
cosCosine.
coshHyperbolic cosine.
erfError function.
erfcComplementary error function.
expExponentiation.
exp2Exponentiation (base 2).
expm1Calculates exp(x)-1.0.
floorFloor function.
frexpDecomposes a floating point number into a normalised fraction and an integral power of 10.
hypotHypotenuse.
intdivInteger division with rounding toward zero.
ldexpMultiplies a floating point value x by the number 10 raised to the exp power.
lgammaLog gamma function.
logLogarithm.
log10Logarithm (base 10).
log1pComputes the natural (base e) logarithm of 1+arg.
log2Logarithm (base 2).
nearbyintReturns an integer close to x by rounding.
signReturns -1 if x is negative, 0 if x is 0, or 1 if x is positive.
sinSine.
sinhHyperbolic sine.
sqrtSquare root.
tanTangent.
tanhHyperbolic tangent.
tgammaGamma function.
truncTruncate to integer (effectively, round toward zero).

Constants

Pi

The value of Pi to 34 significant digits.

Functions

abs

DECLARE NATIVE FUNCTION abs(x: Number): Number

Absolute value.

Reference

http://mathworld.wolfram.com/AbsoluteValue.html

Example

ASSERT math.abs(-5) = 5

acos

DECLARE NATIVE FUNCTION acos(x: Number): Number

Inverse cosine (arc cos).

Reference

http://mathworld.wolfram.com/InverseCosine.html

acosh

DECLARE NATIVE FUNCTION acosh(x: Number): Number

Inverse hyperbolic cosine (arc cosh).

Reference

http://mathworld.wolfram.com/InverseHyperbolicCosine.html

asin

DECLARE NATIVE FUNCTION asin(x: Number): Number

Inverse sine (arc sin).

Reference

http://mathworld.wolfram.com/InverseSine.html

asinh

DECLARE NATIVE FUNCTION asinh(x: Number): Number

Inverse hyperbolic sine (arc sinh).

Reference

http://mathworld.wolfram.com/InverseHyperbolicSine.html

atan

DECLARE NATIVE FUNCTION atan(x: Number): Number

Inverse tangent (arc tan).

Reference

http://mathworld.wolfram.com/InverseTangent.html

atanh

DECLARE NATIVE FUNCTION atanh(x: Number): Number

Inverse hyperbolic tangent (arc tanh).

Reference

http://mathworld.wolfram.com/InverseHyperbolicTangent.html

atan2

DECLARE NATIVE FUNCTION atan2( y,
x: Number): Number

Inverse tangent (arc tan) of y/x.  This two-argument form avoids problems where x is near 0.

Reference

http://mathworld.wolfram.com/InverseTangent.html

cbrt

DECLARE NATIVE FUNCTION cbrt(x: Number): Number

Cube root.

Refrence

http://mathworld.wolfram.com/CubeRoot.html

ceil

DECLARE NATIVE FUNCTION ceil(x: Number): Number

Ceiling function.

Reference

http://mathworld.wolfram.com/CeilingFunction.html

cos

DECLARE NATIVE FUNCTION cos(x: Number): Number

Cosine.

Reference

http://mathworld.wolfram.com/Cosine.html

cosh

DECLARE NATIVE FUNCTION cosh(x: Number): Number

Hyperbolic cosine.

Reference

http://mathworld.wolfram.com/HyperbolicCosine.html

erf

DECLARE NATIVE FUNCTION erf(x: Number): Number

Error function.

Reference

http://mathworld.wolfram.com/Erf.html

erfc

DECLARE NATIVE FUNCTION erfc(x: Number): Number

Complementary error function.

Reference

http://mathworld.wolfram.com/Erfc.html

exp

DECLARE NATIVE FUNCTION exp(x: Number): Number

Exponentiation.

Reference

http://mathworld.wolfram.com/Exponentiation.html

exp2

DECLARE NATIVE FUNCTION exp2(x: Number): Number

Exponentiation (base 2).

Reference

http://mathworld.wolfram.com/Exponentiation.html

expm1

DECLARE NATIVE FUNCTION expm1(x: Number): Number

Calculates exp(x)-1.0.  This function avoids numeric accuracy problems where x is close to zero.

Reference

http://mathworld.wolfram.com/Exponentiation.html

floor

DECLARE NATIVE FUNCTION floor(x: Number): Number

Floor function.

Reference

http://mathworld.wolfram.com/FloorFunction.html

frexp

DECLARE NATIVE FUNCTION frexp(x: Number,
OUT exp: Number): Number

Decomposes a floating point number into a normalised fraction and an integral power of 10.

hypot

DECLARE NATIVE FUNCTION hypot(x: Number,
y: Number): Number

Hypotenuse.  Calcuates sqrt(x^2 + y^2).

intdiv

DECLARE NATIVE FUNCTION intdiv(x: Number,
y: Number): Number

Integer division with rounding toward zero.

ldexp

DECLARE NATIVE FUNCTION ldexp(x: Number,
exp: Number): Number

Multiplies a floating point value x by the number 10 raised to the exp power.

lgamma

DECLARE NATIVE FUNCTION lgamma(x: Number): Number

Log gamma function.

Reference

http://mathworld.wolfram.com/LogGammaFunction.html

log

DECLARE NATIVE FUNCTION log(x: Number): Number

Logarithm.

Reference

http://mathworld.wolfram.com/Logarithm.html

log10

DECLARE NATIVE FUNCTION log10(x: Number): Number

Logarithm (base 10).

Reference

http://mathworld.wolfram.com/Logarithm.html

log1p

DECLARE NATIVE FUNCTION log1p(x: Number): Number

Computes the natural (base e) logarithm of 1+arg.  This function is more precise than the expression log(1+arg) if arg is close to zero.

Reference

http://mathworld.wolfram.com/Logarithm.html

log2

DECLARE NATIVE FUNCTION log2(x: Number): Number

Logarithm (base 2).

Reference

http://mathworld.wolfram.com/Logarithm.html

nearbyint

DECLARE NATIVE FUNCTION nearbyint(x: Number): Number

Returns an integer close to x by rounding.

sign

DECLARE NATIVE FUNCTION sign(x: Number): Number

Returns -1 if x is negative, 0 if x is 0, or 1 if x is positive.

Reference

http://mathworld.wolfram.com/Sign.html

sin

DECLARE NATIVE FUNCTION sin(x: Number): Number

Sine.

Reference

http://mathworld.wolfram.com/Sine.html

sinh

DECLARE NATIVE FUNCTION sinh(x: Number): Number

Hyperbolic sine.

Reference

http://mathworld.wolfram.com/HyperbolicSine.html

sqrt

DECLARE NATIVE FUNCTION sqrt(x: Number): Number

Square root.

Reference

http://mathworld.wolfram.com/SquareRoot.html

tan

DECLARE NATIVE FUNCTION tan(x: Number): Number

Tangent.

Reference

http://mathworld.wolfram.com/Tangent.html

tanh

DECLARE NATIVE FUNCTION tanh(x: Number): Number

Hyperbolic tangent.

Reference

http://mathworld.wolfram.com/HyperbolicTangent.html

tgamma

DECLARE NATIVE FUNCTION tgamma(x: Number): Number

Gamma function.

Reference

http://mathworld.wolfram.com/GammaFunction.html

trunc

DECLARE NATIVE FUNCTION trunc(x: Number): Number

Truncate to integer (effectively, round toward zero).

Reference

http://mathworld.wolfram.com/Truncate.html

DECLARE NATIVE FUNCTION abs(x: Number): Number
Absolute value.
DECLARE NATIVE FUNCTION acos(x: Number): Number
Inverse cosine (arc cos).
DECLARE NATIVE FUNCTION acosh(x: Number): Number
Inverse hyperbolic cosine (arc cosh).
DECLARE NATIVE FUNCTION asin(x: Number): Number
Inverse sine (arc sin).
DECLARE NATIVE FUNCTION asinh(x: Number): Number
Inverse hyperbolic sine (arc sinh).
DECLARE NATIVE FUNCTION atan(x: Number): Number
Inverse tangent (arc tan).
DECLARE NATIVE FUNCTION atanh(x: Number): Number
Inverse hyperbolic tangent (arc tanh).
DECLARE NATIVE FUNCTION atan2( y,
x: Number): Number
Inverse tangent (arc tan) of y/x.
DECLARE NATIVE FUNCTION cbrt(x: Number): Number
Cube root.
DECLARE NATIVE FUNCTION ceil(x: Number): Number
Ceiling function.
DECLARE NATIVE FUNCTION cos(x: Number): Number
Cosine.
DECLARE NATIVE FUNCTION cosh(x: Number): Number
Hyperbolic cosine.
DECLARE NATIVE FUNCTION erf(x: Number): Number
Error function.
DECLARE NATIVE FUNCTION erfc(x: Number): Number
Complementary error function.
DECLARE NATIVE FUNCTION exp(x: Number): Number
Exponentiation.
DECLARE NATIVE FUNCTION exp2(x: Number): Number
Exponentiation (base 2).
DECLARE NATIVE FUNCTION expm1(x: Number): Number
Calculates exp(x)-1.0.
DECLARE NATIVE FUNCTION floor(x: Number): Number
Floor function.
DECLARE NATIVE FUNCTION frexp(x: Number,
OUT exp: Number): Number
Decomposes a floating point number into a normalised fraction and an integral power of 10.
DECLARE NATIVE FUNCTION hypot(x: Number,
y: Number): Number
Hypotenuse.
DECLARE NATIVE FUNCTION intdiv(x: Number,
y: Number): Number
Integer division with rounding toward zero.
DECLARE NATIVE FUNCTION ldexp(x: Number,
exp: Number): Number
Multiplies a floating point value x by the number 10 raised to the exp power.
DECLARE NATIVE FUNCTION lgamma(x: Number): Number
Log gamma function.
DECLARE NATIVE FUNCTION log(x: Number): Number
Logarithm.
DECLARE NATIVE FUNCTION log10(x: Number): Number
Logarithm (base 10).
DECLARE NATIVE FUNCTION log1p(x: Number): Number
Computes the natural (base e) logarithm of 1+arg.
DECLARE NATIVE FUNCTION log2(x: Number): Number
Logarithm (base 2).
DECLARE NATIVE FUNCTION nearbyint(x: Number): Number
Returns an integer close to x by rounding.
DECLARE NATIVE FUNCTION sign(x: Number): Number
Returns -1 if x is negative, 0 if x is 0, or 1 if x is positive.
DECLARE NATIVE FUNCTION sin(x: Number): Number
Sine.
DECLARE NATIVE FUNCTION sinh(x: Number): Number
Hyperbolic sine.
DECLARE NATIVE FUNCTION sqrt(x: Number): Number
Square root.
DECLARE NATIVE FUNCTION tan(x: Number): Number
Tangent.
DECLARE NATIVE FUNCTION tanh(x: Number): Number
Hyperbolic tangent.
DECLARE NATIVE FUNCTION tgamma(x: Number): Number
Gamma function.
DECLARE NATIVE FUNCTION trunc(x: Number): Number
Truncate to integer (effectively, round toward zero).
Close