MathabstractA namespace of mathematical constants and free functions -- Math.sin: x where a method hung off the number would read awkwardly. Number-centric operations (abs, floor, sqrt, pow:, min:, max:) live on Integer/Double; sqrt: and pow:to: are mirrored here in free-function style. Every function accepts an Integer or a Double and returns a Double; angles are in radians.
The arccosine, in radians in [0, pi]; an argument outside [-1, 1] yields NaN.
Math.acos:1 "* -> 0
The arcsine, in radians in [-pi/2, pi/2]; an argument outside [-1, 1] yields NaN.
Math.asin:1 "* -> 1.5707963267948966
The arctangent, in radians in (-pi/2, pi/2). For the angle of a vector, prefer atan:over:, which keeps the quadrant.
The angle of the vector (x, y) in radians in (-pi, pi] -- atan2, reading Math.atan: y over: x. Unlike atan: of y/x it keeps the quadrant and handles a zero x.
Math.atan:1 over:1 "* -> 0.7853981633974483
The cosine of an angle in radians.
Math.cos:0 "* -> 1
Euler's number, the base of the natural logarithm.
Math.e "* -> 2.718281828459045
e raised to the argument's power.
Math.exp:1 "* -> 2.718281828459045
The hypotenuse sqrt(a^2 + b^2) of a right triangle with legs a and b, computed without intermediate overflow.
Math.hypot:3 over:4 "* -> 5
The natural (base-e) logarithm. The domain is guarded: a zero or negative argument raises an ArithmeticError rather than returning NaN.
Math.ln:Math.e "* -> 1
The base-2 logarithm (domain-guarded like ln:).
Math.log2:8 "* -> 3
The base-10 logarithm (domain-guarded like ln:).
Math.log:1000 "* -> 3
The logarithm of the first argument in the base given by the second (the argument is domain-guarded like ln:).
Math.log:8 base:2 "* -> 3
The circle constant pi.
Math.pi "* -> 3.141592653589793
The first argument raised to the second's power, mirroring pow: on the numbers; always computed in floating point.
Math.pow:2 to:10 "* -> 1024
The sine of an angle in radians.
Math.sin:(Math.pi / 2) "* -> 1
The square root, mirroring sqrt on the numbers in free-function style; a negative argument raises an ArithmeticError.
Math.sqrt:2 "* -> 1.4142135623730951
The tangent of an angle in radians.
Tau = 2 pi, one full turn in radians.
Math.tau "* -> 6.283185307179586