[Bug 113] std.format.doFormat and small hex numbers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 22 02:09:03 PDT 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=113


rioshin at mbnet.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rioshin at mbnet.fi




------- Comment #1 from rioshin at mbnet.fi  2006-04-22 04:09 -------
Ok, this definitely is a bug in the library. Currently the code looks like:

if (vnumber < base)
{
    vchar = '0' + vnumber;
    goto L2;
}

which results in a bug in case vnumber >= 10 and base > 10. To fix it, we could
use:

if (vnumber < base && vnumber < 10)
{
    vchar = '0' + vnumber;
    goto L2;
}
else if (vnumber < base)
{
    vchar = 'A' + (vnumber - 10);
    goto L2;
}


-- 




More information about the Digitalmars-d-bugs mailing list