abla/math/fast

Generated from source.

Import with import "abla/math/fast".

Source: abla/math/fast/entry.ab

min (fun)

fun min(left: int, right: int): int

Returns the smaller integer.

max (fun)

fun max(left: int, right: int): int

Returns the larger integer.

clamp (fun)

fun clamp(value: int, minimum: int, maximum: int): int

Clamps the integer between the bounds, choosing the upper bound when they cross.

ablaF64Sqrt (extern)

noescape extern:"intrinsic" fun ablaF64Sqrt(value: f64): f64

Returns the square root, or NaN for negative nonzero inputs.

ablaF64Floor (extern)

noescape extern:"intrinsic" fun ablaF64Floor(value: f64): f64

Rounds a double toward negative infinity to an integral value.

ablaF64Ceil (extern)

noescape extern:"intrinsic" fun ablaF64Ceil(value: f64): f64

Rounds a double toward positive infinity to an integral value.

ablaF64Trunc (extern)

noescape extern:"intrinsic" fun ablaF64Trunc(value: f64): f64

Rounds a double toward zero to an integral value.

ablaF64Abs (extern)

noescape extern:"intrinsic" fun ablaF64Abs(value: f64): f64

Clears the sign bit of the double.

ablaF64RoundEven (extern)

noescape extern:"intrinsic" fun ablaF64RoundEven(value: f64): f64

Rounds a double to the nearest integer, breaking ties toward even.

ablaF64Minimum (extern)

noescape extern:"intrinsic" fun ablaF64Minimum(left: f64, right: f64): f64

Returns the IEEE minimum, propagating NaN and ordering negative zero below positive zero.

ablaF64Maximum (extern)

noescape extern:"intrinsic" fun ablaF64Maximum(left: f64, right: f64): f64

Returns the IEEE maximum, propagating NaN and ordering negative zero below positive zero.

ablaF64Fma (extern)

noescape extern:"intrinsic" fun ablaF64Fma(x: f64, y: f64, z: f64): f64

Lowers the fused multiply-add operation for the target.

ablaF64FmaIsFused (extern)

noescape extern:"intrinsic" fun ablaF64FmaIsFused(): bool

Reports whether the target intrinsic performs a fused multiply-add.

mathPi (val)

val mathPi: f64

pi

mathHalfPi (val)

val mathHalfPi: f64

pi / 2

mathQuarterPi (val)

val mathQuarterPi: f64

pi / 4

mathTau (val)

val mathTau: f64

2 pi

__mathPiLo (val)

val __mathPiLo: f64

pi - mathPi

__mathInvPio2 (val)

val __mathInvPio2: f64

2 / pi

__mathPio2_1 (val)

val __mathPio2_1: f64

first 33 bits of pi/2

__mathPio2_1t (val)

val __mathPio2_1t: f64

pi/2 - __mathPio2_1

__mathPio2_2 (val)

val __mathPio2_2: f64

second 33 bits of pi/2

__mathPio2_2t (val)

val __mathPio2_2t: f64

pi/2 - (__mathPio2_1 + __mathPio2_2)

__mathPio2_3 (val)

val __mathPio2_3: f64

third 33 bits of pi/2

__mathPio2_3t (val)

val __mathPio2_3t: f64

pi/2 - (__mathPio2_1 + __mathPio2_2 + __mathPio2_3)

__mathS1 (val)

val __mathS1: f64

sin kernel

__mathS2 (val)

val __mathS2: f64

sin kernel

__mathS3 (val)

val __mathS3: f64

sin kernel

__mathS4 (val)

val __mathS4: f64

sin kernel

__mathS5 (val)

val __mathS5: f64

sin kernel

__mathS6 (val)

val __mathS6: f64

sin kernel

__mathC1 (val)

val __mathC1: f64

cos kernel

__mathC2 (val)

val __mathC2: f64

cos kernel

__mathC3 (val)

val __mathC3: f64

