Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use custom sqrt if stdc++ does not fall back to C99 csqrt (pytorch#54820
) Summary: Pull Request resolved: pytorch#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
- Loading branch information