Code that formats f64?

Hello,

I'm looking for the code that formats f64, or any documentation of it.

I mean, if I write

let x: f64 = 12345;
println!("{}", x);

where is the code that actually turns my number into characters? Thanks!

Rust uses the Grisu algorithm, the code is in core::num::flt2dec::strategy::grisu.

There are other details, but you should be able to look them up yourself by searching for flt2dec in the codebase.

2 Likes

Awesome, thanks!