Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/float_decimal"
This is a provider or implementation package. Start with the linked guide’s application API; native declarations depend on the selected target.
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
ptr |
core/ptr |
float_decimal.dodo |
DecimalError
Enum · Source
Exact binary64 conversion using the identity m / 2^k = (m * 5^k) / 10^k. Decode the significand and exponent, construct an integer decimal coefficient, then round that coefficient to the requested decimal place. All arithmetic after reading the bits is integer arithmetic, independent of the FP mode. fmt handles signs and special spellings; this helper accepts finite values >= 0 (including either zero encoding) and checks capacity before writing.
pub enum DecimalError {
InvalidPrecision, InvalidValue, BufferFull
}
MAX_PRECISION
Constant · Source
pub const MAX_PRECISION: usize = 324
convert
Function · Source
pub fn convert(output: &mut[u8], value: f64, precision: usize, scientific: bool) -> usize!DecimalError