cos kernel

__mathC4 (val)

val __mathC4: f64

cos kernel

__mathC5 (val)

val __mathC5: f64

cos kernel

__mathC6 (val)

val __mathC6: f64

cos kernel

__mathT0 (val)

val __mathT0: f64

tan kernel

__mathT1 (val)

val __mathT1: f64

tan kernel

__mathT2 (val)

val __mathT2: f64

tan kernel

__mathT3 (val)

val __mathT3: f64

tan kernel

__mathT4 (val)

val __mathT4: f64

tan kernel

__mathT5 (val)

val __mathT5: f64

tan kernel

__mathT6 (val)

val __mathT6: f64

tan kernel

__mathT7 (val)

val __mathT7: f64

tan kernel

__mathT8 (val)

val __mathT8: f64

tan kernel

__mathT9 (val)

val __mathT9: f64

tan kernel

__mathT10 (val)

val __mathT10: f64

tan kernel

__mathT11 (val)

val __mathT11: f64

tan kernel

__mathT12 (val)

val __mathT12: f64

tan kernel

__mathAtanHi0 (val)

val __mathAtanHi0: f64

atan(0.5) hi

__mathAtanHi1 (val)

val __mathAtanHi1: f64

atan(1.0) hi

__mathAtanHi2 (val)

val __mathAtanHi2: f64

atan(1.5) hi

__mathAtanHi3 (val)

val __mathAtanHi3: f64

atan(inf) hi

__mathAtanLo0 (val)

val __mathAtanLo0: f64

atan(0.5) lo

__mathAtanLo1 (val)

val __mathAtanLo1: f64

atan(1.0) lo

__mathAtanLo2 (val)

val __mathAtanLo2: f64

atan(1.5) lo

__mathAtanLo3 (val)

val __mathAtanLo3: f64

atan(inf) lo

__mathAT0 (val)

val __mathAT0: f64

atan polynomial

__mathAT1 (val)

val __mathAT1: f64

atan polynomial

__mathAT2 (val)

val __mathAT2: f64

atan polynomial

__mathAT3 (val)

val __mathAT3: f64

atan polynomial

__mathAT4 (val)

val __mathAT4: f64

atan polynomial

__mathAT5 (val)

val __mathAT5: f64

atan polynomial

__mathAT6 (val)

val __mathAT6: f64

atan polynomial

__mathAT7 (val)

val __mathAT7: f64

atan polynomial

__mathAT8 (val)

val __mathAT8: f64

atan polynomial

__mathAT9 (val)

val __mathAT9: f64

atan polynomial

__mathAT10 (val)

val __mathAT10: f64

atan polynomial

sqrt (fun)

fun sqrt(value: f64): f64

