class · System

Math

public class System.Math : System.Any
Kind
class
Namespace
System
Assembly
System.Core
Access
public, static, abstract
Source file
Math.ant

Inheritance

Base classes
Any Math

Properties

static property PI: f64
#

static read-only

static property E: f64
#

static read-only

static property Tau: f64
#

static read-only

Methods

static method Sqrt<T>(x: T) -> T
#

static

The square root; of an integer, the largest integer whose square is at most x (ISqrt).

static method Sin<T>(x: T) -> T
#

static

static method Cos<T>(x: T) -> T
#

static

static method Tan<T>(x: T) -> T
#

static

static method Asin<T>(x: T) -> T
#

static

static method Acos<T>(x: T) -> T
#

static

static method Atan<T>(x: T) -> T
#

static

static method Atan2<T>(y: T, x: T) -> T
#

static

static method Exp<T>(x: T) -> T
#

static

static method Log<T>(x: T) -> T
#

static

The natural logarithm.

static method Log<T>(x: T, newBase: T) -> T
#

static

The logarithm in newBase; of integers, the largest power of newBase not above x (exact: 1000 in base 10 is 3, where a floating-point quotient would give 2.9999...); of an integer below 1, or in an integer base below 2, an ArgumentError (no integer says -infinity or nan).

static method Log10<T>(x: T) -> T
#

static

The logarithm in base 10 (of an integer, exact, as Log(x, 10); of an integer below 1, an ArgumentError).

static method Log2<T>(x: T) -> T
#

static

The logarithm in base 2 (of an integer, exact, as Log(x, 2); of an integer below 1, an ArgumentError).

static method Pow<T>(x: T, y: T) -> T
#

static

x to the power y; of integers with y >= 0, exact in the type (squaring, as many multiplications as y has bits), where f64 would round past 2^53.

static method Floor<T>(x: T) -> T
#

static

The largest integer not above x (an integer is its own).

static method Ceiling<T>(x: T) -> T
#

static

The smallest integer not below x (an integer is its own).

static method Truncate<T>(x: T) -> T
#

static

The integer part, toward zero (an integer is its own).

static method Round<T>(x: T) -> T
#

static

The nearest integer; halves go to the even one (an integer is its own).

static method Round<T>(x: T, digits: i32) -> T
#

static

Rounded to digits decimal places (an integer is its own).

static method Abs<T>(x: T) -> T
#

static

x without its sign.

static method Min<T>(a: T, b: T) -> T
#

static

The smaller of two numbers.

static method Max<T>(a: T, b: T) -> T
#

static

The larger of two numbers.

static method Clamp<T>(value: T, low: T, high: T) -> T
#

static

value within low … high.

static method Sign<T>(x: T) -> i32
#

static

-1, 0 or 1: the sign of x.

static method ISqrt<T>(x: T) -> T
#

static

