math+x86_64 +linux

The math module provides implementations of common math functionality and support for dealing with floating point numbers.

Submodules

Index

Types

type fexcept = enum uint {
	NONE = 0, // No flags set
	// Occurs when there is no well-defined result of an operation, such as
	// with 0/0 or sqrt(-1)
	INVALID = 1 << 0,
	__DENORM = 1 << 1, // arch-specific
	DIVBYZERO = 1 << 2, // Occurs when an operation on finite numbers produces infinity
	// Occurs when the result of an operation is much bigger (by
	// absolute value) than the biggest representable finite number
	OVERFLOW = 1 << 3,
	// Occurs when the result of an operation is too small (by
	// absolute value) to be stored as a normalized number
	UNDERFLOW = 1 << 4,
	// Occurs when the result of an operation is rounded to a
	// value that differs from the infinite precision result.
	INEXACT = 1 << 5,
	ALL = INVALID | __DENORM | DIVBYZERO | OVERFLOW | UNDERFLOW | INEXACT, // Combination of all flags
};
type floatinfo = struct {
	// Bits in significand.
	mantbits: u64,
	// Bits in exponent.
	expbits: u64,
	// Bias of exponent.
	expbias: int,
	// Mask for mantissa.
	mantmask: u64,
	// Mask for exponent.
	expmask: u64,
};
type fround = enum uint {
	TONEAREST = 0, // Round towards nearest integer, with ties rounding to even
	DOWNWARD = 1024, // Round towards negative infinity
	UPWARD = 2048, // Round towards positive infinity
	TOWARDZERO = 3072, // Round towards zero
};

Constants

def E: f64 = 2.718281828459045;
def F32_EPS: f32 = 1.1920928955078125e-7;
def F32_EXPONENT_BIAS: u16 = 127;
def F32_EXPONENT_BITS: u64 = 8;
def F32_EXPONENT_MASK: u64 = (1 << F32_EXPONENT_BITS) - 1;
def F32_MANTISSA_BITS: u64 = 23;
def F32_MANTISSA_MASK: u64 = (1 << F32_MANTISSA_BITS) - 1;
def F32_MAX_NORMAL: f32 = 3.4028234e38;
def F32_MIN: f32 = 1.0e-45;
def F32_MIN_NORMAL: f32 = 1.1754944e-38;
def F64_EPS: f64 = 2.2204e-16;
def F64_EXPONENT_BIAS: u16 = 1023;
def F64_EXPONENT_BITS: u64 = 11;
def F64_EXPONENT_MASK: u64 = (1 << F64_EXPONENT_BITS) - 1;
def F64_MANTISSA_BITS: u64 = 52;
def F64_MANTISSA_MASK: u64 = (1 << F64_MANTISSA_BITS) - 1;
def F64_MAX_NORMAL: f64 = 1.7976931348623157e308;
def F64_MIN: f64 = 5.0e-324;
def F64_MIN_NORMAL: f64 = 2.2250738585072014e-308;
def INF: f32 = 1.0 / 0.0;
def LN2_HI: f64 = 0.6931471803691238;
def LN2_LO: f64 = 1.9082149292705877e-10;
def LN_10: f64 = 2.302585092994046;
def LN_2: f64 = 0.6931471805599453;
def LOG10_E: f64 = 1f64 / LN_10;
def LOG2_E: f64 = 1f64 / LN_2;
def NAN: f32 = 0.0 / 0.0;
def PHI: f64 = 1.618033988749895;
def PI: f64 = 3.141592653589793;
def SQRT_2: f64 = 1.4142135623730951;
def SQRT_E: f64 = 1.6487212707001282;
def SQRT_PHI: f64 = 1.272019649514069;
def SQRT_PI: f64 = 1.772453850905516;
def STANDARD_TOL: f64 = 1.0e-14;
def TAU: f64 = 6.283185307179586;

Globals

const f32info: floatinfo;
const f64info: floatinfo;

Functions

