dtolnay / ryu

Fast floating point to string conversion
Apache License 2.0
606 stars 27 forks source link

An extra .0 compares to std #48

Closed Austaras closed 1 year ago

Austaras commented 2 years ago
use ryu;

fn main() {
    let mut buffer = ryu::Buffer::new();
    println!("{} {}", buffer.format(300_f64), 300_f64);
}

would get 300.0 300.

Why and is there a public API to remove it?

Dennis-Zhang-SH commented 1 year ago

I am meeting this problem also

dtolnay commented 1 year ago

It is not a goal to match the formatting output of libcore exactly. In fact the readme describes another case where the formatting is different. The chosen formatting is intentional.