<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/99497>99497</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
std::remainder(x,y) and std::remquo(x, y, z) are not optimized at the compilation time when (x, y) is constant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Consider the following example.
https://godbolt.org/z/94qo7q4vd
```cpp
#include <cmath>
double f1()
{
return std::fmod(-5.0, 3.0);
}
double f2()
{
return std::remainder(-5.0, 3.0);
}
double f3()
{
int quo;
return std::remquo(-5.0, 3.0, &quo);
}
```
The above `f2()` is optimized when `-ffast-math` is enabled.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU9FyozoM_Rrx4gkDshPqBx7a9PIF9wcMFsG7xqa2Sdp-_Y5Juu1087A7w9iMdaQjHUkqRnNyRC3sn2D_XKg1TT60P3cqBH-JRe_1W3v0LhpNgaWJ2Oit9RfjToxe1bxYKqF6hupxSmmJwB8BO8Du5HXvbSp9OAF274CdFC--eRFnfYXDobp-w7LcXpAbN9hVEwN-HGaVJuD_3Wzbqf3aW2JjDfgAKNnN1jxdfxgLlNbgWEw6J8Ifx9lrwIfdvqwAj4znSwJ_-nB8vhcd_zZ6oFkZpyn8MwW_UvzBYFxiL6v_7X6XMwO-ER4Z4GF7v0f9ofTXTP6fiKnen4nBofooGQ4VM5H5JZnZvJNml4lcBuzGUcW021pyxZBTvSVdFrrlWnKpCmrrBmteYyNEMbVjjVqKuh5R84OqK0VSklZ7OYxEWlBhWqxQVE39UAvcC1FyLZREXat9xQWqBkSVBbaltec5D1JhYlyplVLIprCqJxu3sUV0dGGbERDzFIc2--z69RRBVNbEFD-jJJMstXe7-Ap4fMu9V07f0Tyb2Vs-3jdQIOZ8-qKXStuKDH5ejFXJeMeSmemm42cAmSUcvItJuVSswbbftsekae3Lwc-AXU78du2W4H_QkAC7rdyY92qT49zirwAAAP__XGcZMA">