fn absf(n: types::floating) f64;
fn absf32(n: f32) f32;
fn absf64(n: f64) f64;
fn absi(n: types::signed) u64;
fn absi16(n: i16) u16;
fn absi32(n: i32) u32;
fn absi64(n: i64) u64;
fn absi8(n: i8) u8;
fn acosf64(x: f64) f64;
fn acoshf64(x: f64) f64;
fn addu(x: uint, y: uint, carry: uint) (uint, uint);
fn addu32(x: u32, y: u32, carry: u32) (u32, u32);
fn addu64(x: u64, y: u64, carry: u64) (u64, u64);
fn asinf64(x: f64) f64;
fn asinhf64(x: f64) f64;
fn atan2f64(y: f64, x: f64) f64;
fn atanf64(x: f64) f64;
fn atanhf64(x: f64) f64;
fn bit_size_u(x: uint) u8;
fn bit_size_u16(x: u16) u8;
fn bit_size_u32(x: u32) u8;
fn bit_size_u64(x: u64) u8;
fn bit_size_u8(x: u8) u8;
fn ceilf64(x: f64) f64;
fn clearexcept(ex: fexcept) void;
fn copysign(x: types::floating, y: types::floating) f64;
fn copysignf32(x: f32, y: f32) f32;
fn copysignf64(x: f64, y: f64) f64;
fn cosf64(x: f64) f64;
fn coshf64(x: f64) f64;
fn divu(hi: uint, lo: uint, y: uint) (uint, uint);
fn divu32(hi: u32, lo: u32, y: u32) (u32, u32);
fn divu64(hi: u64, lo: u64, y: u64) (u64, u64);
fn eqwithin(x: types::floating, y: types::floating, tol: types::floating) bool;
fn eqwithinf32(x: f32, y: f32, tol: f32) bool;
fn eqwithinf64(x: f64, y: f64, tol: f64) bool;
fn exp2f64(x: f64) f64;
fn expf64(x: f64) f64;
fn expmultif64(hi: f64, lo: f64, k: i64) f64;
fn f32bits(n: f32) u32;
fn f32frombits(n: u32) f32;
fn f64bits(n: f64) u64;
fn f64frombits(n: u64) f64;
fn floorf64(x: f64) f64;
fn frexp(n: types::floating) (f64, i64);
fn frexpf32(n: f32) (f32, i64);
fn frexpf64(n: f64) (f64, i64);
fn gcd(a: u64, b: u64) u64;
fn getround() fround;
fn hypotf64(a: f64, b: f64) f64;
fn isclose(x: types::floating, y: types::floating) bool;
fn isclosef32(x: f32, y: f32) bool;
fn isclosef64(x: f64, y: f64) bool;
fn isinf(n: f64) bool;
fn isnan(n: f64) bool;
fn isnegative(x: types::floating) bool;
fn isnegativef32(x: f32) bool;
fn isnegativef64(x: f64) bool;
fn isnormal(n: types::floating) bool;
fn isnormalf32(n: f32) bool;
fn isnormalf64(n: f64) bool;
fn ispositive(x: types::floating) bool;
fn ispositivef32(x: f32) bool;
fn ispositivef64(x: f64) bool;
fn issubnormal(n: types::floating) bool;
fn issubnormalf32(n: f32) bool;
fn issubnormalf64(n: f64) bool;
fn ldexpf32(mantissa: f32, exp: i64) f32;
fn ldexpf64(mantissa: f64, exp: i64) f64;
fn leading_zeros_u(x: uint) u8;
fn leading_zeros_u16(x: u16) u8;
fn leading_zeros_u32(x: u32) u8;
fn leading_zeros_u64(x: u64) u8;
fn leading_zeros_u8(x: u8) u8;
fn log10f64(x: f64) f64;
fn log1pf64(x: f64) f64;
fn log2f64(x: f64) f64;
fn logf64(x: f64) f64;
fn modf64(x: f64, y: f64) f64;
fn modfracf32(n: f32) (f32, f32);
fn modfracf64(n: f64) (f64, f64);
fn mulu(x: uint, y: uint) (uint, uint);
fn mulu32(x: u32, y: u32) (u32, u32);
fn mulu64(x: u64, y: u64) (u64, u64);
fn nextafterf32(x: f32, y: f32) f32;
fn nextafterf64(x: f64, y: f64) f64;
fn normalizef32(n: f32) (f32, i64);
fn normalizef64(n: f64) (f64, i64);
fn popcount(x: u64) u8;
fn powf64(x: f64, p: f64) f64;
fn raiseexcept(ex: fexcept) void;
fn remu(hi: uint, lo: uint, y: uint) uint;
fn remu32(hi: u32, lo: u32, y: u32) u32;
fn remu64(hi: u64, lo: u64, y: u64) u64;
fn roundf64(x: f64) f64;
fn setround(mode: fround) void;
fn signf(x: types::floating) i64;
fn signf32(x: f32) i64;
fn signf64(x: f64) i64;
fn signi(n: types::signed) i64;
fn signi16(n: i16) i16;
fn signi32(n: i32) i32;
fn signi64(n: i64) i64;
fn signi8(n: i8) i8;
fn sinf64(x: f64) f64;
fn sinhf64(x: f64) f64;
fn sqrtf64(x: f64) f64;
fn subu(x: uint, y: uint, carry: uint) (uint, uint);
fn subu32(x: u32, y: u32, borrow: u32) (u32, u32);
fn subu64(x: u64, y: u64, borrow: u64) (u64, u64);
fn tanf64(x: f64) f64;
fn tanhf64(x: f64) f64;
fn testexcept(ex: fexcept) fexcept;
fn trailing_zeros_u(x: uint) u8;
fn trailing_zeros_u16(x: u16) u8;
fn trailing_zeros_u32(x: u32) u8;
fn trailing_zeros_u64(x: u64) u8;
fn trailing_zeros_u8(x: u8) u8;
fn truncf64(x: f64) f64;