The largest integer whose square is at most x (x >= 0). Up to 64 bits, the f64 root corrected by division (not by squaring, which would overflow near the type's largest value). Wider, the f64 root is only close to 53 bits: from just above it Newton's method in the type comes down to the root in a few steps.

static method Gcd<T>(a: T, b: T) -> T
#

static

The greatest common divisor (of the numbers without their sign).

Private and internal members (39)

static method SqrtOf(x: f64) -> f64
#

private static

static method SinOf(x: f64) -> f64
#

private static

static method CosOf(x: f64) -> f64
#

private static

static method TanOf(x: f64) -> f64
#

private static

static method AsinOf(x: f64) -> f64
#

private static

static method AcosOf(x: f64) -> f64
#

private static

static method AtanOf(x: f64) -> f64
#

private static

static method Atan2Of(y: f64, x: f64) -> f64
#

private static

static method ExpOf(x: f64) -> f64
#

private static

static method LogOf(x: f64) -> f64
#

private static

static method Log10Of(x: f64) -> f64
#

private static

static method PowOf(x: f64, y: f64) -> f64
#

private static

static method FloorOf(x: f64) -> f64
#

private static

static method CeilingOf(x: f64) -> f64
#

private static

static method RoundOf(x: f64) -> f64
#

private static

The nearest integer; halves go to the even one.

static method Divisions<T>(x: T, by: T) -> T
#

private static

How many times x divides by by before it is below it (x >= 1, by >= 2): the integer logarithm.

static method Finite(v: f64) -> bool
#

private static

Whether an f64 is neither NaN nor infinite.

static method Scaled<T>(x: T, n: i32) -> T
#

private static

x times 2^n, exactly (n beyond f64's exponents too).

static method PowInteger<T>(x: T, n: i64) -> T
#

private static

x to an integer power, by squaring (a negative one is the reciprocal's).

static method FloorWide<T>(x: T) -> T
#

private static

The largest integer not above x: the f64-sized parts taken off one at a time (each is exact), the last below 2^52 floored and corrected by one if its f64 rounded across an integer.

static method CeilingWide<T>(x: T) -> T
#

private static

static method RoundWide<T>(x: T) -> T
#

private static

static method SqrtWide<T>(x: T) -> T
#

private static

Newton's method from the f64 root (doubling the exact bits each step), in f64's range by an even power of two.

static method Bits113<T>(unit: T) -> bool
#

private static

Whether T has f128's 113 bits (one plus 2^-112 is above one, one plus 2^-113 rounds back to it); a constant for T.

static method Bits237<T>(unit: T) -> bool
#

private static

Whether T has f256's 237 bits (one plus 2^-236 is above one, one plus 2^-237 is not); a constant for T.

static method Ln2<T>(unit: T) -> T
#

private static

ln 2.

static method PiOf<T>(unit: T) -> T
#

private static

π.

static method Ln10<T>(unit: T) -> T
#

private static

ln 10.

static method Ln2Series<T>(unit: T) -> T
#

private static

ln 2 = 2 atanh(1/3), its series summed until a term no longer changes the sum.

static method AtanInverse<T>(unit: T, k: i32) -> T
#

private static

atan(1/k), its series.

static method PiSeries<T>(unit: T) -> T
#

private static

π by Machin's formula: 16 atan(1/5) − 4 atan(1/239).

static method ExpWide<T>(x: T) -> T
#

private static

e^x: x − k ln 2 (|r| ≤ ½ ln 2), its series, times 2^k.

static method LogWide<T>(x: T) -> T
#

private static

ln x: x = m·2^e (m in f64's range), Halley's method on e^y = m from the f64 logarithm, plus e ln 2.

static method SinSeries<T>(r: T) -> T
#

private static

static method CosSeries<T>(r: T) -> T
#

private static

static method SinCosWide<T>(x: T, shift: i64) -> T
#

private static

sin x (cosine: shift 1): x − q π/2 (|r| ≤ π/4), the series of sin or cos of r by the quadrant.

static method AtanWide<T>(x: T) -> T
#

private static

atan x: Newton's method on tan y = x from the f64 arctangent.

static method Atan2Wide<T>(y: T, x: T) -> T
#

private static

static method PowWide<T>(x: T, y: T) -> T
#

private static

Inherited members (5)

Source

Math as Larva HIR, decompiled from its Larva HIR.

System.Math.hir
public class System.Math : System.Any
{
    static method SqrtOf(x: f64) -> f64
    static method SinOf(x: f64) -> f64
    static method CosOf(x: f64) -> f64
    static method TanOf(x: f64) -> f64
    static method AsinOf(x: f64) -> f64
    static method AcosOf(x: f64) -> f64
    static method AtanOf(x: f64) -> f64
    static method Atan2Of(y: f64, x: f64) -> f64
    static method ExpOf(x: f64) -> f64
    static method LogOf(x: f64) -> f64
    static method Log10Of(x: f64) -> f64
    static method PowOf(x: f64, y: f64) -> f64
    static method FloorOf(x: f64) -> f64
    static method CeilingOf(x: f64) -> f64
    // The nearest integer; halves go to the even one.
    static method RoundOf(x: f64) -> f64
    // How many times `x` divides by `by` before it is below it (x >= 1, by >= 2): the integer logarithm.
    static method Divisions<T>(x: T, by: T) -> T
    // Whether an f64 is neither NaN nor infinite.
    static method Finite(v: f64) -> bool
    // `x` times 2^n, exactly (n beyond f64's exponents too).
    static method Scaled<T>(x: T, n: i32) -> T
    // `x` to an integer power, by squaring (a negative one is the reciprocal's).
    static method PowInteger<T>(x: T, n: i64) -> T
    // The largest integer not above `x`: the f64-sized parts taken off one at a time (each is exact), the last below
    // 2^52 floored and corrected by one if its f64 rounded across an integer.
    static method FloorWide<T>(x: T) -> T
    static method CeilingWide<T>(x: T) -> T
    static method RoundWide<T>(x: T) -> T
    // Newton's method from the f64 root (doubling the exact bits each step), in f64's range by an even power of two.
    static method SqrtWide<T>(x: T) -> T
    // Whether T has f128's 113 bits (one plus 2^-112 is above one, one plus 2^-113 rounds back to it); a constant for T.
    static method Bits113<T>(unit: T) -> bool
    // Whether T has f256's 237 bits (one plus 2^-236 is above one, one plus 2^-237 is not); a constant for T.
    static method Bits237<T>(unit: T) -> bool
    // ln 2.
    static method Ln2<T>(unit: T) -> T
    // π.
    static method PiOf<T>(unit: T) -> T
    // ln 10.
    static method Ln10<T>(unit: T) -> T
    // ln 2 = 2 atanh(1/3), its series summed until a term no longer changes the sum.
    static method Ln2Series<T>(unit: T) -> T
    // atan(1/k), its series.
    static method AtanInverse<T>(unit: T, k: i32) -> T
    // π by Machin's formula: 16 atan(1/5) − 4 atan(1/239).
    static method PiSeries<T>(unit: T) -> T
    // e^x: x − k ln 2 (|r| ≤ ½ ln 2), its series, times 2^k.
    static method ExpWide<T>(x: T) -> T
    // ln x: x = m·2^e (m in f64's range), Halley's method on e^y = m from the f64 logarithm, plus e ln 2.
    static method LogWide<T>(x: T) -> T
    static method SinSeries<T>(r: T) -> T
    static method CosSeries<T>(r: T) -> T
    // sin x (cosine: shift 1): x − q π/2 (|r| ≤ π/4), the series of sin or cos of r by the quadrant.
    static method SinCosWide<T>(x: T, shift: i64) -> T
    // atan x: Newton's method on tan y = x from the f64 arctangent.
    static method AtanWide<T>(x: T) -> T
    static method Atan2Wide<T>(y: T, x: T) -> T
    static method PowWide<T>(x: T, y: T) -> T
    // The square root; of an integer, the largest integer whose square is at most `x` (ISqrt).
    static method Sqrt<T>(x: T) -> T
    static method Sin<T>(x: T) -> T
    static method Cos<T>(x: T) -> T
    static method Tan<T>(x: T) -> T
    static method Asin<T>(x: T) -> T
    static method Acos<T>(x: T) -> T
    static method Atan<T>(x: T) -> T
    static method Atan2<T>(y: T, x: T) -> T
    static method Exp<T>(x: T) -> T
    // The natural logarithm.
    static method Log<T>(x: T) -> T
    // The logarithm in `newBase`; of integers, the largest power of `newBase` not above `x` (exact: 1000 in base
    // 10 is 3, where a floating-point quotient would give 2.9999...); of an integer below 1, or in an integer
    // base below 2, an ArgumentError (no integer says -infinity or nan).
    static method Log<T>(x: T, newBase: T) -> T
    // The logarithm in base 10 (of an integer, exact, as `Log(x, 10)`; of an integer below 1, an ArgumentError).
    static method Log10<T>(x: T) -> T
    // The logarithm in base 2 (of an integer, exact, as `Log(x, 2)`; of an integer below 1, an ArgumentError).
    static method Log2<T>(x: T) -> T
    // `x` to the power `y`; of integers with `y >= 0`, exact in the type (squaring, as many multiplications as
    // `y` has bits), where f64 would round past 2^53.
    static method Pow<T>(x: T, y: T) -> T
    // The largest integer not above `x` (an integer is its own).
    static method Floor<T>(x: T) -> T
    // The smallest integer not below `x` (an integer is its own).
    static method Ceiling<T>(x: T) -> T
    // The integer part, toward zero (an integer is its own).
    static method Truncate<T>(x: T) -> T
    // The nearest integer; halves go to the even one (an integer is its own).
    static method Round<T>(x: T) -> T
    // Rounded to `digits` decimal places (an integer is its own).
    static method Round<T>(x: T, digits: i32) -> T
    // `x` without its sign.
    static method Abs<T>(x: T) -> T
    // The smaller of two numbers.
    static method Min<T>(a: T, b: T) -> T
    // The larger of two numbers.
    static method Max<T>(a: T, b: T) -> T
    // `value` within `low` … `high`.
    static method Clamp<T>(value: T, low: T, high: T) -> T
    // -1, 0 or 1: the sign of `x`.
    static method Sign<T>(x: T) -> i32
    // The largest integer whose square is at most `x` (x >= 0). Up to 64 bits, the f64 root corrected by division
    // (not by squaring, which would overflow near the type's largest value). Wider, the f64 root is only close to
    // 53 bits: from just above it Newton's method in the type comes down to the root in a few steps.
    static method ISqrt<T>(x: T) -> T
    // The greatest common divisor (of the numbers without their sign).
    static method Gcd<T>(a: T, b: T) -> T
    static property PI: f64
    static property E: f64
    static property Tau: f64
}
Esc