VOGONS


First post, by TeaRex

User metadata
Rank Member
Rank
Member

Another patch, really too anal to put it on the patches pages, thus here. It blows up the math constants in fpu_types.h to 50 significant digits. It's overkill, I know, but these should work even on systems which do FP math in 128 bits accuracy.

Attachments

tearex

Reply 2 of 3, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The regular fpu uses doubles and assumes them to be at 64bits in size,
so everything is truncated there anyways. And the x86 asm fpu (default
fpu under x86 architectures) doesn't use the constants at all.
But it doesn't hurt, so thanks for providing them 😀

Reply 3 of 3, by TeaRex

User metadata
Rank Member
Rank
Member
icemann wrote:

Where would that be used?

The x86 FPU has built-in commands to load seven constants. They are 0.0, 1.0, pi, ln(2), log2(e), log(2), and log2(10). The last four are used because the FPU can calculate only log2(x) and 2^x directly; multiplying with the right constant before/after the log2/2^x operation yields e^x, ln(x), log(x) and 10^x.

The values of the last four constants in the code were a little on the short side for an 80 bit number (that's the native precision of the x87 FPUs) - I should've read the code more closely to discover that the FPU emulation is limited to 64 bit on non-x86 host systems. So basically the patch is worthless unless and until the FPU emulation is extended to more than 64 bit precision on non-x86 hosts.

tearex