Why is std.math slower than the C baseline?

Nathan S. no.public.email at example.com
Sat Jun 6 05:58:37 UTC 2020


On Friday, 5 June 2020 at 20:05:56 UTC, jmh530 wrote:
> On Friday, 5 June 2020 at 19:39:26 UTC, Andrei Alexandrescu 
> wrote:
>> [snip]
>>
>> This needs to change. It's one thing to offer more precision 
>> to the user who consciously uses 80-bit reals, and it's an 
>> entirely different thing to force that bias on the user who's 
>> okay with double precision.
>
> I agree with you that more precision should be opt-in.
>
> However, I have always been sympathetic to Walter's argument in 
> favor doing intermediates at the highest precision. There are 
> many good reasons why critical calculations need to be done at 
> the highest precision possible.

I believe that decision was based on a time when floating point 
math on common computers was done in higher precision anyway so 
explicit `real` didn't cost anything and avoided needless 
rounding.

https://en.wikipedia.org/wiki/X87#Description

>By default, the x87 processors all use 80-bit double-extended 
>precision
>internally (to allow sustained precision over many calculations, 
>see IEEE
>754 design rationale).


More information about the Digitalmars-d mailing list