6 ms·
use 80 bits? https://en.wikipedia.org/wiki/Standard_Apple_Numerics_Environment https://en.wikipedia.org/wiki/Standard_Apple_Numerics_Enviro...
by mistrial9 5y ago
use 80 bits? https://en.wikipedia.org/wiki/Standard_Apple_Numerics_Environment https://en.wikipedia.org/wiki/Standard_Apple_Numerics_Enviro...
- liversage 5y agoOr 128 bits. FORTRAN has a REAL*16 type (quadruple precision floating point number). I encountered this at university in a physics department that studied non- linear systems also known as chaos theory. Rounding errors can quickly become a problem in these systems.
- gnufx 5y ago> FORTRAN has a REAL16 type Fortran (note the post-'77 spelling) doesn't. It has KINDs. REALx is a non-standard extension, and there's definitely no requirement to implement 128-bit floating point. I don't know what hardware other than POWER has hardware 128-bit FP (both IEEE and IBM format, with a somewhat painful recent change of the ppc64le ABI default in GCC etc.).
- thanatos519 5y agoGCC also has libquadmath which provides 128-bit floats by sticking 2 64-bit floats together. More than twice as slow, but extra precision just by changing a type and linking the library. Works great in XaoS, which is where I like my extra precision, but a deep fractal zoom can consume as much precision as you can muster. Imagine a 64kbit-precision Mandelbrot zoom!
- aragilar 5y agoThe main use of libquadmath seems to be to support gfortran. GCC/glibc also support _Float128 and <func>f128, which are nominally part of C, but only GCC implements them as far as I know.
- ip26 5y agoI believe x87 still offers 80 bits in your PC today.
- mark-r 5y agoNobody 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.
- aSanchezStern 5y agoThis is actually fewer bits than they're using in the article, but that's not clear because they refer to their numbers by how many "[decimal] digits", not how many bits. The hardware doubles they're starting with are 64-bits wide, representing 15.5 decimal digits, but then they move into 128- and 256-bit representations. 80-bit math, such as that available on the old x87 floating point co-processors, is I believe about 21 decimal digits.
- shmageggy 5y agoI found that very unintuitive. Is it typical in numerical analysis to talk about the number of decimal digits represented by a binary floating point number? I don't see what is gained by changing base.
- erosenbe0 5y agoIt's a bad idea, or okay as an informal thing! It is just using the result that Log10(2^53) is 15.95 to say that 53 bits has 15.95 digits of 'information.'