Bug 16815 - PowerPC: nearbyint/nearbyintf bogus result for FE_DOWNWARD
Summary: PowerPC: nearbyint/nearbyintf bogus result for FE_DOWNWARD
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: 2.20
Assignee: Adhemerval Zanella Netto
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-06 19:43 UTC by Adhemerval Zanella Netto
Modified: 2014-06-12 19:46 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adhemerval Zanella Netto 2014-04-06 19:43:59 UTC
Optimized PowerPC 32-bits nearbyint/nearbyintf show bogus results for FE_DOWNWARD rounding mode, as shown by math failing tests:

testing double (without inline functions)
Failure: Test: nearbyint_downward (-0.5)
Result:
 is:          0.00000000000000000000e+00   0x0.00000000000000000000p+0
 should be:  -1.00000000000000000000e+00  -0x1.00000000000000000000p+0
 difference:  1.00000000000000000000e+00   0x1.00000000000000000000p+0
 ulp       :  4503599627370496.0000
 max.ulp   :  0.0000
Failure: Test: nearbyint_downward (-1.5)
Result:
 is:         -1.00000000000000000000e+00  -0x1.00000000000000000000p+0
 should be:  -2.00000000000000000000e+00  -0x1.00000000000000000000p+1
 difference:  1.00000000000000000000e+00   0x1.00000000000000000000p+0
 ulp       :  2251799813685248.0000
 max.ulp   :  0.0000
Failure: Test: nearbyint_downward (-2.5)
Result:
 is:         -2.00000000000000000000e+00  -0x1.00000000000000000000p+1
 should be:  -3.00000000000000000000e+00  -0x1.80000000000000000000p+1
 difference:  1.00000000000000000000e+00   0x1.00000000000000000000p+0
 ulp       :  2251799813685248.0000
 max.ulp   :  0.0000
Failure: Test: nearbyint_downward (-3.5)
Result:
 is:         -3.00000000000000000000e+00  -0x1.80000000000000000000p+1
 should be:  -4.00000000000000000000e+00  -0x1.00000000000000000000p+2
 difference:  1.00000000000000000000e+00   0x1.00000000000000000000p+0
 ulp       :  1125899906842624.0000
 max.ulp   :  0.0000
Failure: Test: nearbyint_downward (-4.5)
Result:
 is:         -4.00000000000000000000e+00  -0x1.00000000000000000000p+2
 should be:  -5.00000000000000000000e+00  -0x1.40000000000000000000p+2
 difference:  1.00000000000000000000e+00   0x1.00000000000000000000p+0
 ulp       :  1125899906842624.0000
 max.ulp   :  0.0000

These are not all the failing tests, just an except.
Comment 1 Adhemerval Zanella Netto 2014-04-06 19:44:35 UTC
The same optimized implementation for PowerPC64 does not shown any issue in any rounding mode.
Comment 2 Adhemerval Zanella Netto 2014-04-06 20:11:09 UTC
Fixed by 8bd70862e11023e7f827f240a5a214f847ae982d.