February 16, 2021 [Issue 21641] New: std.format: %g produces in rare circumstances inconsistent result | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21641 Issue ID: 21641 Summary: std.format: %g produces in rare circumstances inconsistent result Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: bugzilla@bernis-buecher.de import std.stdio; void main() { float a = -999999.8125; writefln!"%#.1g"(a); writefln!"%#.2g"(a); writefln!"%#.3g"(a); writefln!"%#.4g"(a); writefln!"%#.5g"(a); writefln!"%#.6g"(a); writefln!"%#.7g"(a); writefln!"%#.8g"(a); writefln!"%#.9g"(a); } produces: -1.e+06 -1.0e+06 -1.00e+06 -1.000e+06 -1.0000e+06 -1.e+06 -999999.8 -999999.81 -999999.812 The sixth line is inconsistent, should be -1.00000e+06. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply