[libcxx] Improve accuracy of complex asinh and acosh
authorMikhail Maltsev <mikhail.maltsev@arm.com>
Mon, 19 Feb 2018 15:41:36 +0000 (15:41 +0000)
committerMikhail Maltsev <mikhail.maltsev@arm.com>
Mon, 19 Feb 2018 15:41:36 +0000 (15:41 +0000)
commit477b5f688c80064753827693c16d49957d3a3a95
tree19c3ec8c8ef9a89cfa83273a5476ee1a3b62c8da
parent9b2aa42f00253d5a5fd8153bfb28481a62beb8d9
[libcxx] Improve accuracy of complex asinh and acosh

Summary:
Currently std::asinh and std::acosh use std::pow to compute x^2. This
results in a significant error when computing e.g. asinh(i) or
acosh(-1).

This patch expresses x^2 directly via x.real() and x.imag(), like it
is done in libstdc++/glibc, and adds tests that checks the accuracy.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: christof, cfe-commits

Differential Revision: https://reviews.llvm.org/D41629

llvm-svn: 325510
libcxx/include/complex
libcxx/test/libcxx/numerics/complex.number/__sqr.pass.cpp [new file with mode: 0644]
libcxx/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
libcxx/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp