-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect results of complex tan, complex tanh functions. #262
Comments
|
Here's a gnuplot plot of a slightly modified version of the code above. The errors are in entire domain.
I also made a denser plot with loops having I used following gnuplot command:
note: this problem is not present in |
You need to plot the ulp envelope to determine if those are acceptable or not. Try this: https://github.com/boostorg/math/blob/develop/include/boost/math/tools/ulps_plot.hpp Example: https://github.com/boostorg/math/blob/develop/example/airy_ulps_plot.cpp |
There's a number of issues here:
How do things look if you use |
Interestingly your test program passes under msvc even when the tolerances are reduced to say 30. I'm betting there's a hard coded value of PI at double precision in your std lib's |
Thanks, I checked that (previous) code on two versions: g++-10 (Debian 10.1.0-4) 10.1.0 with boost 1.71 They both reproduce this problem. I suppose that they use their respective stdlib's versions. Probably they use I assume that you mean
So here's a new version of the problematic code:
I tested it with g++-10 and boost 1.71, I compiled it with:
Here's the result:
The problem disappeared with |
I link here with EDIT: I forgot to take the absolute value of |
I see the issue: if we take Interestingly, if we evaluate at double precision using |
I wonder why it works for |
Both, I think. |
I almost identified a couple of similar errors for non-complex functions of The suspects are:
All other Also MPFR 62 [2] did not have such errors, when tested with the same arguments. I am now rerunning these tests with Boost 1.71 and g++-10 to be sure that I made no mistake. If I become certain and have working short examples producing these errors, should I open another issue for that? [1] https://gitlab.com/yade-dev/trunk/-/blob/c7f833ad810afc61b647bca3e3c19f3b3d09a97c/py/high-precision/_RealHPDiagnostics.cpp#L432 |
Yes please. Note however that most of those functions have regions that
are ill-conditioned. I'm surprised about erf though.
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Fri, 7 Aug 2020 at 18:55, Janek Kozicki ***@***.***> wrote:
I *almost* identified a couple of similar errors for non-complex
functions of boost::multiprecision::number<boost::multiprecision::cpp_bin_float<62>,
boost::multiprecision::et_off> (I was testing 62 decimal places, so that
these tests will be later useful with #184
<#184>) I was testing
against boost::multiprecision::number<boost::multiprecision::cpp_bin_float<124>,
boost::multiprecision::et_off>.
The suspects are:
- sin, cos, tan with 7e7 ULP error
- acos with 10000 ULP error
- erfc with 20000 ULP error
- lgamma with 5e9 ULP error
- tgamma with 10000 ULP error
- fma with 2e5 ULP error
All other cpp_bin_float<62> functions have ULP error below 127.
Also MPFR 62 did not have such errors (so far).
I am now rerunning these tests with Boost 1.71 and g++-10 to be sure that
I made no mistake.
If I become certain and have working short examples producing these
errors, should I open another issue for that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#262 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGHSOBLZWDBXL32TEVBWMDR7Q5ZRANCNFSM4PTXWQDQ>
.
|
A glimpse of these errors is here: https://gitlab.com/cosurgi/trunk/-/jobs/676648142 and https://gitlab.com/cosurgi/trunk/-/jobs/676832836 but in that pipeline these are shorter tests, and they are done on Please ignore the EDIT: this is the same test on MPFR 150: https://gitlab.com/cosurgi/trunk/-/jobs/676625239 and https://gitlab.com/cosurgi/trunk/-/jobs/676832835 |
Hi @jzmaddock , I followed your advice to use float_distance when measuring ULP error. I have implemented this check. For nearly all functions it was enough to set tolerance of 8 ULP with two notable excepions: real part of
tan
and imag part oftanh
functions. See the pipeline warnings (scroll up the output to around line 360):Here is a short snippet to reproduce these errors:
Here I print only ULP errors larger than 290000000, otherwise it's a real flood. And all other functions pass with ULP error < 8 (except for cpp_bin_float - there I've set the limit to 200 with some exceptions for tgamma and lgamma).
Looks like I have stumbled upon a pretty large bug :).
This sample program produces following output:
The text was updated successfully, but these errors were encountered: