@head
@module math
@title math: Mathematical functions
This module contains several basic mathematical functions and a few numeric
constants.
All operations are implemented using floating point arithmetic, and all
functions return Float values. Functions accept integer arguments in
addition to floats, but integer arguments are converted to floats internally.
The argument types below only include Float for conciseness.
All angles are in radians.
Functions
@fun Sqrt(x as Float) as Float
@desc Return the square root of x.
@end
@fun Sin(x as Float) as Float
@desc Return the sine of x.
@end
@fun Cos(x as Float) as Float
@desc Return the cosine of x.
@end
@fun Tan(x as Float) as Float
@desc Return the tangent of x.
@end
@fun ArcSin(x as Float) as Float
@desc Return the arc sine of x.
@end
@fun ArcCos(x as Float) as Float
@desc Return the arc cosine of x.
@end
@fun ArcTan(y as Float[, x as Float]) as Float
@desc Return the arc tangent of y or y / x. If x is
negative, the magnitude of the result will be chosen to be
between Pi / 2 and Pi; otherwise,
the magnitude of the result is at most Pi / 2.
@end
@fun Ceil(x as Float) as Float
@desc Return x rounded up to the nearest integer.
@end
@fun Floor(x as Float) as Float
@desc Return x rounded down to the nearest integer.
@end
@fun Round(x as Float) as Float
@desc Return x rounded to the nearest integer.
@end
@fun Trunc(x as Float) as Float
@desc Return x rounded to the nearest integer towards zero.
@end
@fun Exp(x as Float) as Float
@desc Return e**x.
@end
@fun Log(x as Float) as Float
@desc Return the natural logarithm of x.
@note The logarithm in base y can be calculated as
Log(x) / Log(y).
@end
@end
@fun IsInf(x as Float) as Boolean
@desc Return a boolean indicating whether x is IEEE 754 positive or
negative infinity.
@end
@fun IsNaN(x as Float) as Boolean
@desc Return a boolean indicating whether x is IEEE 754 NaN
(Not-a-Number).
@end
Constants
@var Pi as Float
@desc The constant pi, approximately 3.14159.
@end
@var E as Float
@desc The constant e, approximately 2.71828.
@end