Types

type fexcept[link]

type fexcept = enum uint {
	NONE = 0, // No flags set
	// Occurs when there is no well-defined result of an operation, such as
	// with 0/0 or sqrt(-1)
	INVALID = 1 << 0,
	__DENORM = 1 << 1, // arch-specific
	DIVBYZERO = 1 << 2, // Occurs when an operation on finite numbers produces infinity
	// Occurs when the result of an operation is much bigger (by
	// absolute value) than the biggest representable finite number
	OVERFLOW = 1 << 3,
	// Occurs when the result of an operation is too small (by
	// absolute value) to be stored as a normalized number
	UNDERFLOW = 1 << 4,
	// Occurs when the result of an operation is rounded to a
	// value that differs from the infinite precision result.
	INEXACT = 1 << 5,
	ALL = INVALID | __DENORM | DIVBYZERO | OVERFLOW | UNDERFLOW | INEXACT, // Combination of all flags
};

Defines flags characterizing types of floating point exceptions, Each of the flags is only defined when the target platform supports handling the corresponding exception. Flags NONE and ALL are always defined and correspond to a bitwise OR of none and all defined flags respectively. Platforms may define additional nonstandard flags.

Examples:

math::raiseexcept(math::fexcept::UNDERFLOW); // raise UNDERFLOW
math::clearexcept(math::fexcept::ALL); // clear all exceptions

// e will be math::fexcept::INVALID
math::clearexcept(math::fexcept::ALL);
let a = 0.0/0.0;
let e = math::testexcept(math::fexcept::INVALID | math::fexcept::INEXACT);

type floatinfo[link]

type floatinfo = struct {
	// Bits in significand.
	mantbits: u64,
	// Bits in exponent.
	expbits: u64,
	// Bias of exponent.
	expbias: int,
	// Mask for mantissa.
	mantmask: u64,
	// Mask for exponent.
	expmask: u64,
};

Contains information about the structure of a specific floating point number type.

type fround[link]

type fround = enum uint {
	TONEAREST = 0, // Round towards nearest integer, with ties rounding to even
	DOWNWARD = 1024, // Round towards negative infinity
	UPWARD = 2048, // Round towards positive infinity
	TOWARDZERO = 3072, // Round towards zero
};

Defines values characterizing different floating point rounding behaviors. Each of the values is only definined when the target platform supports the corresponding rounding mode.

Constants

def E[link]

def E: f64 = 2.718281828459045;

e - https://oeis.org/A001113

def F32_EPS[link]

def F32_EPS: f32 = 1.1920928955078125e-7;

The difference between 1 and the smallest f32 representable value that is greater than 1.

def F32_EXPONENT_BIAS[link]

def F32_EXPONENT_BIAS: u16 = 127;

The bias of the exponent of the binary representation of f32. Subtract this from the exponent in the binary representation to get the actual exponent.

def F32_EXPONENT_BITS[link]

def F32_EXPONENT_BITS: u64 = 8;

The number of bits in the exponent of the binary representation of f32.

def F32_EXPONENT_MASK[link]

