math - the usual functions on floats.
Everything returns a float, whatever it was given: an integer handed to one of these is converted on the way into C and comes back a float, and stays one through the arithmetic that follows.
The functions are the ones of the C math library, declared and called through the ffi module. There is no shared object of our own in between, since the interpreter is already linked against libm and dlopen(null) is the handle of the program itself.
¶Pi = 3.141592653589793valuesource
¶E = 2.718281828459045valuesource
¶Sqrt2 = 1.4142135623730951valuesource
¶SqrtPi = 1.772453850905516valuesource
¶Ln2 = 0.6931471805599453valuesource
¶Ln10 = 2.302585092994046valuesource
¶MaxInt = 9223372036854775807valuesource
MaxInt is the largest integer that fits in a tau int, MinInt the smallest.
¶MinInt = - 9223372036854775807 - 1valuesource
¶Sqrt = ffi.Func(libm.sqrt, "double sqrt(double)")valuesource
¶Cbrt = ffi.Func(libm.cbrt, "double cbrt(double)")valuesource
¶Exp = ffi.Func(libm.exp, "double exp(double)")valuesource
¶Log = ffi.Func(libm.log, "double log(double)")valuesource
¶Log2 = ffi.Func(libm.log2, "double log2(double)")valuesource
¶Log10 = ffi.Func(libm.log10, "double log10(double)")valuesource
¶Sin = ffi.Func(libm.sin, "double sin(double)")valuesource
¶Cos = ffi.Func(libm.cos, "double cos(double)")valuesource
¶Tan = ffi.Func(libm.tan, "double tan(double)")valuesource
¶Asin = ffi.Func(libm.asin, "double asin(double)")valuesource
¶Acos = ffi.Func(libm.acos, "double acos(double)")valuesource
¶Atan = ffi.Func(libm.atan, "double atan(double)")valuesource
¶Sinh = ffi.Func(libm.sinh, "double sinh(double)")valuesource
¶Cosh = ffi.Func(libm.cosh, "double cosh(double)")valuesource
¶Tanh = ffi.Func(libm.tanh, "double tanh(double)")valuesource
¶Floor = ffi.Func(libm.floor, "double floor(double)")valuesource
¶Ceil = ffi.Func(libm.ceil, "double ceil(double)")valuesource
¶Round = ffi.Func(libm.round, "double round(double)")valuesource
¶Trunc = ffi.Func(libm.trunc, "double trunc(double)")valuesource
¶Pow = ffi.Func(libm.pow, "double pow(double, double)")valuesource
¶Atan2 = ffi.Func(libm.atan2, "double atan2(double, double)")valuesource
¶Mod = ffi.Func(libm.fmod, "double fmod(double, double)")valuesource
¶Hypot = ffi.Func(libm.hypot, "double hypot(double, double)")valuesource
¶Abs = fn(x)source
Abs is the absolute value, an integer staying an integer: it is the one case where going through a float would lose the largest values.
¶Inf = fn(sign)source
Inf returns positive infinity, or negative when sign is negative. A division is how a float says it, and there is no function to ask for one.
¶NaN = fn()source
NaN returns a value that is not a number, and IsNaN is how to recognise one: != does not follow IEEE here, so x != x is not the test it is in C.
¶IsNaN = fn(x)source
¶IsInf = fn(x)source
¶Min = fn(a, b)source
¶Max = fn(a, b)source
¶Signum = fn(x)source
Signum is -1, 0 or 1, following the sign of x.