pytorch
68af6d95 - Use custom sqrt if stdc++ does not fall back to C99 csqrt (#54820)

Commit
3 years ago
Use custom sqrt if stdc++ does not fall back to C99 csqrt (#54820) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54820 template implementation of std::sqrt() in libstdc++ yields incorrect results for `std::complex(-std::abs(x), -0.0)`, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89991 For example: ``` #include <iostream> #include <complex> int main() { std::cout << std::sqrt(std::complex<float>(-1.0f, -0.0f)) << std::endl; } ``` prints `(0, -1)` if libstdc++ is compiled to use C99 csqrt/csqrtf fallback, but `(0, 1)` if configured not to use it. Test Plan: CI Reviewed By: luciang Differential Revision: D27379302 fbshipit-source-id: 03f614fdb7ff734139736a2a5f6872cee0173bee
Author
Parents
Loading