Thread overview
[Bug 55] New: doFormat precision fails on integers < 10
Mar 18, 2006
d-bugmail
Mar 18, 2006
d-bugmail
Mar 18, 2006
d-bugmail
Apr 03, 2006
d-bugmail
March 18, 2006
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


-- 

March 18, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55





------- Comment #1 from unknown@simplemachines.org  2006-03-18 11:06 -------
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]


-- 

March 18, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55


unknown@simplemachines.org changed:

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




------- Comment #2 from unknown@simplemachines.org  2006-03-18 11:11 -------
(In reply to comment #1)
> 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]


-- 

April 03, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=55


deewiant@gmail.com changed:

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




------- Comment #3 from deewiant@gmail.com  2006-04-03 05:48 -------
Fixed in DMD 0.151.


--