std.math performance (SSE vs. real)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 2 17:03:47 PDT 2014


On 7/2/2014 3:15 PM, Sean Kelly wrote:
> On Wednesday, 2 July 2014 at 21:44:17 UTC, Walter Bright wrote:
>> C long double == D real for 32 and 64 bit OSX, Linux, and FreeBSD.
>
> And it's 'double double' on PPC and 128 bit quad on SPARC.
> Assuming D targets those platforms, what will be the behavior
> there?

Per the D spec, 'real' will be the longest type supported by the native hardware.


>   From my perspective, it seems like 'real' in D is utterly
> non-portable given its definition.  I can see maybe using it in
> some cases if I knew I was targeting a specific architecture
> where the added precision was helpful, but for general purpose
> programming I'd always either use 'double' or some library-based
> type for extended precision, simply to have some assurance that
> my result would be predictable.  Am I wrong in this?

D is a systems programming language. That means it should have access to the 
hardware supported types. Portability is not the only goal - especially if that 
means "least common denominator". People pay money for more powerful chips, and 
they'll want to use them.

Not only that, a marquee feature of D is interoperability with C. We'd need an 
AWFULLY good reason to throw that under the bus.



More information about the Digitalmars-d mailing list