class · System
NumberFormat
public class System.NumberFormat : System.Any
Numbers formatted as text (what the primitives' ToString(format) call).
- Kind
- class
- Namespace
- System
- Assembly
- System.Core
- Access
- public, static, abstract
- Source file
Format.ant
Inheritance
- Base classes
-
AnyNumberFormat
Methods
static method FormatInteger(bits: u64, width: i32, signed: bool, format: System.String<u8>) -> System.String<u8>
#
An integer (its bits, width of them, and whether its type is signed) by format.
static method FormatInteger(value: i64, format: System.String<u8>) -> System.String<u8>
#
static method ShortestDouble(value: f64) -> System.String<u8>
#
A finite f64 as print writes it: the shortest digits that read back as the same number, in exponent
form (1e+20, 1.5e-07) when the exponent is below -4 or at least 15.
static method FormatDouble(value: f64, format: System.String<u8>) -> System.String<u8>
#
An f64 by format (G or R: the shortest text that reads back as the same number; nan, inf, -inf).
static method FormatSingle(value: f32, format: System.String<u8>) -> System.String<u8>
#
An f32 by format (no format, G or R: the shortest text that reads back as the same f32).
static method FormatHalf(value: f16, format: System.String<u8>) -> System.String<u8>
#
An f16 by format (no format, G or R: the shortest text that reads back as the same f16).
static method FormatWide(bits: u256, width: i32, format: System.String<u8>) -> System.String<u8>
#
An f128 or f256 (its IEEE bits; width 128 or 256) by format: no format, G or R give the shortest text
that reads back as the same number; the fixed formats show up to 33 (f128) or 71 (f256) digits.
Private and internal members (25)
static method ExactDigits(x: f64) -> System.DecimalDigits
#
The exact digits of a finite f64 (every f64 is a finite decimal).
static method ExactOf(mantissa: u64, e2: i32, negative: bool) -> System.DecimalDigits
#
The exact digits of mantissa × 2^e2.
limbs = value (base 10^9); the count.
static method DigitsOf(limbs: u32[], used: i32, shift: i32, negative: bool, limit: i32) -> System.DecimalDigits
#
The decimal digits of a base-10^9 integer, over 10^shift: the first limit of them, then (when the rest is not
all zeros) a 1 standing for the rest, which keeps comparisons and rounding to fewer digits exact.
static method ExactWide(mantissa: u256, e2: i32, negative: bool) -> System.DecimalDigits
#
The exact digits of a wide mantissa × 2^e2 (an f128 or f256).
limbs = value (base 10^9); the count.
a × factor (a wide integer: up to nine limbs), base 10^9, into result; the count.
static method ShortestWide(mantissa: u256, e2: i32, boundary: bool, most: i32) -> System.DecimalDigits
#
The shortest digits that read back as the same wide float (see ShortestOf).
a × factor (factor < 10^18: two limbs), base 10^9, into result; the count.
static method AddOrSubtract(a: u32[], aUsed: i32, b: u32[], bUsed: i32, add: bool, result: u32[]) -> i32
#
a + b or a - b (a ≥ b), base 10^9, into result; the count.
limbs × factor (factor < 2^34), in place; the new count.
static method IntegerDigits(magnitude: u64, negative: bool) -> System.DecimalDigits
#
The digits of an integer's magnitude.
static method Letter(format: System.String<u8>) -> u8
#
A format's letter (0 for none: general) and precision (-1 for none).
static method Precision(format: System.String<u8>) -> i32
#
static method Fixed(text: System.NumberText, d: System.DecimalDigits, decimals: i32, groups: bool) -> void
#
Fixed point: the integer digits (grouped by three with commas when groups), then decimals decimals.
static method Scientific(text: System.NumberText, d: System.DecimalDigits, decimals: i32, letter: u8, exponentDigits: i32) -> void
#
Exponent form: one digit, decimals more after the point, then E (or e), the sign and exponentDigits or more.
static method General(text: System.NumberText, d: System.DecimalDigits, precision: i32, scientificFrom: i32, letter: u8) -> void
#
General: precision significant digits (all of them when 0 or less), in exponent form when the exponent is
below -4 or at least scientificFrom; trailing zeros dropped.
static method Digits(text: System.NumberText, d: System.DecimalDigits, letter: u8, precision: i32, generalPrecision: i32, scientificFrom: i32) -> bool
#
The digits by a format letter (not D, X, B: those are integers' own).
static method Shortest(value: f64) -> System.DecimalDigits
#
The shortest digits that read back as the same f64 (the nearest of that length): those strictly between the midpoints to its neighbours (or on them, when its mantissa is even and reading rounds to it).
static method ShortestSingle(value: f32) -> System.DecimalDigits
#
static method RoundInto(d: System.DecimalDigits, keep: i32, target: System.DecimalDigits) -> void
#
d rounded to keep digits, into target (its array has room): only the digits that decide it are copied
(what follows the next one, never all zeros, stands as a 1).
static method Compare(a: System.DecimalDigits, b: System.DecimalDigits) -> i32
#
Which of two positive numbers is larger (-1, 0, 1).
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
NumberFormat as Larva HIR, decompiled from its Larva HIR.
// Numbers formatted as text (what the primitives' `ToString(format)` call).
public class System.NumberFormat : System.Any
{
// The exact digits of a finite f64 (every f64 is a finite decimal).
static method ExactDigits(x: f64) -> System.DecimalDigits
// The exact digits of mantissa × 2^e2.
static method ExactOf(mantissa: u64, e2: i32, negative: bool) -> System.DecimalDigits
// limbs = value (base 10^9); the count.
static method Set(limbs: u32[], value: u64) -> i32
static method TimesPowerOfTwo(limbs: u32[], used: i32, power: i32) -> i32
static method TimesPowerOfFive(limbs: u32[], used: i32, power: i32) -> i32
// The decimal digits of a base-10^9 integer, over 10^shift: the first `limit` of them, then (when the rest is not
// all zeros) a 1 standing for the rest, which keeps comparisons and rounding to fewer digits exact.
static method DigitsOf(limbs: u32[], used: i32, shift: i32, negative: bool, limit: i32) -> System.DecimalDigits
// The exact digits of a wide mantissa × 2^e2 (an f128 or f256).
static method ExactWide(mantissa: u256, e2: i32, negative: bool) -> System.DecimalDigits
// limbs = value (base 10^9); the count.
static method SetWide(limbs: u32[], value: u256) -> i32
// a × factor (a wide integer: up to nine limbs), base 10^9, into `result`; the count.
static method TimesWide(a: u32[], used: i32, factor: u256, result: u32[]) -> i32
// The shortest digits that read back as the same wide float (see ShortestOf).
static method ShortestWide(mantissa: u256, e2: i32, boundary: bool, most: i32) -> System.DecimalDigits
// a × factor (factor < 10^18: two limbs), base 10^9, into `result`; the count.
static method TimesLarge(a: u32[], used: i32, factor: u64, result: u32[]) -> i32
// a + b or a - b (a ≥ b), base 10^9, into `result`; the count.
static method AddOrSubtract(a: u32[], aUsed: i32, b: u32[], bUsed: i32, add: bool, result: u32[]) -> i32
// limbs × factor (factor < 2^34), in place; the new count.
static method Multiply(limbs: u32[], used: i32, factor: u64) -> i32
// The digits of an integer's magnitude.
static method IntegerDigits(magnitude: u64, negative: bool) -> System.DecimalDigits
// A format's letter (0 for none: general) and precision (-1 for none).
static method Letter(format: System.String<u8>) -> u8
static method Precision(format: System.String<u8>) -> i32
// Fixed point: the integer digits (grouped by three with commas when `groups`), then `decimals` decimals.
static method Fixed(text: System.NumberText, d: System.DecimalDigits, decimals: i32, groups: bool) -> void
// Exponent form: one digit, `decimals` more after the point, then E (or e), the sign and `exponentDigits` or more.
static method Scientific(text: System.NumberText, d: System.DecimalDigits, decimals: i32, letter: u8, exponentDigits: i32) -> void
// General: `precision` significant digits (all of them when 0 or less), in exponent form when the exponent is
// below -4 or at least `scientificFrom`; trailing zeros dropped.
static method General(text: System.NumberText, d: System.DecimalDigits, precision: i32, scientificFrom: i32, letter: u8) -> void
// The digits by a format letter (not D, X, B: those are integers' own).
static method Digits(text: System.NumberText, d: System.DecimalDigits, letter: u8, precision: i32, generalPrecision: i32, scientificFrom: i32) -> bool
// An integer (its bits, `width` of them, and whether its type is signed) by `format`.
static method FormatInteger(bits: u64, width: i32, signed: bool, format: System.String<u8>) -> System.String<u8>
static method FormatInteger(value: i64, format: System.String<u8>) -> System.String<u8>
// A finite f64 as `print` writes it: the shortest digits that read back as the same number, in exponent
// form (`1e+20`, `1.5e-07`) when the exponent is below -4 or at least 15.
static method ShortestDouble(value: f64) -> System.String<u8>
// An f64 by `format` (G or R: the shortest text that reads back as the same number; `nan`, `inf`, `-inf`).
static method FormatDouble(value: f64, format: System.String<u8>) -> System.String<u8>
// An f32 by `format` (no format, G or R: the shortest text that reads back as the same f32).
static method FormatSingle(value: f32, format: System.String<u8>) -> System.String<u8>
// An f16 by `format` (no format, G or R: the shortest text that reads back as the same f16).
static method FormatHalf(value: f16, format: System.String<u8>) -> System.String<u8>
// An f128 or f256 (its IEEE bits; `width` 128 or 256) by `format`: no format, G or R give the shortest text
// that reads back as the same number; the fixed formats show up to 33 (f128) or 71 (f256) digits.
static method FormatWide(bits: u256, width: i32, format: System.String<u8>) -> System.String<u8>
// The shortest digits that read back as the same f64 (the nearest of that length): those strictly between
// the midpoints to its neighbours (or on them, when its mantissa is even and reading rounds to it).
static method Shortest(value: f64) -> System.DecimalDigits
static method ShortestSingle(value: f32) -> System.DecimalDigits
static method ShortestOf(mantissa: u64, e2: i32, boundary: bool, most: i32) -> System.DecimalDigits
// `d` rounded to `keep` digits, into `target` (its array has room): only the digits that decide it are copied
// (what follows the next one, never all zeros, stands as a 1).
static method RoundInto(d: System.DecimalDigits, keep: i32, target: System.DecimalDigits) -> void
// Which of two positive numbers is larger (-1, 0, 1).
static method Compare(a: System.DecimalDigits, b: System.DecimalDigits) -> i32
}