Full precision decimal representation of f64

5 releases

0.1.4 Aug 3, 2022
0.1.3 May 14, 2022
0.1.2 Apr 30, 2022
0.1.1 Jun 16, 2020
0.1.0 Apr 21, 2019

#21 in #float

48 downloads per month


92 lines

Precise float to string

github crates.io docs.rs build status

This crate computes the decimal representation of the single rational number whose value is mathematically equal to a given float.

Note that this is almost never an appropriate way to print user-facing values. For that, use the ryu crate instead.

precise = "0.1"


fn main() {
    // 0.1000000000000000055511151231257827021181583404541015625
    println!("{}", precise::to_string(0.1));


Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~10K SLoC