1- fast-float
2- ==========
1+ fast-float2
2+ ===========
33
4- [ ![ Build] ( https://github.com/aldanor /fast-float-rust/workflows/CI/badge.svg )] ( https://github.com/aldanor /fast-float-rust/actions?query=branch%3Amaster )
5- [ ![ Latest Version] ( https://img.shields.io/crates/v/fast-float .svg )] ( https://crates.io/crates/fast-float )
6- [ ![ Documentation] ( https://docs.rs/fast-float /badge.svg )] ( https://docs.rs/fast-float )
4+ [ ![ Build] ( https://github.com/Alexhuszagh /fast-float-rust/workflows/CI/badge.svg )] ( https://github.com/Alexhuszagh /fast-float-rust/actions?query=branch%3Amaster )
5+ [ ![ Latest Version] ( https://img.shields.io/crates/v/fast-float2 .svg )] ( https://crates.io/crates/fast-float2 )
6+ [ ![ Documentation] ( https://docs.rs/fast-float2 /badge.svg )] ( https://docs.rs/fast-float2 )
77[ ![ Apache 2.0] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
88[ ![ MIT] ( https://img.shields.io/badge/License-MIT-blue.svg )] ( https://opensource.org/licenses/MIT )
99[ ![ Rustc 1.37+] ( https://img.shields.io/badge/rustc-1.37+-lightgray.svg )] ( https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html )
@@ -12,7 +12,7 @@ This crate provides a super-fast decimal number parser from strings into floats.
1212
1313``` toml
1414[dependencies ]
15- fast-float = " 0.2"
15+ fast-float2 = " 0.2.1 "
1616```
1717
1818There are no dependencies and the crate can be used in a no_std context by disabling the "std" feature.
@@ -21,10 +21,10 @@ There are no dependencies and the crate can be used in a no_std context by disab
2121
2222## Usage
2323
24- There's two top-level functions provided:
25- [ ` parse() ` ] ( https://docs.rs/fast-float/latest/fast_float/fn.parse.html ) and
24+ There's two top-level functions provided:
25+ [ ` parse() ` ] ( https://docs.rs/fast-float/latest/fast_float/fn.parse.html ) and
2626[ ` parse_partial() ` ] ( https://docs.rs/fast-float/latest/fast_float/fn.parse_partial.html ) , both taking
27- either a string or a bytes slice and parsing the input into either ` f32 ` or ` f64 ` :
27+ either a string or a bytes slice and parsing the input into either ` f32 ` or ` f64 ` :
2828
2929- ` parse() ` treats the whole string as a decimal number and returns an error if there are
3030 invalid characters or if the string is empty.
@@ -39,12 +39,12 @@ Example:
3939``` rust
4040// Parse the entire string as a decimal number.
4141let s = " 1.23e-02" ;
42- let x : f32 = fast_float :: parse (s ). unwrap ();
42+ let x : f32 = fast_float2 :: parse (s ). unwrap ();
4343assert_eq! (x , 0.0123 );
4444
4545// Parse as many characters as possible as a decimal number.
4646let s = " 1.23e-02foo" ;
47- let (x , n ) = fast_float :: parse_partial :: <f32 , _ >(s ). unwrap ();
47+ let (x , n ) = fast_float2 :: parse_partial :: <f32 , _ >(s ). unwrap ();
4848assert_eq! (x , 0.0123 );
4949assert_eq! (n , 8 );
5050assert_eq! (& s [n .. ], " foo" );
@@ -53,19 +53,22 @@ assert_eq!(&s[n..], "foo");
5353## Details
5454
5555This crate is a direct port of Daniel Lemire's [ ` fast_float ` ] ( https://github.com/fastfloat/fast_float )
56- C++ library (valuable discussions with Daniel while porting it helped shape the crate and get it to
56+ C++ library (valuable discussions with Daniel while porting it helped shape the crate and get it to
5757the performance level it's at now), with some Rust-specific tweaks. Please see the original
5858repository for many useful details regarding the algorithm and the implementation.
5959
60- The parser is locale-independent. The resulting value is the closest floating-point values (using either
61- ` f32 ` or ` f64 ` ), using the "round to even" convention for values that would otherwise fall right in-between
62- two values. That is, we provide exact parsing according to the IEEE standard.
60+ The parser is locale-independent. The resulting value is the closest floating-point values (using either
61+ ` f32 ` or ` f64 ` ), using the "round to even" convention for values that would otherwise fall right in-between
62+ two values. That is, we provide exact parsing according to the IEEE standard.
6363
6464Infinity and NaN values can be parsed, along with scientific notation.
6565
6666Both little-endian and big-endian platforms are equally supported, with extra optimizations enabled
6767on little-endian architectures.
6868
69+ Since [ fast-float-rust] ( https://github.com/aldanor/fast-float-rust ) is unmaintained, this is a fork
70+ containing the patches and security updates.
71+
6972## Testing
7073
7174There are a few ways this crate is tested:
@@ -80,7 +83,7 @@ There are a few ways this crate is tested:
8083## Performance
8184
8285The presented parser seems to beat all of the existing C/C++/Rust float parsers known to us at the
83- moment by a large margin, in all of the datasets we tested it on so far – see detailed benchmarks
86+ moment by a large margin, in all of the datasets we tested it on so far – see detailed benchmarks
8487below (the only exception being the original fast_float C++ library, of course – performance of
8588which is within noise bounds of this crate). On modern machines like Apple M1, parsing throughput
8689can reach up to 1.5 GB/s.
@@ -103,7 +106,7 @@ C++ library, here are few brief notes:
103106
104107## Benchmarks
105108
106- Below are tables of best timings in nanoseconds for parsing a single number
109+ Below are tables of best timings in nanoseconds for parsing a single number
107110into a 64-bit float.
108111
109112#### Intel i7-4771
@@ -169,12 +172,12 @@ AMD Rome, Linux, Rust 1.49.
169172
170173#### Notes
171174
172- - The two test files referred above can be found in
175+ - The two test files referred above can be found in
173176[ this] ( https://github.com/lemire/simple_fastfloat_benchmark ) repository.
174177- The Rust part of the table (along with a few other benchmarks) can be generated via
175178 the benchmark tool that can be found under ` extras/simple-bench ` of this repo.
176179- The C/C++ part of the table (along with a few other benchmarks and parsers) can be
177- generated via a C++ utility that can be found in
180+ generated via a C++ utility that can be found in
178181 [ this] ( https://github.com/lemire/simple_fastfloat_benchmark ) repository.
179182
180183<br >
0 commit comments