Skip to content

Trailing zeroes when using :g #1129

Closed
Closed
@TheQwertiest

Description

@TheQwertiest

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions