Crate break_eternity

Source
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§

BreakEternityError
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.