Agner`s CPU blog

Software optimization resources | E-mail subscription to this blog | www.agner.org

 
single message New IEEE 754 Floating point standard - Agner - 2019-07-27
 
New IEEE 754 Floating point standard
Author: Agner Date: 2019-07-27 01:18
A new revision of the official IEEE 754 Standard for Floating-Point Arithmetic has been published this week. The new standard IEEE 754-2019 supersedes IEEE 754-2008 and IEEE 754-1985.


You may order the new standard from a science library if you don't want to pay the 98$ that they are selling it for.


There are only few significant changes. A few new functions are defined: tanPi, aSinPi, and aCosPi.


An important change is that the minimum and maximum functions are changed so that they are sure to propagate NANs, while the 2008 version made the illogical decision that minimum and maximum should return a non-NAN if one of the inputs is a NAN and the other is a non-NAN number. I would like to see this change implemented in new hardware instructions. The current implementation of min and max in SSE and later instruction sets are conforming neither to the 2008 standard nor to the new 2019 standard. Instead, minps(A,B) is equivalent to A < B ? A : B, and maxps(A,B) is equivalent to A > B ? A : B. These functions will return B if A or B is a NAN because all comparisons with a NAN return false.


Unfortunately, some problems remain with the new 2019 standard. It is illogical that A+B and B+A are not giving the same result when A and B are both NANs with different payloads. I tried to convince the working committee to fix this problem, but they could not agree on which of the possible solutions to choose. I have discussed this problem in the document www.agner.org/optimize/nan_propagation.pdf.


In the same document, I have discussed how current systems rely on exceptions and fault trapping rather than NAN propagation for detecting floating point errors. Fault trapping is inconvenient and inefficient with the current trend of parallel execution, out-of-order execution, and vector instructions (SIMD). The new 2019 standard does not deal with the problems of parallel execution.


It is planned that the next revision of the IEEE floating point standard will be made ten years from now.