5 ms·
Nobody uses the x87 instructions any more, they've been superseded by MMX/SSE/SSE2 which can't do 80-bit operations. And it's not clear whether 80 bits would b
by mark-r 5y ago
Nobody uses the x87 instructions any more, they've been superseded by MMX/SSE/SSE2 which can't do 80-bit operations. And it's not clear whether 80 bits would be enough of an improvement over 64 to fix the problem.
- ip26 5y agoI’m confused, why does it matter if nobody else uses them, if you need 80 bits of precision? Do more people use SANE?
- mark-r 5y agoPart of the problem is that 80 bit operations were never designed to be a visible data type, you were expected to round to a 64 bit type at the end of a series of operations. There was never a good way of indicating to your compiler where and when those transitions would happen.
- Sesse__ 5y agoNot so strange, as they were never intended to be used for compilers to begin with (you'd write assembler code by hand). The basic idea with having 80-bit internal precision is that you could load your 64-bit values from RAM, compute on them with so much extra precision you could basically ignore precision issues within your expressions, and then store the result back correctly rounded.
- deleted 5y ago[deleted]
- radford-neal 5y agoCurrent x87 processors still can do 80-bit arithmetic. For example: #include <stdio.h> int main(void) { long double ld; double d; ld = 1000; ld = ld/3; d = 1000; d = d/3; printf("%.16g %.16g\n",(double)(ld-333),d-333); return 0; } produces the following output: 0.3333333333333334 0.3333333333333144 The 80-bit long double type gives higher accuracy. This is on an AMD Threadripper PRO 3945WX using gcc 9.4.0.
- mhh__ 5y agoD (dlang.org) has a "real" type alongside float and double which represents the widest float available on the target (so 80bits if x87 is available). It does see some use. (But don't use it without a valid reason or your program is going to be slow because no SIMD)
- Someone 5y ago> a "real" type alongside float and double which represents the widest float available on the target Initial question: what would that be on a system without hardware floating point? Luckily, https://dlang.org/spec/type.html https://dlang.org/spec/type.html says (not 100% unambiguously) it isn’t necessarily “the widest float available on the target“, but either that or, if that doesn’t have both the range and precision of double, double. So, if you decide to use it, you’re guaranteed not to give up range or precision, may gain some, but also may give up performance.
- vardump 5y agoA slight correction, no one uses MMX anymore. It's all SSE and AVX (wider and more comprehensive instruction set) nowadays.
- mark-r 5y agoI knew that, but I wanted to give the whole progression.
- Sesse__ 5y agoMMX isn't a successor to x87, though; it only happens to share its registers, because that allowed them to work without changing the OS. It does integer math only. SSE was the first Intel x86 vector instruction set to do single-precision floats (AMD had 3DNow!, but it was little used), but didn't really include much integer support for the newer, wider vectors (that came back only with SSE2).
- gnufx 5y ago> Nobody uses the x87 instructions any more Check the current GCC code from inlined fmod (e.g. -Ofast). Whether that's appropriate is the question.