[Issue 20320] New: format("%f") leeds to wrong output

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 25 06:27:10 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20320

          Issue ID: 20320
           Summary: format("%f") leeds to wrong output
           Product: D
           Version: D2
          Hardware: Other
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at d-ecke.de

import std.stdio;
void main() {
  real a = 0.16;
  real b = 0.016;
  writefln("%.1f", a);
  writefln("%.2f", b);
}
----

Output:
---
0.2
0.01
----

I am using dmd on Windows. It doesn't happen when compiling with -m32.
----
$ dmd
DMD32 D Compiler v2.088.1-dirty

Reported by Yui Hosaka in the forum:
https://forum.dlang.org/post/pzzufbdwcgbuytxatgve@forum.dlang.org

--


More information about the Digitalmars-d-bugs mailing list