vi / float-pretty-print Goto Github PK
View Code? Open in Web Editor NEWFormat f64 in Rust with minimum and maximum width, auto switching between scientific and normal representation
Format f64 in Rust with minimum and maximum width, auto switching between scientific and normal representation
Negative exponents seem to miscalculate the minimum width. Example:
format!("= {:6.6}", PrettyPrintFloat(5.0e-50))
results in 5e-50
. This is 5 characters wide while the minimum is 6. I am expecting it to print _5e-50
in this case, with the underscore indicating a space for visibility.
These currently pass:
assert_eq!(format!("{:.3}", PrettyPrintFloat(0f64)), "0.0");
assert_eq!(format!("{:.3}", PrettyPrintFloat(0.01f64)), " 0");
But maybe they both should be 0.0
? Or at the very least the second one should not be padded to be three characters wide.
Hi!
First of all, congratulation on this amazing crate. I'd like to know if there's a way to prevent rounding for big numbers. For instance:
use float_pretty_print::PrettyPrintFloat;
fn main() {
println!("{}", PrettyPrintFloat(224617.445991228));
}
Prints 2.24617446e5
which, in my case, breaks some tests those expect getting the exact value 224617.445991228
.
Could it be possible with your crate?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.