Expand description
A numerical library to represent numbers as large as 10^^1e308 and as ‘small’ as 10^-(10^^1e308).
§Examples
use break_eternity::Decimal;
let a = Decimal::from_number(1.0);
let b = Decimal::from_number(2.0);
let c = a + b;
assert_eq!(c, Decimal::from_number(3.0));
Structs§
- Decimal
- A Decimal number that can represent numbers as large as 10^^1e308 and as ‘small’ as 10^-(10^^1e308).
Enums§
- Break
Eternity Error - Error type for all errors in this crate.
Constants§
- EXPN1
- exp(-1)
- EXPONENT_
LIMIT - Exponent limit to increase a layer (9e15 is about the largest safe number)
- FIRST_
NEG_ LAYER - At layer 0, smaller non-zero numbers than this become layer 1 numbers with negative mag.
- LAYER_
REDUCTION_ THRESHOLD - Layer reduction threshold
- MAX_
ES_ IN_ A_ ROW - Amount of Es that will be printed in a string representation of a Decimal.
- MAX_
FLOAT_ PRECISION - Maximum number of digits of precision to assume in a float
- MAX_
POWERS_ OF_ TEN - Maximum number powers of 10 that will be cached.
- NUMBER_
EXP_ MAX - Largest exponent that can appear in a number.
- NUMBER_
EXP_ MIN - Smallest exponent that can appear in a number.
- OMEGA
- W(1, 0)
- TWO_PI
- 2*PI
Functions§
- decimal_
places - Truncates the given number to the given number of significant digits and rounds, if necessary.
- sign
- Returns the sign of the number.
- to_
fixed - Formats the given number to the given number of significant digits.