[Issue 3248] lossless floating point formatting

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 7 04:25:40 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3248



--- Comment #9 from Don <clugdbug at yahoo.com.au> 2009-09-07 04:25:35 PDT ---
(In reply to comment #8)
> (In reply to comment #4)
> > As far as I understand it, removing trailing zeros from .8 precision and (c)
> > are the same.
> 
> I doubt it ... I think the optimal number of decimal s.f. would depend on the
> binary exponent.  But I'll experiment when I have time.

You are correct. Some numbers need an extra digit.

> > I remember .dig being 6 for all floats (could be wrong here, not close to any
> > dmd.exe)
> 
> The spec describes .dig as "number of decimal digits of precision", which seems
> ambiguous.  Is it a property of the type or the value? 

It's a property of the type. 

 If it's a type
> property, is it the maximum number of s.f. that may be required to express a
> number of the type unambiguously, or the number of s.f. to which numbers are
> guaranteed to be storeable unambiguously?  

Neither. It's the number of sic figs which are accurate in the worst case. So
it's the _minimum_ number of digits which are stored. To unambiguously define
the number, more digits are almost always required.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list