@[2018LZY](/user/118826) 你试试将 `hypot(x, y)` 换成 `hypot((long double)x, (long double)y)` 呢?
by robinyqc @ 2023-12-30 22:21:57
感觉可能是 long double 和 double 的精度差异?
比如如下代码放到洛谷在线 IDE 跑:
```cpp
#include <cmath>
#include <iostream>
using namespace std;
signed main()
{
cout.precision(18);
long long x = 123234560, y = 234554234;
cout << hypot(x, y) << '\n';
cout << sqrt(x * x + y * y) << '\n';
cout << sqrtl(x * x + y * y) << '\n';
cout << hypotl(x, y) << '\n';
}
```
输出是不同的。
by robinyqc @ 2023-12-30 22:30:14