gizlang/libm
the C math library (libm) in Gizlang, one implementation on every system: a result has the same bits on Linux, macOS and Windows, and a call can inline. gizlang/math re-exports its functions, and the C library of static Linux programs exports them by their C names. The algorithms and their coefficients are those of fdlibm, as musl carries them (fma, scalbn, fmod and hypot are musl's). Arguments of sin, cos and tan beyond 2^20 pi/2 are reduced by the bits of 2/pi (Payne-Hanek). No function sets errno or a floating-point exception flag.
fdlibm: Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved.
import * as Libm from "gizlang/libm";Functions
scalbn
function scalbn(x: f64, n: i32): f64Scale by an integer power of two without constructing an overflowing intermediate power.
Effects: fail.
ldexp
function ldexp(x: f64, n: i32): f64X times 2 to the power N (scalbn).
Effects: fail.
logb
function logb(x: f64): f64The binary exponent of X: -inf for 0, |X| for an infinity, X for a NaN.
Effects: fail.
fabs
function fabs(x: f64): f64The absolute value of X.
Effects: fail.
copysign
function copysign(x: f64, y: f64): f64X with the sign of Y (libm).
Effects: fail.
nextafter
function nextafter(x: f64, y: f64): f64The next double after X toward Y.
Effects: fail.
fmax
function fmax(x: f64, y: f64): f64The larger of X and Y; a NaN loses to a number.
fmin
function fmin(x: f64, y: f64): f64The smaller of X and Y; a NaN loses to a number.
floor
function floor(x: f64): f64The largest integer not greater than X.
Effects: fail.
ceil
function ceil(x: f64): f64The smallest integer not less than X.
Effects: fail.
trunc
function trunc(x: f64): f64X without its fraction (rounded toward zero).
Effects: fail.
rint
function rint(x: f64): f64X rounded to an integer, ties to even.
Effects: fail.
nearbyint
function nearbyint(x: f64): f64X rounded to an integer, ties to even (rint).
Effects: fail.
roundeven
function roundeven(x: f64): f64X rounded to an integer, ties to even (rint).
Effects: fail.
round
function round(x: f64): f64X rounded to an integer, ties away from zero.
Effects: fail.
lround
function lround(x: f64): i64X rounded to an integer, ties away from zero, as an integer.
Effects: fail.
llround
function llround(x: f64): i64X rounded to an integer, ties away from zero, as an integer (lround).
Effects: fail.
lrint
function lrint(x: f64): i64X rounded to an integer, ties to even, as an integer.
Effects: fail.
llrint
function llrint(x: f64): i64X rounded to an integer, ties to even, as an integer (lrint).
Effects: fail.
fmod
function fmod(x: f64, y: f64): f64The remainder of X by Y with the sign of X, exact (musl).
Effects: fail.
remainder
function remainder(x: f64, y: f64): f64X minus the multiple of Y nearest to it, ties to even (fdlibm).
Effects: fail.
fma
function fma(x: f64, y: f64, z: f64): f64X times Y plus Z, rounded once.
Effects: fail.
hypot
function hypot(x: f64, y: f64): f64The length of (X, Y) without overflow or underflow in the squares (musl).
Effects: fail.
cbrt
function cbrt(x: f64): f64The cube root of X (musl).
Effects: fail.
exp
function exp(x: f64): f64e to the power X.
Effects: fail.
expm1
function expm1(x: f64): f64e^x - 1, exact near 0.
Effects: fail.
log
function log(x: f64): f64The natural logarithm of X.
Effects: fail.
log2
function log2(x: f64): f64The base-2 logarithm of X.
Effects: fail.
log10
function log10(x: f64): f64The base-10 logarithm of X.
Effects: fail.
log1p
function log1p(x: f64): f64log(1 + x), exact near 0.
Effects: fail.
pow
function pow(x: f64, y: f64): f64X to the power Y.
Effects: fail.
exp2
function exp2(x: f64): f642 to the power X.
Effects: fail.
sinh
function sinh(x: f64): f64Hyperbolic sine (libm).
Effects: fail.
cosh
function cosh(x: f64): f64Hyperbolic cosine (libm).
Effects: fail.
tanh
function tanh(x: f64): f64Hyperbolic tangent (libm).
Effects: fail.
asinh
function asinh(x: f64): f64Inverse hyperbolic sine (libm).
Effects: fail.
acosh
function acosh(x: f64): f64Inverse hyperbolic cosine (libm).
Effects: fail.
atanh
function atanh(x: f64): f64Inverse hyperbolic tangent (libm).
Effects: fail.
sin
function sin(x: f64): f64The sine of X (radians).
Effects: fail.
cos
function cos(x: f64): f64The cosine of X (radians).
Effects: fail.
tan
function tan(x: f64): f64The tangent of X (radians).
Effects: fail.
asin
function asin(x: f64): f64The arc sine of X, in radians.
Effects: fail.
acos
function acos(x: f64): f64The arc cosine of X, in radians.
Effects: fail.
atan
function atan(x: f64): f64The arc tangent of X, in radians.
Effects: fail.
atan2
function atan2(y: f64, x: f64): f64The angle of the point (X, Y) from the X axis, in radians (-π to π).
Effects: fail.
erf
function erf(x: f64): f64The error function and its complement, Gamma and log|Gamma| (libm).
Effects: fail.
erfc
function erfc(x: f64): f64The complementary error function, 1 - erf(X).
Effects: fail.
lgamma
function lgamma(x0: f64): f64The natural logarithm of the absolute value of the gamma function of X.
Effects: fail.
tgamma
function tgamma(x: f64): f64The gamma function of X.
Effects: fail.