Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing zeroes when using :g #1129

Closed
TheQwertiest opened this issue Apr 22, 2019 · 1 comment
Closed

Trailing zeroes when using :g #1129

TheQwertiest opened this issue Apr 22, 2019 · 1 comment

Comments

@TheQwertiest
Copy link
Contributor

TheQwertiest commented Apr 22, 2019

Docs:
According to http://fmtlib.net/latest/syntax.html#grammar-token-int_type and https://en.cppreference.com/w/cpp/io/c/fprintf type :g must remove trailing zeroes:

Unless alternative representation is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left`.

Current behaviour:

double arg = 0.1;
std::string output = fmt::format("{%.16g}", arg);

produces 0.1000000000000000

@vitaut
Copy link
Contributor

vitaut commented Apr 27, 2019

Fixed in 40a7975, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants