Hi, 

> On Mar 16, 2023, at 12:53 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> 
> On Thu, Mar 16, 2023 at 04:38:41PM +0000, Qing Zhao via Gcc-patches wrote:
>>> NO. We have this debate every few years and such.
>> 
>> So, what’s the major reason we keep the default  that is not IEEE754 
>> compliant from the beginning? 
> 
> It is compliant.  fusedMultiplyAdd is a standard IEEE 754 operation,

After checking the IEEE754, IEEE standard for Floating-Point Arithmetic, 
fusedMultiplyAdd is clearly documented:

"
fusedMultiplyAdd: The operation fusedMultiplyAdd(x, y, z) computes (x×y)+z as 
if with unbounded
range and precision, rounding only once to the destination format.
"

> and
> C explicitly allows contractions.

However, I failed to locate where in C standard the fusedMultiplyAdd is allowed.

I got the draft version of C89, C99 and C11 from the following links:
        • C89 – Draft version in ANSI text format: 
(https://web.archive.org/web/20161223125339/http://flash-gordon.me.uk/ansi.c.txt)
        • C89 – Draft version as HTML document: 
(http://port70.net/~nsz/c/c89/c89-draft.html)
        • C99 – Draft version (N1256) as HTML document: 
(http://port70.net/~nsz/c/c99/n1256.html)
        • C11 – Draft version (N1570) as HTML document: 
(http://port70.net/~nsz/c/c11/n1570.html)

In both C99 and C11, I Only found the following section:

http://port70.net/%7Ensz/c/c99/n1256.html#7.12.13:

====
7.12.13 Floating multiply-add

7.12.13.1 The fma functions

Synopsis

1

         #include <math.h>

         double fma(double x, double y, double z);
         float fmaf(float x, float y, float z);
         long double fmal(long double x, long double y,
              long double z);

Description

2 The fma functions compute (x y) + z, rounded as one ternary operation: they 
compute the value (as if) to infinite precision and round once to the result 
format, according to the current rounding mode. A range error may occur.

Returns

3 The fma functions return (x y) + z, rounded as one ternary operation.
====

My question: is the above section the place in C standard “explicitly allows 
contractions”? If not, where it is in C standard?

Another question to ARM port maintainers is:

Is fmadd instruction provided by Aarch64 architecture IEEE754 compliant? 

Thanks a lot for your help.

Qing


> 
>       Jakub
> 

Reply via email to