def F32_EXPONENT_MASK: u64 = (1 << F32_EXPONENT_BITS) - 1;

Mask with each bit of an f32's exponent set.

def F32_MANTISSA_BITS[link]

def F32_MANTISSA_BITS: u64 = 23;

The number of bits in the significand of the binary representation of f32.

def F32_MANTISSA_MASK[link]

def F32_MANTISSA_MASK: u64 = (1 << F32_MANTISSA_BITS) - 1;

Mask with each bit of an f32's mantissa set.

def F32_MAX_NORMAL[link]

def F32_MAX_NORMAL: f32 = 3.4028234e38;

The largest representable f32 value which is less than Infinity.

def F32_MIN[link]

def F32_MIN: f32 = 1.0e-45;

The smallest (subnormal) f32 value greater than zero.

def F32_MIN_NORMAL[link]

def F32_MIN_NORMAL: f32 = 1.1754944e-38;

The smallest representable normal f32 value.

def F64_EPS[link]

def F64_EPS: f64 = 2.2204e-16;

The difference between 1 and the smallest f64 representable value that is greater than 1.

def F64_EXPONENT_BIAS[link]

def F64_EXPONENT_BIAS: u16 = 1023;

The bias of the exponent of the binary representation of f64. Subtract this from the exponent in the binary representation to get the actual exponent.

def F64_EXPONENT_BITS[link]

def F64_EXPONENT_BITS: u64 = 11;

The number of bits in the exponent of the binary representation of f64.

def F64_EXPONENT_MASK[link]

def F64_EXPONENT_MASK: u64 = (1 << F64_EXPONENT_BITS) - 1;

Mask with each bit of an f64's exponent set.

def F64_MANTISSA_BITS[link]

def F64_MANTISSA_BITS: u64 = 52;

The number of bits in the significand of the binary representation of f64.

def F64_MANTISSA_MASK[link]

def F64_MANTISSA_MASK: u64 = (1 << F64_MANTISSA_BITS) - 1;

Mask with each bit of an f64's mantissa set.

def F64_MAX_NORMAL[link]

def F64_MAX_NORMAL: f64 = 1.7976931348623157e308;

The largest representable f64 value which is less than Infinity.

def F64_MIN[link]

def F64_MIN: f64 = 5.0e-324;

The smallest (subnormal) f64 value greater than zero.

def F64_MIN_NORMAL[link]

def F64_MIN_NORMAL: f64 = 2.2250738585072014e-308;

The smallest representable normal f64 value.

def INF[link]

def INF: f32 = 1.0 / 0.0;

The floating point value representing positive infinity. Use -INF for negative infinity.

def LN2_HI[link]

def LN2_HI: f64 = 0.6931471803691238;

ln(2) - https://oeis.org/A002162

def LN2_LO[link]

def LN2_LO: f64 = 1.9082149292705877e-10;

ln(2) - https://oeis.org/A002162

def LN_10[link]

def LN_10: f64 = 2.302585092994046;

ln(10) - https://oeis.org/A002392

def LN_2[link]

def LN_2: f64 = 0.6931471805599453;

ln(2) - https://oeis.org/A002162

def LOG10_E[link]

def LOG10_E: f64 = 1f64 / LN_10;

log_{10}(e)

def LOG2_E[link]

def LOG2_E: f64 = 1f64 / LN_2;

log_{2}(e)

def NAN[link]

def NAN: f32 = 0.0 / 0.0;

The floating point value representing Not a Number, i.e. an undefined or unrepresentable value. You cannot test if a number is NaN by comparing to this value; see isnan instead.

def PHI[link]

def PHI: f64 = 1.618033988749895;

phi - https://oeis.org/A001622

def PI[link]

def PI: f64 = 3.141592653589793;

pi - https://oeis.org/A000796

def SQRT_2[link]

def SQRT_2: f64 = 1.4142135623730951;

sqrt(2) - https://oeis.org/A002193

def SQRT_E[link]

def SQRT_E: f64 = 1.6487212707001282;

sqrt(e) - https://oeis.org/A019774

def SQRT_PHI[link]

def SQRT_PHI: f64 = 1.272019649514069;

sqrt(phi) - https://oeis.org/A139339

def SQRT_PI[link]

def SQRT_PI: f64 = 1.772453850905516;