IEEE-754 operations that every target rounds identically: these lower to single instructions (or LLVM's exact expansions) on x86-64, AArch64 and Wasm. Returns the square root, or NaN for negative nonzero inputs.

floor (fun)

fun floor(value: f64): f64

Rounds toward negative infinity to an integral floating-point value.

ceil (fun)

fun ceil(value: f64): f64

Rounds toward positive infinity to an integral floating-point value.

trunc (fun)

fun trunc(value: f64): f64

Rounds toward zero to an integral floating-point value.

fabs (fun)

fun fabs(value: f64): f64

Returns the floating-point absolute value by clearing the sign bit.

roundEven (fun)

fun roundEven(value: f64): f64

Round half to even (IEEE roundTiesToEven), e.g. 2.5 -> 2.0, 3.5 -> 4.0.

isNaN (fun)

fun isNaN(value: f64): bool

Reports whether the value is NaN.

isFinite (fun)

fun isFinite(value: f64): bool

Reports whether the value is neither infinite nor NaN.

fmin (fun)

fun fmin(left: f64, right: f64): f64

The smaller of two f64s as IEEE 754-2019 minimum: NaN if either is NaN, and -0.0 below 0.0.

fmax (fun)

fun fmax(left: f64, right: f64): f64

The larger of two f64s as IEEE 754-2019 maximum: NaN if either is NaN, and 0.0 above -0.0.

fclamp (fun)

fun fclamp(value: f64, minimum: f64, maximum: f64): f64

value held to [minimum, maximum] (maximum wins if they cross), with fmin's and fmax's rules: NaN if any argument is NaN, and -0.0 below 0.0.

lerp (fun)

fun lerp(from: f64, to: f64, t: f64): f64

Interpolates from the first value at zero to the second at one, extrapolating outside that interval.

fma (fun)

fun fma(x: f64, y: f64, z: f64): f64

x * y + z rounded once (IEEE 754 fusedMultiplyAdd): the hardware's instruction where the target has one, an exact software routine elsewhere, so every target gives the same bits.

__mathFmaSoftware (fun)

fun __mathFmaSoftware(x: f64, y: f64, z: f64): f64

x y + z rounded once (IEEE 754 fusedMultiplyAdd), in integers: fma where the target has no fused multiply-add instruction, and at compile time. The exact sum is formed in 128 bits with a sticky bit, then rounded once to the nearest double (to even on a tie).

__mathClz (fun)

fun __mathClz(x: int): int

The number of leading zero bits of a 64-bit word.

__mathULess (fun)

@inline
fun __mathULess(a: int, b: int): bool

Compares the integer bit patterns as unsigned 64-bit values.

__mathMulHigh (fun)

@inline
fun __mathMulHigh(a: int, b: int): int

The high 64 bits of the unsigned 128-bit product a * b, from 32-bit halves with the carries out of the low word counted. (LLVM fuses the textbook form, which sums the middle terms first, into a 128-bit multiplication that wasm32 has only as a library call; this form it leaves alone.)

__mathShl128High (fun)

fun __mathShl128High(hi: int, lo: int, n: int): int

The 128-bit (hi, lo) shifted left by n >= 0: the high word, then the low word.

__mathShl128Low (fun)

fun __mathShl128Low(lo: int, n: int): int

Returns the low word of a 128-bit left shift, or zero for a shift of at least 64 bits.

__mathShr128High (fun)

fun __mathShr128High(hi: int, n: int): int

The 128-bit (hi, lo) shifted right by n >= 0 (logically): high word, low word.

__mathShr128Low (fun)

fun __mathShr128Low(hi: int, lo: int, n: int): int

Returns the low word of a logical right shift of the two-word integer.

hypot (fun)

fun hypot(x: f64, y: f64): f64

Returns the square root of the sum of squares, which can overflow or underflow while forming the squares.

__mathHigh (fun)

@inline
fun __mathHigh(value: f64): int

Returns the signed upper 32 bits of the double's representation.

__mathKernelSin (fun)

fun __mathKernelSin(x: f64, y: f64, hasTail: bool): f64

Approximates sine on the reduced interval, including the low-order tail when present.

__mathKernelCos (fun)

fun __mathKernelCos(x: f64, y: f64): f64

Approximates cosine on the reduced interval using the supplied low-order tail.

__mathKernelTan (fun)

fun __mathKernelTan(value: f64, tail: f64, odd: bool): f64

tan(x + y) for |x + y| <= ~pi/4 when odd is false, -1 / tan(x + y) when it is true (msun's k_tan.c).

__mathTrig (fun)

fun __mathTrig(x: f64, function: int): f64

sin (function 0), cos (1) or tan (2) of any finite x.

sin (fun)

fun sin(x: f64): f64

Returns the approximate sine of the angle in radians, or NaN for an infinite or NaN argument.

cos (fun)

fun cos(x: f64): f64

Returns the approximate cosine of the angle in radians, or NaN for an infinite or NaN argument.

tan (fun)

fun tan(x: f64): f64

Returns the approximate tangent of the angle in radians, or NaN for an infinite or NaN argument.

atan (fun)

fun atan(value: f64): f64

Returns the approximate arctangent in radians, propagating NaN.

atan2 (fun)

fun atan2(y: f64, x: f64): f64

The angle of the vector (x, y) from the +x axis, in (-pi, pi].

mathE (val)

val mathE: f64

e

mathLn2 (val)

val mathLn2: f64

ln 2

__mathExpOverflow (val)

val __mathExpOverflow: f64

exp overflows above this (709.782712893384)

__mathExpUnderflow (val)

val __mathExpUnderflow: f64

exp underflows below this (-745.1332191019411)

__mathLn2Hi (val)

val __mathLn2Hi: f64

ln 2, its high part (low 32 bits zero)

__mathLn2Lo (val)

val __mathLn2Lo: f64

ln 2 - __mathLn2Hi

__mathInvLn2 (val)

val __mathInvLn2: f64

1 / ln 2

__mathP1 (val)

val __mathP1: f64

exp polynomial (also pow's)

__mathP2 (val)

val __mathP2: f64

exp polynomial

__mathP3 (val)

val __mathP3: f64

exp polynomial

__mathP4 (val)

val __mathP4: f64

exp polynomial

__mathP5 (val)

val __mathP5: f64

exp polynomial

__mathHuge (val)

val __mathHuge: f64

1e300: squared, an overflow to infinity

__mathTiny (val)

val __mathTiny: f64

1e-300: squared, an underflow to zero

__mathTwoM1000 (val)

val __mathTwoM1000: f64

2^-1000

__mathTwo54 (val)

val __mathTwo54: f64

2^54

__mathTwo53 (val)

val __mathTwo53: f64

2^53

__mathTwoM54 (val)

val __mathTwoM54: f64

2^-54

__mathTwo1023 (val)

val __mathTwo1023: f64

2^1023

__mathThird (val)

val __mathThird: f64

1/3

__mathLg1 (val)

val __mathLg1: f64

log polynomial

__mathLg2 (val)

val __mathLg2: f64

log polynomial

__mathLg3 (val)

val __mathLg3: f64

log polynomial

__mathLg4 (val)

val __mathLg4: f64

log polynomial

__mathLg5 (val)

val __mathLg5: f64

log polynomial

__mathLg6 (val)

val __mathLg6: f64

log polynomial

__mathLg7 (val)

val __mathLg7: f64

log polynomial

__mathDpH (val)

val __mathDpH: f64

log2(1.5), its high part

__mathDpL (val)

val __mathDpL: f64

log2(1.5) - __mathDpH

__mathL1 (val)

val __mathL1: f64

pow's log polynomial

__mathL2 (val)

val __mathL2: f64

pow's log polynomial

__mathL3 (val)

val __mathL3: f64

pow's log polynomial

__mathL4 (val)

val __mathL4: f64

pow's log polynomial

__mathL5 (val)

val __mathL5: f64

pow's log polynomial

__mathL6 (val)

val __mathL6: f64

pow's log polynomial

__mathLg2H (val)

val __mathLg2H: f64

ln 2, its high 21 bits

__mathLg2L (val)

val __mathLg2L: f64

ln 2 - __mathLg2H

__mathCp (val)

val __mathCp: f64

2 / (3 ln 2)

__mathCpH (val)

val __mathCpH: f64

__mathCp rounded to a float

__mathCpL (val)

val __mathCpL: f64

__mathCp - __mathCpH

__mathIvLn2H (val)

val __mathIvLn2H: f64

1 / ln 2, its high 24 bits

__mathIvLn2L (val)

val __mathIvLn2L: f64

1 / ln 2 - __mathIvLn2H

__mathPowOvt (val)

val __mathPowOvt: f64

pow overflows when its log2 passes 1024 by more than this

__mathLow (fun)

@inline
fun __mathLow(value: f64): int

Returns the unsigned lower 32 bits of the double's representation.

__mathWords (fun)

fun __mathWords(high: int, low: int): f64

The f64 whose high and low 32-bit words are these.

__mathClearLow (fun)

fun __mathClearLow(value: f64): f64

value with its low 32 bits cleared.

__mathScalbn (fun)

fun __mathScalbn(x: f64, n: int): f64

x · 2^n for a normal x (msun's scalbn, for the results that need it).

exp (fun)

fun exp(value: f64): f64

e raised to x.

log (fun)

fun log(value: f64): f64

The natural logarithm of x: -inf at 0, NaN below.

pow (fun)

fun pow(x: f64, y: f64): f64

x raised to y, as C's pow: pow(x, ±0) and pow(1, y) are 1 even for a NaN, a negative x needs an integer y (NaN otherwise), and integer powers of integers are exact while representable.

__mathF32 (fun)

fun __mathF32(value: f32): f64

Widens a 32-bit float to a 64-bit float without rounding.

__mathToF32 (fun)

fun __mathToF32(value: f64): f32

Rounds a 64-bit float to the 32-bit format.

sqrt (fun)

fun sqrt(value: f32): f32

Returns the square root, or NaN for negative nonzero inputs.

floor (fun)

fun floor(value: f32): f32

Rounds toward negative infinity to an integral floating-point value.

ceil (fun)

fun ceil(value: f32): f32

Rounds toward positive infinity to an integral floating-point value.

trunc (fun)

fun trunc(value: f32): f32

Rounds toward zero to an integral floating-point value.

fabs (fun)

fun fabs(value: f32): f32

Returns the floating-point absolute value by clearing the sign bit.

roundEven (fun)

fun roundEven(value: f32): f32

Rounds to the nearest integral value, breaking ties toward even.

isNaN (fun)

fun isNaN(value: f32): bool

Reports whether the value is NaN.

isFinite (fun)

fun isFinite(value: f32): bool

Reports whether the value is neither infinite nor NaN.

fmin (fun)

fun fmin(left: f32, right: f32): f32

Returns the IEEE minimum, propagating NaN and sorting negative zero below positive zero.

fmax (fun)

fun fmax(left: f32, right: f32): f32

Returns the IEEE maximum, propagating NaN and sorting positive zero above negative zero.

fclamp (fun)

fun fclamp(value: f32, minimum: f32, maximum: f32): f32

Clamps to the bounds with IEEE minimum and maximum semantics, propagating NaN.

fma (fun)

fun fma(x: f32, y: f32, z: f32): f32

Returns the product plus the third operand rounded once.

lerp (fun)

fun lerp(from: f32, to: f32, t: f32): f32

Interpolates from the first value at zero to the second at one, extrapolating outside that interval.

atan2 (fun)

fun atan2(y: f32, x: f32): f32

Returns the approximate angle of the vector from the positive x-axis in radians, using both signs to choose the quadrant.

hypot (fun)

fun hypot(x: f32, y: f32): f32

Returns the square root of the sum of squares, which can overflow or underflow while forming the squares.

exp (fun)

fun exp(value: f32): f32

Returns the approximate exponential, overflowing to infinity and underflowing to zero.

log (fun)

fun log(value: f32): f32

Returns the approximate natural logarithm, with negative infinity for zero and NaN for negative values.

atan (fun)

fun atan(value: f32): f32

Returns the approximate arctangent in radians, propagating NaN.

sin (fun)

fun sin(value: f32): f32

Returns the approximate sine of the angle in radians, or NaN for an infinite or NaN argument.

cos (fun)

fun cos(value: f32): f32

Returns the approximate cosine of the angle in radians, or NaN for an infinite or NaN argument.

tan (fun)

fun tan(value: f32): f32

Returns the approximate tangent of the angle in radians, or NaN for an infinite or NaN argument.

pow (fun)

fun pow(x: f32, y: f32): f32

Approximates the base raised to the exponent, returning NaN for a finite negative base with a finite nonintegral exponent.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.