Skip to main content

Module convert

Module convert 

Source
Expand description

Cross-type conversions between OxiNum numeric types.

These functions convert between integers, floats, and rationals, with explicit precision control where lossy conversions are involved.

Functions§

float_from_str
Parse a decimal float (DBig) from a string.
float_to_rational
Convert a decimal float (DBig) to an exact rational (RBig).
int_to_float
Convert an integer (IBig) to a decimal float (DBig).
int_to_rational
Convert an integer (IBig) to an exact rational (RBig).
rational_to_float
Convert a rational (RBig) to a decimal float (DBig) at the given number of significant decimal digits.
rational_to_int
Convert a rational (RBig) to an integer (IBig) by truncation (rounding toward zero).