<p>I think the only difference may be that gdc possibly folds the call to exp().</p>
<p>Check the difference between what code gdc generates compared to how gcc processed it:  -fdump-tree-original  -fdump-tree-optimized</p>
<p>----<br>
Iain Buclaw</p>
<p>*(p < e ? p++ : p) = (c & 0x0f) + '0';</p>
<p>On 14 Jan 2012 06:56, "Daniel Green" <<a href="mailto:venix1@gmail.com">venix1@gmail.com</a>> wrote:<br>
><br>
> I've been working on fixing GDC/MinGW's runtime support.  I ran across the following and was hoping to get a clarification on what DMD does differently than GDC.<br>
><br>
> void testexp()<br>
> {<br>
>    printf("exp(3.0) = %Lg, %Lg\n", exp(3.0), E * E * E);<br>
>    assert(equals(exp(3.0), E * E * E, 16));<br>
> }<br>
><br>
> Of interest is exp(3.0).  GDC matches exp(3.0) to double exp(double). This causes problems with printf due to %Lg wanting a real but only receiving a double.<br>
><br>
> Looking at the D specification for overloading functions.<br>
>    1. no match<br>
>    2. match with implicit conversions<br>
>    3. match with conversion to const<br>
>    4. exact match<br>
><br>
><br>
> The specification doesn't indicate what levels are better.  I would guess 4 is the best since an exact match should take precedence.<br>
> However, that results in GDC matching exp(3.0) to double exp(double).<br>
><br>
> How does DMD match exp(3.0)?<br>
><br>
> Could it possibly be a typo?  For 32-bit this test passes because the printf doesn't segfault, it's only  noticeable with 64-bit since it segfaults.<br>
</p>