www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17715] New: Floating point numbers are printed as integers

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

          Issue ID: 17715
           Summary: Floating point numbers are printed as integers
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: pgkos.bugzilla yahoo.com

Currently, this example:

writeln(10000.01);

prints just "10000", probably because the call to snprintf inside
phobos/format.d formatValue implementation for floats uses "%g" by default.

It would be nice if the default formatter was e.g.:
%.8g for float type
%.16g for double type

--
Aug 03