Thread overview
CTFE formatting of floating point values
Mar 25, 2013
Johannes Pfau
Mar 25, 2013
Iain Buclaw
Mar 26, 2013
Johannes Pfau
March 25, 2013
I think this is a known issue:
DMD expects real.stringof to return a string in the %g format. However
the GCC function used for formatting real numbers always returns the %e
format.

There is a failing test for this in the test suite. (runnable/test42.d
(test49)). Would it be OK to disable this test if a file a bug
report on our bugtracker and on the gcc bugtracker? This would
allow running the other tests in that file.
March 25, 2013
On 25 March 2013 18:31, Johannes Pfau <nospam@example.com> wrote:

> I think this is a known issue:
> DMD expects real.stringof to return a string in the %g format. However
> the GCC function used for formatting real numbers always returns the %e
> format.
>
> There is a failing test for this in the test suite. (runnable/test42.d
> (test49)). Would it be OK to disable this test if a file a bug
> report on our bugtracker and on the gcc bugtracker? This would
> allow running the other tests in that file.
>


GCC backend always appends the exponent, so I would just amend it to do:

assert((25.5).stringof ~ (3.01).stringof == "2.55e+13.01e+0");


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


March 26, 2013
Am Mon, 25 Mar 2013 19:03:19 +0000
schrieb Iain Buclaw <ibuclaw@ubuntu.com>:

> On 25 March 2013 18:31, Johannes Pfau <nospam@example.com> wrote:
> 
> > I think this is a known issue:
> > DMD expects real.stringof to return a string in the %g format.
> > However the GCC function used for formatting real numbers always
> > returns the %e format.
> >
> > There is a failing test for this in the test suite. (runnable/test42.d (test49)). Would it be OK to disable this test if a file a bug report on our bugtracker and on the gcc bugtracker? This would allow running the other tests in that file.
> >
> 
> 
> GCC backend always appends the exponent, so I would just amend it to do:
> 
> assert((25.5).stringof ~ (3.01).stringof == "2.55e+13.01e+0");
> 
> 
> Regards

OK. I thought the .stringof format is somehow specified, but it seems it's not so this is indeed not a bug.