Provides the std math package.
Package: std.math
Reachable from entry: no
function abs(x)Absolute value.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:64
function acos(x)Arccosine acos(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:626
function asin(x)Arcsine asin(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:619
function atan(x)Arctangent (fast approximation).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:439
function atan2(y, x)Arctangent with quadrant handling.
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
dynamic |
— | Value supplied for y. |
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:464
function ceil(x)Ceil(x) -> integer-valued number.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:145
function ceilInt(x)Ceils a numeric value and requires an int result.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Numeric value to convert. |
Source: std/math.ml:213
function clamp(x, lo, hi)Clamp a number to [lo, hi].
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
lo |
dynamic |
— | Value supplied for lo. |
hi |
dynamic |
— | Value supplied for hi. |
Source: std/math.ml:93
function cos(x)Cosine (fast approximation).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:397
function cosh(x)Hyperbolic cosine cosh(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:641
function degToRad(deg)Converts degrees to radians.
| Parameter | Type | Default | Description |
|---|---|---|---|
deg |
dynamic |
— | Value supplied for deg. |
Source: std/math.ml:253
function e()Mathematical constant e.
Source: std/math.ml:496
function exp(x)Exponential function exp(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:524
function expm1(x)Expm1(x) = exp(x) - 1, with good accuracy near 0.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:530
function floor(x)Floor(x) -> integer-valued number.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:125
function floorInt(x)Floors a numeric value and requires an int result.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Numeric value to convert. |
Source: std/math.ml:203
function fract(x)Fractional part of x.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:657
function gcd(a, b)Greatest common divisor (Euclidean algorithm).
| Parameter | Type | Default | Description |
|---|---|---|---|
a |
dynamic |
— | First input value. |
b |
dynamic |
— | Second input value. |
Source: std/math.ml:315
function hypot(x, y)Hypotenuse: sqrt(xx + yy).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
y |
dynamic |
— | Value supplied for y. |
Source: std/math.ml:491
function invSqrt(x)Inverse square root 1/sqrt(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:609
function isIntValue(x)Checks whether a numeric value is an integer value.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:512
function isNumber(x)Checks whether a value is a numeric type.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:57
function lcm(a, b)Least common multiple.
| Parameter | Type | Default | Description |
|---|---|---|---|
a |
dynamic |
— | First input value. |
b |
dynamic |
— | Second input value. |
Source: std/math.ml:334
function lerp(a, b, t)Linear interpolation.
| Parameter | Type | Default | Description |
|---|---|---|---|
a |
dynamic |
— | First input value. |
b |
dynamic |
— | Second input value. |
t |
dynamic |
— | Value supplied for t. |
Source: std/math.ml:665
function ln(x)Natural logarithm ln(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:543
function ln10()Natural logarithm of 10.
Source: std/math.ml:506
function ln1p(x)Ln1p(x) = ln(1+x), with good accuracy near 0.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:553
function ln2()Natural logarithm of 2.
Source: std/math.ml:501
function log10(x)Base-10 logarithm log10(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:566
function log2(x)Base-2 logarithm log2(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:572
function max(a, b)Maximum of two values.
| Parameter | Type | Default | Description |
|---|---|---|---|
a |
dynamic |
— | First input value. |
b |
dynamic |
— | Second input value. |
Source: std/math.ml:116
function min(a, b)Minimum of two values.
| Parameter | Type | Default | Description |
|---|---|---|---|
a |
dynamic |
— | First input value. |
b |
dynamic |
— | Second input value. |
Source: std/math.ml:106
function pi()Mathematical constant pi.
Source: std/math.ml:242
function pow(base, exponent)Pow(base, exponent).
| Parameter | Type | Default | Description |
|---|---|---|---|
base |
dynamic |
— | Value supplied for base. |
exponent |
dynamic |
— | Value supplied for exponent. |
Source: std/math.ml:579
function powi(base, exp)Integer power (exponentiation by squaring).
| Parameter | Type | Default | Description |
|---|---|---|---|
base |
dynamic |
— | Value supplied for base. |
exp |
dynamic |
— | Value supplied for exp. |
Source: std/math.ml:275
function radToDeg(rad)Converts radians to degrees.
| Parameter | Type | Default | Description |
|---|---|---|---|
rad |
dynamic |
— | Value supplied for rad. |
Source: std/math.ml:259
function round(x)Rounds to the nearest integer (half away from zero).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:171
function roundInt(x)Rounds a numeric value and requires an int result.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Numeric value to convert. |
Source: std/math.ml:233
function sign(x)Sign of a number.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:76
function sin(x)Sine (fast approximation).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:368
function sinh(x)Hyperbolic sine sinh(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:633
function smoothstep(edge0, edge1, x)Smoothstep interpolation (Hermite).
| Parameter | Type | Default | Description |
|---|---|---|---|
edge0 |
dynamic |
— | Value supplied for edge0. |
edge1 |
dynamic |
— | Value supplied for edge1. |
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:673
function sqrt(x)Square root (Newton iteration).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:265
function tan(x)Tangent (sin/cos).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:425
function tanh(x)Hyperbolic tangent tanh(x).
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:649
function tau()Mathematical constant tau (2*pi).
Source: std/math.ml:247
function toIntExact(x)Converts a numeric value to int only when it has no fractional part. Returns a catchable type/range error instead of silently truncating data.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Numeric value to convert. |
Source: std/math.ml:184
function trunc(x)Truncates towards 0.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Value supplied for x. |
Source: std/math.ml:158
function truncInt(x)Truncates a numeric value toward zero and requires an int result.
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
dynamic |
— | Numeric value to convert. |
Source: std/math.ml:223