sqrt(pi) - https://oeis.org/A002161

def STANDARD_TOL[link]

def STANDARD_TOL: f64 = 1.0e-14;

The standard tolerance used by isclose(), which is just an arbitrary way to measure whether two floating-point numbers are "sufficiently" close to each other.

def TAU[link]

def TAU: f64 = 6.283185307179586;

tau - https://oeis.org/A019692

Globals

let f32info[link]

const f32info: floatinfo;

A floatinfo structure defining the structure of the f32 type.

let f64info[link]

const f64info: floatinfo;

A floatinfo structure defining the structure of the f64 type.

Functions

fn absf[link]

fn absf(n: types::floating) f64;

Returns the absolute value of floating-point number n.

fn absf32[link]

fn absf32(n: f32) f32;

Returns the absolute value of f32 n.

fn absf64[link]

fn absf64(n: f64) f64;

Returns the absolute value of f64 n.

fn absi[link]

fn absi(n: types::signed) u64;

Returns the absolute value of signed integer n.

fn absi16[link]

fn absi16(n: i16) u16;

Returns the absolute value of signed integer n.

fn absi32[link]

fn absi32(n: i32) u32;

Returns the absolute value of signed integer n.

fn absi64[link]

fn absi64(n: i64) u64;

Returns the absolute value of signed integer n.

fn absi8[link]

fn absi8(n: i8) u8;

Returns the absolute value of signed integer n.

fn acosf64[link]

fn acosf64(x: f64) f64;

Returns the arccosine, in radians, of x.

fn acoshf64[link]

fn acoshf64(x: f64) f64;

Returns the inverse hyperbolic cosine of x.

fn addu[link]

fn addu(x: uint, y: uint, carry: uint) (uint, uint);

Calls either addu32() or addu64() depending on size(uint).

fn addu32[link]

fn addu32(x: u32, y: u32, carry: u32) (u32, u32);

Returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1, otherwise the behavior is undefined. The carry_out output is guaranteed to be 0 or 1.

fn addu64[link]

fn addu64(x: u64, y: u64, carry: u64) (u64, u64);

Returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1, otherwise the behavior is undefined. The carry_out output is guaranteed to be 0 or 1.

fn asinf64[link]

fn asinf64(x: f64) f64;

Returns the arcsine, in radians, of x.

fn asinhf64[link]

fn asinhf64(x: f64) f64;

Returns the inverse hyperbolic sine of x.

fn atan2f64[link]

fn atan2f64(y: f64, x: f64) f64;

Returns the arctangent, in radians, of y / x.

fn atanf64[link]

fn atanf64(x: f64) f64;

Returns the arctangent, in radians, of x.

fn atanhf64[link]

fn atanhf64(x: f64) f64;

Returns the inverse hyperbolic tangent of x.

fn bit_size_u[link]

fn bit_size_u(x: uint) u8;

Returns the minimum number of bits required to represent x.

fn bit_size_u16[link]

fn bit_size_u16(x: u16) u8;

Returns the minimum number of bits required to represent x.

fn bit_size_u32[link]

fn bit_size_u32(x: u32) u8;

Returns the minimum number of bits required to represent x.

fn bit_size_u64[link]

fn bit_size_u64(x: u64) u8;

Returns the minimum number of bits required to represent x.

fn bit_size_u8[link]

fn bit_size_u8(x: u8) u8;

Returns the minimum number of bits required to represent x.

fn ceilf64[link]

fn ceilf64(x: f64) f64;

Returns the least integer value greater than or equal to x.

fn clearexcept[link]

fn clearexcept(ex: fexcept) void;

Accepts a set of flags from fexcept ORed together and clears exceptions corresponding to the given flags.

fn copysign[link]

fn copysign(x: types::floating, y: types::floating) f64;

Returns x, but with the sign of y.

fn copysignf32[link]

fn copysignf32(x: f32, y: f32) f32;

Returns x, but with the sign of y.

fn copysignf64[link]

fn copysignf64(x: f64, y: f64) f64;

Returns x, but with the sign of y.

fn cosf64[link]

fn cosf64(x: f64) f64;

Returns the cosine of x, in radians.

fn coshf64[link]

fn coshf64(x: f64) f64;

Returns the hyperbolic cosine of x.

fn divu[link]

fn divu(hi: uint, lo: uint, y: uint) (uint, uint);

