80 bit floating point emulator

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Feb 6 13:42:16 UTC 2022


On Sunday, 6 February 2022 at 13:36:37 UTC, kinke wrote:
> On Sunday, 6 February 2022 at 13:29:23 UTC, Ola Fosheim Grøstad 
> wrote:
>> But WHY would you compute compile time in only 80-bit?
>
> For `log(0.1L)` at CTFE, the compiler must when targeting a 
> platform with x87 real.
>
> From https://dlang.org/spec/float.html#fp_const_folding:
>> 1. Regardless of the type of the operands, floating-point 
>> constant folding is done in real or greater precision. It is 
>> always done following IEEE-754 rules and round-to-nearest is 
>> used.

It says "or greater precision", so you can use a higher precision 
library. Which is what you would want when building lookup-tables.

But in general, it would be better to have real be a compile time 
type only and instead have ieee32, ieee64, ieee80, ieee128 etc.



More information about the Digitalmars-d mailing list