Bug 55 – doFormat precision fails on integers < 10

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-03-18T03:26:00Z
Last change time
2014-02-15T02:15:18Z
Assigned to
bugzilla
Creator
korslund

Attachments

IDFilenameSummaryContent-TypeSize
3bug55.diffCheck precision and base correctly.text/plain781

Comments

Comment #0 by korslund — 2006-03-18T03:26:43Z
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
Comment #1 by bugs-d — 2006-03-18T11:06:11Z
Created attachment 3 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]
Comment #2 by bugs-d — 2006-03-18T11:11:38Z
(In reply to comment #1) > Created an attachment (id=3) [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]
Comment #3 by matti.niemenmaa+dbugzilla — 2006-04-03T05:48:28Z
Fixed in DMD 0.151.