Calls either divu32() or divu64() depending on size(uint).

fn divu32[link]

fn divu32(hi: u32, lo: u32, y: u32) (u32, u32);

Returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo) / y, rem = (hi, lo) % y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. Panics for y == 0 (division by zero) or y <= hi (quotient overflow).

fn divu64[link]

fn divu64(hi: u64, lo: u64, y: u64) (u64, u64);

Returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo) / y, rem = (hi, lo) % y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. Panics for y == 0 (division by zero) or y <= hi (quotient overflow).

fn eqwithin[link]

fn eqwithin(x: types::floating, y: types::floating, tol: types::floating) bool;

Returns whether x and y are within tol of each other.

fn eqwithinf32[link]

fn eqwithinf32(x: f32, y: f32, tol: f32) bool;

Returns whether x and y are within tol of each other.

fn eqwithinf64[link]

fn eqwithinf64(x: f64, y: f64, tol: f64) bool;

Returns whether x and y are within tol of each other.

fn exp2f64[link]

fn exp2f64(x: f64) f64;

Returns 2^x.

fn expf64[link]

fn expf64(x: f64) f64;

Returns e^x.

fn expmultif64[link]

fn expmultif64(hi: f64, lo: f64, k: i64) f64;

Returns e^r * 2^k where r = hi - lo and |r| <= (ln(2) / 2).

fn f32bits[link]

fn f32bits(n: f32) u32;

Returns the binary representation of the given f32.

fn f32frombits[link]

fn f32frombits(n: u32) f32;

Returns f32 with the given binary representation.

fn f64bits[link]

fn f64bits(n: f64) u64;

Returns the binary representation of the given f64.

fn f64frombits[link]

fn f64frombits(n: u64) f64;

Returns f64 with the given binary representation.

fn floorf64[link]

fn floorf64(x: f64) f64;

Returns the greatest integer value less than or equal to x.

fn frexp[link]

fn frexp(n: types::floating) (f64, i64);

Breaks a float down into its mantissa and exponent. The mantissa will be between 0.5 and 1.

fn frexpf32[link]

fn frexpf32(n: f32) (f32, i64);

Breaks a f32 down into its mantissa and exponent. The mantissa will be between 0.5 and 1.

fn frexpf64[link]

fn frexpf64(n: f64) (f64, i64);

Breaks a f64 down into its mantissa and exponent. The mantissa will be between 0.5 and 1.

fn gcd[link]

fn gcd(a: u64, b: u64) u64;

Returns the greatest common divisor of a and b.

fn getround[link]

fn getround() fround;

Returns the value corresponding to the current rounding mode

fn hypotf64[link]

fn hypotf64(a: f64, b: f64) f64;

Returns the square root of a*a + b*b, taking care to avoid unnecessary overflow and underflow.

fn isclose[link]

fn isclose(x: types::floating, y: types::floating) bool;

Returns whether x and y are within STANDARD_TOL of each other.

fn isclosef32[link]

fn isclosef32(x: f32, y: f32) bool;

Returns whether x and y are within STANDARD_TOL of each other.

fn isclosef64[link]

fn isclosef64(x: f64, y: f64) bool;

Returns whether x and y are within STANDARD_TOL of each other.

fn isinf[link]

fn isinf(n: f64) bool;

Returns true if the given floating-point number is infinite.

fn isnan[link]

fn isnan(n: f64) bool;

Returns true if the given floating-point number is NaN.

fn isnegative[link]

fn isnegative(x: types::floating) bool;

Returns whether or not x is negative.

fn isnegativef32[link]

fn isnegativef32(x: f32) bool;

Returns whether or not x is negative.

fn isnegativef64[link]

fn isnegativef64(x: f64) bool;

Returns whether or not x is negative.

fn isnormal[link]

fn isnormal(n: types::floating) bool;

Returns true if the given floating-point number is normal.

fn isnormalf32[link]

fn isnormalf32(n: f32) bool;

Returns true if the given f32 is normal.

fn isnormalf64[link]

fn isnormalf64(n: f64) bool;

Returns true if the given f64 is normal.

fn ispositive[link]

fn ispositive(x: types::floating) bool;

Returns whether or not x is positive.

fn ispositivef32[link]

fn ispositivef32(x: f32) bool;

Returns whether or not x is positive.

