Name Description Size
bellerophon.rs An implementation of Clinger's Bellerophon algorithm. This is a moderate path algorithm that uses an extended-precision float, represented in 80 bits, by calculating the bits of slop and determining if those bits could prevent unambiguous rounding. This algorithm requires less static storage than the Lemire algorithm, and has decent performance, and is therefore used when non-decimal, non-power-of-two strings need to be parsed. Clinger's algorithm is described in depth in "How to Read Floating Point Numbers Accurately.", available online [here](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.45.4152&rep=rep1&type=pdf). This implementation is loosely based off the Golang implementation, found [here](https://github.com/golang/go/blob/b10849fbb97a2244c086991b4623ae9f32c212d0/src/strconv/extfloat.go). This code is therefore subject to a 3-clause BSD license. 13650
bigint.rs A simple big-integer type for slow path algorithms. This includes minimal stackvector for use in big-integer arithmetic. 24688
extended_float.rs 633
fpu.rs Platform-specific, assembly instructions to avoid intermediate rounding on architectures with FPUs. This is adapted from the implementation in the Rust core library, the original implementation can be [here](https://github.com/rust-lang/rust/blob/master/library/core/src/num/dec2flt/fpu.rs). It is therefore also subject to a Apache2.0/MIT license. 3890
heapvec.rs Simple heap-allocated vector. 4568
lemire.rs Implementation of the Eisel-Lemire algorithm. This is adapted from [fast-float-rust](https://github.com/aldanor/fast-float-rust), a port of [fast_float](https://github.com/fastfloat/fast_float) to Rust. 9131
lib.rs Fast, minimal float-parsing algorithm. minimal-lexical has a simple, high-level API with a single exported function: [`parse_float`]. [`parse_float`] expects a forward iterator for the integer and fraction digits, as well as a parsed exponent as an [`i32`]. For more examples, please see [simple-example](https://github.com/Alexhuszagh/minimal-lexical/blob/master/examples/simple.rs). EXAMPLES -------- ``` extern crate minimal_lexical; // Let's say we want to parse "1.2345". // First, we need an external parser to extract the integer digits ("1"), // the fraction digits ("2345"), and then parse the exponent to a 32-bit // integer (0). // Warning: // -------- // Please note that leading zeros must be trimmed from the integer, // and trailing zeros must be trimmed from the fraction. This cannot // be handled by minimal-lexical, since we accept iterators. let integer = b"1"; let fraction = b"2345"; let float: f64 = minimal_lexical::parse_float(integer.iter(), fraction.iter(), 0); println!("float={:?}", float); // 1.235 ``` [`parse_float`]: fn.parse_float.html [`i32`]: https://doc.rust-lang.org/stable/std/primitive.i32.html 1990
libm.rs A small number of math routines for floats and doubles. These are adapted from libm, a port of musl libc's libm to Rust. libm can be found online [here](https://github.com/rust-lang/libm), and is similarly licensed under an Apache2.0/MIT license 38671
mask.rs Utilities to generate bitmasks. 1261
num.rs Utilities for Rust numbers. 10249
number.rs Representation of a float as the significant digits and exponent. This is adapted from [fast-float-rust](https://github.com/aldanor/fast-float-rust), a port of [fast_float](https://github.com/fastfloat/fast_float) to Rust. 3723
parse.rs Parse byte iterators to float. 6618
rounding.rs Defines rounding schemes for floating-point numbers. 4286
slow.rs Slow, fallback cases where we cannot unambiguously round a float. This occurs when we cannot determine the exact representation using both the fast path (native) cases nor the Lemire/Bellerophon algorithms, and therefore must fallback to a slow, arbitrary-precision representation. 14611
stackvec.rs Simple stack-allocated vector. 8878
table.rs Pre-computed tables for parsing float strings. 308
table_bellerophon.rs Cached exponents for basen values with 80-bit extended floats. Exact versions of base**n as an extended-precision float, with both large and small powers. Use the large powers to minimize the amount of compounded error. This is used in the Bellerophon algorithm. These values were calculated using Python, using the arbitrary-precision integer to calculate exact extended-representation of each value. These values are all normalized. DO NOT MODIFY: Generated by `etc/bellerophon_table.py` 4049
table_lemire.rs Pre-computed tables powers-of-5 for extended-precision representations. These tables enable fast scaling of the significant digits of a float to the decimal exponent, with minimal rounding errors, in a 128 or 192-bit representation. DO NOT MODIFY: Generated by `etc/lemire_table.py` This adapted from the Rust implementation, based on the fast-float-rust implementation, and is similarly subject to an Apache2.0/MIT license. 36927
table_small.rs Pre-computed small tables for parsing decimal strings. 2127