| Summary: | tan(pi/2) eval requires too much time | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Gerard Torrent <gerard> | ||||
| Component: | glibc | Assignee: | Jeff Law <law> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 16 | CC: | fweimer, jakub, law, schwab | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2012-02-07 18:24:32 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
This is the same as: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3783 In a nutshell, glibc's tan implementation first computes the result using FPU instructions. if the maximum error is sufficiently low that result is returned. Obviously this is fast. If the error is potentially > than 0.5ulp, then glibc falls back to a more expensive algorithm to compute the result. For tan, values such as pi/2 multiples will trigger the need to use the slower algorithm, thus the significantly longer times. |
Created attachment 551534 [details] tan(pi/2) eval requires too much time Description of problem: tan(x) evaluated at x = k*M_PI/2 where k=1,2,3,... or k=-1,-2,-3,... requires 2 orders of magnitude more time than in the other cases. Version-Release number of selected component (if applicable): gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) glibc-2.14.90-24.fc16.4.x86_64 How reproducible: compiling and executing the attached source code Steps to Reproduce: 1. gcc -O2 tan-pi-div-2.c -lm 2. ./a.out > data.txt 3. gnuplot (plot "data.txt" using 1:2 with lines) Actual results: peaks at pi/2 multiples Expected results: all values in the same range Additional info: see attached file