Skip to main content

Crate sim_lib_numbers_rational

Crate sim_lib_numbers_rational 

Source
Expand description

The numbers/rational domain: exact rational literals and values built over bigint numerator/denominator pairs, their reduced arithmetic, and promotion edges to and from the integer and f64 domains.

Structs§

Rational
An exact rational value: a numerator/denominator pair of integer values over bigint, displayed in compact num/den form when both parts are compact.
RationalNumberDomain
The exact rational number domain: parses num/den literals and declares the promotion edges to and from the integer and f64 domains.
RationalNumbersLib
The library that installs the numbers/rational domain: its literal class and shapes, the Rational value class, the reduced arithmetic ops, and the promotion rules to and from the integer and f64 domains.

Functions§

add_symbol
The math/add operator symbol this domain installs a rational rule for.
div_symbol
The math/div operator symbol this domain installs a rational rule for.
f64_decimal_to_rational
Converts a finite decimal string (no exponent) into an exact reduced numerator/denominator BigInt pair, the basis of the f64 -> rational promotion. Returns None on empty, exponential, or malformed input.
f64_domain
The numbers/f64 domain symbol, the far end of the rational <-> f64 promotion edges.
literal_class_symbol
The symbol of the rational literal class (the Expr::Number literal shape in canonical num/den form).
literal_instance_shape_symbol
The symbol of the shape matching individual rational literals, derived from literal_class_symbol.
mul_symbol
The math/mul operator symbol this domain installs a rational rule for.
number_domain
The numbers/rational domain symbol shared by this crate’s literals, values, and ops.
parse_rational_parts
Parses a num/den rational literal into a reduced numerator/denominator BigInt pair, returning None on malformed text or a zero denominator.
pow_symbol
The math/pow operator symbol this domain installs a rational rule for.
rational_value_class_symbol
The symbol of the numbers/rational value class, used to register the class and to tag the extension encoding of non-compact rational values.
sub_symbol
The math/sub operator symbol this domain installs a rational rule for.