<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/208344>208344</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`#pragma float_control(precise, on)` behavior doesn't agree with docs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Marc-B-Reynolds
</td>
</tr>
</table>
<pre>
Given `-ffast-math` on command line: doesn't honor infinites, NaNs, setting errno and only respects any following `#pragma clang fp contract` in limited cases (see below)
https://godbolt.org/z/4z3PMEePc
local copy:
```c
#include <math.h>
// docs claim: -ffast-math turned off, -ffp-contract=on & -fmath-errno
#pragma float_control(precise,on)
int is_ordered(float x) { return x == x; } // not respecting NaNs
int is_inf(float x) { return isinf(x); } // not respecting inf
float my_sqrt(float x) { return sqrtf(x); } // good answer IMHO but not what doc's say
// correct to documentation: fusing on
float madd0(float a, float b, float c) { return a*b+c; }
// strange case: the pragma is respect if -ffp-contract={on, off, fast-honor-pragmas}
// is on the command line. But anyway: again not agreeing with documentation.
// we should be equivalent to -ffp-contract=on at this point..so this should be respected
// by my reading.
#pragma clang fp contract(off)
float madd1(float a, float b, float c) { return a*b+c; }
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVE2T4jYQ_TXNpcuUkAcMBx9gZklymM1W_sCUPtq2UrLESvIw7K9PyfbAMLvJKRRVNqj7dfd7rSdiNK0jqmF9gPXTQgyp86F-FkEVh-IvujhvdVxIry_1b-aVHMKGFU0jYip6kTrYMPQOle974TRa4wjKPaL2FB3wKmHnnQ9oXGOcSRSBP-JX8XV8RkrJuBYpBOcx53tnLxgonkiliMJdsPHW-nOOgg0DXp6CaHuBygrXYnNC5V0KQqXciHFoTW8SaVQiUkTg20iEkqw_A98B2wPbdymdIpR74Efgx9Zr6W1a-tACP_4Afnz4UX57_kLf1BRuvRIWlT9dcs74V-5k_I4hvDRO2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