Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #780 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

Problem in tango.text.convert.Integer.format: Stdout.formatln("{:2}", -56) prints 6

Reported by: Deewiant Assigned to: kris
Priority: major Milestone: 0.99.4
Component: Core Functionality Version: trunk
Keywords: Cc:

Description

Stdout.formatln("{:2}", -56);

The above prints 6, when it should print -56.

Some tracing finds that tango.text.convert.Integer.format returns a slice, "dst[len..$]". dst[len] contains the '6', dst[len-1] contains the '5', and the '-' is in "prefix" which is not included at all. I can't follow the logic fully so I'm not sure where exactly the problem is, but I think "if (len > prefix.length)" has an incorrect condition, and the if should be entered.

Change History

11/25/07 07:15:10 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.

fixed in [2927]

Thanks, Deewiant

11/25/07 07:15:30 changed by kris

  • milestone set to 0.99.4.