<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92782>92782</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Incorrect overflow in std::hypot
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
efriedma-quic
</td>
</tr>
</table>
<pre>
Consider:
```
#include <cmath>
float f = std::hypot(1e20f,1e20f,1e20f);
```
With libc++, this produces +inf. Other libraries appear to handle this correctly. (The C standard suggests hypot() should return a result "without undue overflow or underflow"... although that only applies to the two-argument form).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUsGK3DAM_RrnIiYkcjKTHHLYme1AT70UenZsJXZx4tSWd5m_L5mZZctSEBKSpefH46mU3LwSDaI9i_a1UJltiANN0ZFZ1OFPdroYg7kNl7AmZygK-SKqV1F95GP1jEeL0q3aZ0Mg5EUviq2Q3x5vkw-KYQIhXyGx2YHki71tgQV2NWE1Cbx8qb2Q5_9_dM-_HFvwbtQCz_e4AFuXYIvBZE0JBJ7dOpUAP9hS3Fejio4SqG0jFYEDWLUaT487HWIkzf5WgsDupyW4QGK1GhUNpDzPlDjBB2eBPSQbsjcQiXNcQUGklD2DQHx3bENmyKvJBOGN4uTDO4S4Tx6NQCzLEpTfN2cLbBVDWP1tp-d3mhyALQG_h4OKc15oZZhCXAT2ZWEGaXrZq4KG-lQfERHbvrADnbpTV-tmlFPbdij7Y99WdS3bWo9d21eFG7DCpmqxqo_Y1H3ZNlrLuh6PDSrUPYmmokU5X3r_tpQhzoVLKdPQ46nDwquRfLpbBvFf9XG3UBz2o8OY5ySayrvE6ROGHXsavq9PoT9lcesXTxQ5-sEyb2kf4lXgdXZs81jqsAi87pDPcthi-E2aBV7vNJPA653p3wAAAP__Sr3lzw">