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

Ticket #808 (closed enhancement: fixed)

Opened 16 years ago

Last modified 16 years ago

Float formatting: lower exponent threshold to switch to scientific format

Reported by: JarrettBillingsley Assigned to: kris
Priority: normal Milestone: 0.99.4
Component: Core Functionality Version: 0.99.3 Triller
Keywords: Cc: JarrettBillingsley

Description (Last modified by kris)

When formatting large floating-point numbers, Tango's formatting currently outputs the whole number as long as the exponent is below 34 or so. This is a bit superfluous for float and double (and even x86 real, to an extent), since those formats only have about 7 and 15 digits of precision, respectively, and the output number looks absurd with all the trailing zeros. Not only that, those extra digits give a false sense of precision: if those zeros are visible, one thinks that there's a reason for them, when in reality they are just there because the exponent says there are more digits after the mantissa than are stored.

Instead the default "scientific format" exponent threshold should be changed for all three types, and may be user-definable in float formatting specifiers. The default threshold should be around 7 or 8 for floats, around 15 for doubles, and 18 for reals (on platforms where real.sizeof == 10 || real.sizeof == 12).

Change History

12/09/07 19:55:53 changed by kris

  • owner changed from sean to kris.
  • description changed.
  • milestone set to 0.99.4.

12/09/07 21:58:15 changed by kris

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

fixed in [3001]

thanks, Jarrett