std.math performance (SSE vs. real)

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 2 15:15:22 PDT 2014


On Wednesday, 2 July 2014 at 21:44:17 UTC, Walter Bright wrote:
> On 7/2/2014 2:33 PM, Sean Kelly wrote:
>> On Wednesday, 2 July 2014 at 20:37:37 UTC, Walter Bright wrote:
>>> I'm afraid that would not only break most D programs, but also
>>> interoperability with C.
>>
>> Could you explain this?  I didn't think we used 'real' to
>> interface with C at all.  We might need a type to match 'long
>> double' in C, but what that is is already exceedingly variable.
>> This would probably be another case for a special alias like we
>> have for c_long.
>
> 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?

  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?


More information about the Digitalmars-d mailing list