www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 55] New: doFormat precision fails on integers < 10

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55

           Summary: doFormat precision fails on integers < 10
           Product: D
           Version: 0.149
          Platform: All
               URL: http://www.digitalmars.com/drn-
                    bin/wwwnews?digitalmars.D.learn/2828
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: korslund gmail.com


doFormat fails to add padding for integers less than 10. A test case is

writefln("number = %.8d", cast(ulong)7);

which outputs '7' without padding. For more details, see

http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.learn/2828


-- 
Mar 18 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55






Created an attachment (id=3)
 --> (http://d.puremagic.com/bugzilla/attachment.cgi?id=3&action=view)
Check precision and base correctly.

This patch:

1. Addresses Regan Heath's comments (which are the same I had before reading
his.)
2. Still passes all of std.format's existing unittests, and seems to work fine
for all bases.
3. Adds this bug to the unittests in format.d.

Thanks,
-[Unknown]


-- 
Mar 18 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55


unknown simplemachines.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |unknown simplemachines.org






 Created an attachment (id=3)
--> (http://d.puremagic.com/bugzilla/attachment.cgi?id=3&action=view) [edit]
 Check precision and base correctly.
Darn, minor nit - I used a tab for a comment above the addition to the unittests, which should be 4 spaces (sorry, have a hard habit of indenting purely with tabs.) -[Unknown] --
Mar 18 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed in DMD 0.151.


-- 
Apr 03 2006