fn ispositivef64[link]

fn ispositivef64(x: f64) bool;

Returns whether or not x is positive.

fn issubnormal[link]

fn issubnormal(n: types::floating) bool;

Returns true if the given floating-point number is subnormal.

fn issubnormalf32[link]

fn issubnormalf32(n: f32) bool;

Returns true if the given f32 is subnormal.

fn issubnormalf64[link]

fn issubnormalf64(n: f64) bool;

Returns true if the given f64 is subnormal.

fn ldexpf32[link]

fn ldexpf32(mantissa: f32, exp: i64) f32;

Creates an f32 from a mantissa and an exponent.

fn ldexpf64[link]

fn ldexpf64(mantissa: f64, exp: i64) f64;

Creates an f64 from a mantissa and an exponent.

fn leading_zeros_u[link]

fn leading_zeros_u(x: uint) u8;

Returns the number of leading zero bits in x The result is UINT_SIZE for x == 0.

fn leading_zeros_u16[link]

fn leading_zeros_u16(x: u16) u8;

Returns the number of leading zero bits in x The result is 16 for x == 0.

fn leading_zeros_u32[link]

fn leading_zeros_u32(x: u32) u8;

Returns the number of leading zero bits in x The result is 32 for x == 0.

fn leading_zeros_u64[link]

fn leading_zeros_u64(x: u64) u8;

Returns the number of leading zero bits in x The result is 64 for x == 0.

fn leading_zeros_u8[link]

fn leading_zeros_u8(x: u8) u8;

Returns the number of leading zero bits in x The result is 8 for x == 0.

fn log10f64[link]

fn log10f64(x: f64) f64;

Returns the decimal logarithm of x.

fn log1pf64[link]

fn log1pf64(x: f64) f64;

Returns the natural logarithm of 1 plus its argument x. It is more accurate than log(1 + x) when x is near zero.

fn log2f64[link]

fn log2f64(x: f64) f64;

Returns the binary logarithm of x.

fn logf64[link]

fn logf64(x: f64) f64;

Returns the natural logarithm of x.

fn modf64[link]

fn modf64(x: f64, y: f64) f64;

Returns the floating-point remainder of x / y. The magnitude of the result is less than y and its sign agrees with that of x.

fn modfracf32[link]

fn modfracf32(n: f32) (f32, f32);

Returns the integer and fractional parts of an f32.

fn modfracf64[link]

fn modfracf64(n: f64) (f64, f64);

Returns the integer and fractional parts of an f64.

fn mulu[link]

fn mulu(x: uint, y: uint) (uint, uint);

Calls either mulu32() or mulu64() depending on size(uint).

fn mulu32[link]

fn mulu32(x: u32, y: u32) (u32, u32);

Returns the 64-bit product of x and y: (hi, lo) = x * y with the product bits' upper half returned in hi and the lower half returned in lo.

fn mulu64[link]

fn mulu64(x: u64, y: u64) (u64, u64);

Returns the 128-bit product of x and y: (hi, lo) = x * y with the product bits' upper half returned in hi and the lower half returned in lo.

fn nextafterf32[link]

fn nextafterf32(x: f32, y: f32) f32;

Returns the f32 that is closest to 'x' in direction of 'y'. Returns NaN if either parameter is NaN. Returns 'x' if both parameters are same.

fn nextafterf64[link]

fn nextafterf64(x: f64, y: f64) f64;

Returns the f64 that is closest to 'x' in direction of 'y' Returns NaN if either parameter is NaN. Returns 'x' if both parameters are same.

fn normalizef32[link]

fn normalizef32(n: f32) (f32, i64);

Takes a potentially subnormal f32 n and returns a normal f32 normal_float and an exponent exp such that n == normal_float * 2^{exp}.

fn normalizef64[link]

fn normalizef64(n: f64) (f64, i64);

Takes a potentially subnormal f64 n and returns a normal f64 normal_float and an exponent exp such that n == normal_float * 2^{exp}.

fn popcount[link]

fn popcount(x: u64) u8;

Returns the number of bits set (the population count) of x.

fn powf64[link]

fn powf64(x: f64, p: f64) f64;

Returns x^p.

fn raiseexcept[link]

fn raiseexcept(ex: fexcept) void;

Accepts a set of flags from fexcept ORed together and raises exceptions corresponding to the given flags.

