logos.lang.math

Module lang · package logos-lang

Functions

fnabs_f64

fn abs_f64(x: f64) -> f64

Returns the absolute value of x.

fnabs_i32

fn abs_i32(x: i32) -> i32

Returns the absolute value of x. Traps on i32::MIN (negation overflows).

fnabs_i64

fn abs_i64(x: i64) -> i64

Returns the absolute value of x. Traps on i64::MIN (negation overflows).

fnacos_f64

fn acos_f64(x: f64) -> f64

Returns the arccosine of x in radians, in [0, π] (NaN for |x| > 1).

fnasin_f64

fn asin_f64(x: f64) -> f64

Returns the arcsine of x in radians, in [-π/2, π/2] (NaN for |x| > 1).

fnatan_f64

fn atan_f64(x: f64) -> f64

Returns the arctangent of x in radians, in (-π/2, π/2).

fnatan2_f64

fn atan2_f64(y: f64, x: f64) -> f64

Returns the angle of the point (x, y) in radians, in (-π, π]. Note the (y, x) argument order.

fncbrt_f64

fn cbrt_f64(x: f64) -> f64

Returns the cube root of x.

fnceil_f64

fn ceil_f64(x: f64) -> f64

Returns the smallest integral value >= x (rounds toward +inf).

fncopysign_f64

fn copysign_f64(x: f64, y: f64) -> f64

Returns a value with the magnitude of x and the sign of y.

fncos_f64

fn cos_f64(x: f64) -> f64

Returns the cosine of x (radians).

fncosh_f64

fn cosh_f64(x: f64) -> f64

Returns the hyperbolic cosine of x.

fnE

fn E() -> f64

Returns Euler’s number e.

fnexp_f64

fn exp_f64(x: f64) -> f64

Returns e raised to the power x.

fnexp2_f64

fn exp2_f64(x: f64) -> f64

Returns 2 raised to the power x.

fnexpm1_f64

fn expm1_f64(x: f64) -> f64

Returns e^x - 1, computed accurately for x near zero.

fnfloor_f64

fn floor_f64(x: f64) -> f64

Returns the largest integral value <= x (rounds toward -inf).

fnfmod_f64

fn fmod_f64(x: f64, y: f64) -> f64

Returns the remainder of x / y with the sign of x (NaN for y == 0).

fnhypot_f64

fn hypot_f64(x: f64, y: f64) -> f64

Returns the Euclidean distance sqrt(x*x + y*y), avoiding intermediate overflow/underflow.

fnLN_10

fn LN_10() -> f64

Returns ln 10.

fnln_1p_f64

fn ln_1p_f64(x: f64) -> f64

Returns ln(1 + x), computed accurately for x near zero (NaN for x < -1).

fnLN_2

fn LN_2() -> f64

Returns ln 2.

fnln_f64

fn ln_f64(x: f64) -> f64

Returns the natural logarithm of x (NaN for x < 0, -inf for x == 0).

fnlog10_f64

fn log10_f64(x: f64) -> f64

Returns the base-10 logarithm of x (NaN for x < 0, -inf for x == 0).

fnlog2_f64

fn log2_f64(x: f64) -> f64

Returns the base-2 logarithm of x (NaN for x < 0, -inf for x == 0).

fnmax_f64

fn max_f64(a: f64, b: f64) -> f64

Returns the larger of a and b. Returns b whenever a > b is false, so NaN handling differs from libm fmax.

fnmax_i32

fn max_i32(a: i32, b: i32) -> i32

Returns the larger of a and b.

fnmax_i64

fn max_i64(a: i64, b: i64) -> i64

Returns the larger of a and b.

fnmin_f64

fn min_f64(a: f64, b: f64) -> f64

Returns the smaller of a and b. Returns b whenever a < b is false, so NaN handling differs from libm fmin.

fnmin_i32

fn min_i32(a: i32, b: i32) -> i32

Returns the smaller of a and b.

fnmin_i64

fn min_i64(a: i64, b: i64) -> i64

Returns the smaller of a and b.

fnPI

fn PI() -> f64

Returns π.

fnpow_f64

fn pow_f64(x: f64, y: f64) -> f64

Returns x raised to the power y.

fnround_f64

fn round_f64(x: f64) -> f64

Rounds x to the nearest integral value, ties away from zero.

fnsin_f64

fn sin_f64(x: f64) -> f64

Returns the sine of x (radians).

fnsinh_f64

fn sinh_f64(x: f64) -> f64

Returns the hyperbolic sine of x.

fnSQRT_2

fn SQRT_2() -> f64

Returns √2.

fnsqrt_f64

fn sqrt_f64(x: f64) -> f64

Returns the square root of x (NaN for x < 0).

fntan_f64

fn tan_f64(x: f64) -> f64

Returns the tangent of x (radians).

fntanh_f64

fn tanh_f64(x: f64) -> f64

Returns the hyperbolic tangent of x.

fnTAU

fn TAU() -> f64

Returns τ = 2π.

fntrunc_f64

fn trunc_f64(x: f64) -> f64

Returns the integral part of x (rounds toward zero).