80 bit floating point emulator

Walter Bright newshound2 at digitalmars.com
Sun Feb 6 04:30:25 UTC 2022


It turns out we can use one for the D compiler, to support cross compilation for 
machines that don't have 80 bits.

It doesn't have to emulate all the instructions, just:

neg
add
sub
mul
div
cmp
tst

conversions to/from double,float,int,long

The 128 bit integer emulator Iain and I worked on is a good starting point to use:

   https://github.com/dlang/druntime/blob/master/src/core/int128.d

As well as the 64 bit floating point emulator from DMC:

   https://github.com/DigitalMars/dmc/blob/master/src/CORE32/DOUBLE.ASM

80 bits works a bit different from 64 bits, in that the hidden bit is explicit, 
and subnormals are present. But most of it will be just like double.asm, just 
with more bits. It should be easier being written in D, too, rather than assembler.

This is a worthy challenge for anyone wanting a strong item on their resume. Any 
takers?

P.S. It doesn't have to be fast. It just has to be written in portable D and 
produce the same answers as the x87.


More information about the Digitalmars-d mailing list