fn remu[link]

fn remu(hi: uint, lo: uint, y: uint) uint;

Calls either remu32() or remu64() depending on size(uint).

fn remu32[link]

fn remu32(hi: u32, lo: u32, y: u32) u32;

Returns the remainder of (hi, lo) divided by y. Panics for y == 0 (division by zero) but, unlike divu(), it doesn't panic on a quotient overflow.

fn remu64[link]

fn remu64(hi: u64, lo: u64, y: u64) u64;

Returns the remainder of (hi, lo) divided by y. Panics for y == 0 (division by zero) but, unlike divu(), it doesn't panic on a quotient overflow.

fn roundf64[link]

fn roundf64(x: f64) f64;

Returns the nearest integer, rounding half away from zero.

fn setround[link]

fn setround(mode: fround) void;

Sets the rounding mode to the specified value

fn signf[link]

fn signf(x: types::floating) i64;

Returns 1 if x is positive and -1 if x is negative. Note that zero is also signed.

fn signf32[link]

fn signf32(x: f32) i64;

Returns 1 if x is positive and -1 if x is negative. Note that zero is also signed.

fn signf64[link]

fn signf64(x: f64) i64;

Returns 1 if x is positive and -1 if x is negative. Note that zero is also signed.

fn signi[link]

fn signi(n: types::signed) i64;

Return 1 if n is positive, -1 if it's negative and 0 if it's 0.

fn signi16[link]

fn signi16(n: i16) i16;

Return 1 if n is positive, -1 if it's negative and 0 if it's 0.

fn signi32[link]

fn signi32(n: i32) i32;

Return 1 if n is positive, -1 if it's negative and 0 if it's 0.

fn signi64[link]

fn signi64(n: i64) i64;

Return 1 if n is positive, -1 if it's negative and 0 if it's 0.

fn signi8[link]

fn signi8(n: i8) i8;

Return 1 if n is positive, -1 if it's negative and 0 if it's 0.

fn sinf64[link]

fn sinf64(x: f64) f64;

Returns the sine of x, in radians.

fn sinhf64[link]

fn sinhf64(x: f64) f64;

Returns the hyperbolic sine of x.

fn sqrtf64[link]

fn sqrtf64(x: f64) f64;

Returns the square root of x.

fn subu[link]

fn subu(x: uint, y: uint, carry: uint) (uint, uint);

Calls either mulu32() or mulu64() depending on size(uint).

fn subu32[link]

fn subu32(x: u32, y: u32, borrow: u32) (u32, u32);

Returns the difference of x, y and borrow, diff = x - y - borrow. The borrow input must be 0 or 1, otherwise the behavior is undefined. The borrow_out output is guaranteed to be 0 or 1.

fn subu64[link]

fn subu64(x: u64, y: u64, borrow: u64) (u64, u64);

Returns the difference of x, y and borrow, diff = x - y - borrow. The borrow input must be 0 or 1, otherwise the behavior is undefined. The borrow_out output is guaranteed to be 0 or 1.

fn tanf64[link]

fn tanf64(x: f64) f64;

Returns the tangent of x, in radians.

fn tanhf64[link]

fn tanhf64(x: f64) f64;

Returns the hyperbolic tangent of x.

fn testexcept[link]

fn testexcept(ex: fexcept) fexcept;

Accepts a set of flags from fexcept ORed together and returns the subset that is currently raised

fn trailing_zeros_u[link]

fn trailing_zeros_u(x: uint) u8;

Returns the number of trailing zero bits in x The result is UINT_SIZE for x == 0.

fn trailing_zeros_u16[link]

fn trailing_zeros_u16(x: u16) u8;

Returns the number of trailing zero bits in x The result is 16 for x == 0.

fn trailing_zeros_u32[link]

fn trailing_zeros_u32(x: u32) u8;

Returns the number of trailing zero bits in x The result is 32 for x == 0.

fn trailing_zeros_u64[link]

fn trailing_zeros_u64(x: u64) u8;

Returns the number of trailing zero bits in x The result is 64 for x == 0.

fn trailing_zeros_u8[link]

fn trailing_zeros_u8(x: u8) u8;

Returns the number of trailing zero bits in x The result is 8 for x == 0.

fn truncf64[link]

fn truncf64(x: f64) f64;

Returns the integer value of x.