Skip to content

Latest commit

 

History

History
789 lines (495 loc) · 15.3 KB

File-std-math-ml-790065500.md

File metadata and controls

789 lines (495 loc) · 15.3 KB

std/math.ml

Home · Files

Provides the std math package.

Package: std.math

Reachable from entry: no

Declarations

abs

function abs(x)

Absolute value.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:64

acos

function acos(x)

Arccosine acos(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:626

asin

function asin(x)

Arcsine asin(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:619

atan

function atan(x)

Arctangent (fast approximation).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:439

atan2

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

ceil

function ceil(x)

Ceil(x) -> integer-valued number.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:145

ceilInt

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

clamp

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

cos

function cos(x)

Cosine (fast approximation).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:397

cosh

function cosh(x)

Hyperbolic cosine cosh(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:641

degToRad

function degToRad(deg)

Converts degrees to radians.

Parameter Type Default Description
deg dynamic — Value supplied for deg.

Source: std/math.ml:253

e

function e()

Mathematical constant e.

Source: std/math.ml:496

exp

function exp(x)

Exponential function exp(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:524

expm1

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

floor

function floor(x)

Floor(x) -> integer-valued number.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:125

floorInt

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

fract

function fract(x)

Fractional part of x.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:657

gcd

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

hypot

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

invSqrt

function invSqrt(x)

Inverse square root 1/sqrt(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:609

isIntValue

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

isNumber

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

lcm

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

lerp

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

ln

function ln(x)

Natural logarithm ln(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:543

ln10

function ln10()

Natural logarithm of 10.

Source: std/math.ml:506

ln1p

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

ln2

function ln2()

Natural logarithm of 2.

Source: std/math.ml:501

log10

function log10(x)

Base-10 logarithm log10(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:566

log2

function log2(x)

Base-2 logarithm log2(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:572

max

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

min

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

pi

function pi()

Mathematical constant pi.

Source: std/math.ml:242

pow

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

powi

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

radToDeg

function radToDeg(rad)

Converts radians to degrees.

Parameter Type Default Description
rad dynamic — Value supplied for rad.

Source: std/math.ml:259

round

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

roundInt

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

sign

function sign(x)

Sign of a number.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:76

sin

function sin(x)

Sine (fast approximation).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:368

sinh

function sinh(x)

Hyperbolic sine sinh(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:633

smoothstep

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

sqrt

function sqrt(x)

Square root (Newton iteration).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:265

tan

function tan(x)

Tangent (sin/cos).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:425

tanh

function tanh(x)

Hyperbolic tangent tanh(x).

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:649

tau

function tau()

Mathematical constant tau (2*pi).

Source: std/math.ml:247

toIntExact

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

trunc

function trunc(x)

Truncates towards 0.

Parameter Type Default Description
x dynamic — Value supplied for x.

Source: std/math.ml:158

truncInt

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