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

Ticket #524 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

tango.text.convert.Float.format fails on negative infinity/zero/nan

Reported by: Deewiant Assigned to: kris
Priority: normal Milestone: 0.99.2 RC5
Component: Core Functionality Version: trunk
Keywords: Cc:


tango.text.convert.Float.format doesn't check for negative infinity, causing pow10 to throw an "exponent too large" exception. Simple example:

void main() {
  alias float F; // ditto double, real...

It's simple to fix: after the "x !<>= x" and "x is x.infinity" checks, add one for "x is -x.infinity". Presumably it'd return "-inf".


Float_sign.patch (0.9 kB) - added by Deewiant on 08/01/07 17:17:12.

Change History

06/26/07 07:12:12 changed by Don Clugston

Actually it should be using math.IEEE.signbit() for doing the sign, in every case. That way it will also works for a signed zero and NaN. The issue I'm wrestling with is, what to do about NaN payloads? I'm creating another ticket for that.

08/01/07 17:16:29 changed by Deewiant

  • summary changed from tango.text.convert.Float.format fails on negative infinity to tango.text.convert.Float.format fails on negative infinity/zero/nan.

Attaching a patch which solves the sign issues: it now works for both signed and unsigned zeroes, NaNs?, infinities, and regular values.

08/01/07 17:17:12 changed by Deewiant

  • attachment Float_sign.patch added.

09/30/07 23:09:14 changed by kris

  • owner changed from sean to kris.
  • milestone set to 1.0.

10/03/07 04:03:07 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from 1.0 to 0.99.2 RC5.

fixed in [2602]