Clarification on testsuite 'runnable/testmath.d'

Daniel Green venix1 at gmail.com
Sat Jan 14 07:20:50 PST 2012


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);
}


More information about the Digitalmars-d mailing list