Clarification on testsuite 'runnable/testmath.d'

Iain Buclaw ibuclaw at ubuntu.com
Sat Jan 14 07:34:18 PST 2012


On 14 January 2012 15:20, Daniel Green <venix1 at gmail.com> wrote:
> On 1/14/2012 3:29 AM, Walter Bright wrote:
>>
>> On 1/13/2012 10:51 PM, Daniel Green wrote:
>>>
>>> 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.
>>
>>
>> 3.0 should match double, when there is both double and real.
>
>
> On 1/14/2012 3:29 AM, Walter Bright wrote:
>> On 1/13/2012 10:51 PM, Daniel Green wrote:
>>> 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.
>>
>> 3.0 should match double, when there is both double and real.
>
> When I run the following through DMD r is type real.  For GDC r is type
> double.
>
> The matched function would be
>   double exp(double x) @safe pure nothrow  { return exp(cast(real)x); }.
>
> Is it expected that DMD promotes a double to real?
>
>
> // GDC: r is type double
> // DMD: r is type real
> import std.stdio;
> import std.math;
>
> void main()
> {
>    auto r = exp(3.0);
>    writefln("%s", typeof(r).stringof);
> }

Strange, I get 'double' for both DMD and GDC... is this maybe a Windows thing?


-- 
Iain Buclaw

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


More information about the Digitalmars-d mailing list