public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1
@ 2011-05-19 15:49 bert.barbe at oracle dot com
  2011-05-20 13:31 ` [Bug math/12786] " bert.barbe at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bert.barbe at oracle dot com @ 2011-05-19 15:49 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

           Summary: cacosh sometimes returning wrong result for real
                    values between -1 and 1
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj@suse.de
        ReportedBy: bert.barbe@oracle.com


Created attachment 5738
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5738
test program

After the fix for http://sourceware.org/bugzilla/show_bug.cgi?id=2182
cacosh, cacoshf and cacoshl can return results with the wrong sign when
the argument is a real value between -1 and 1.
This is because due to rounding errors, the real part of the result is a small
negative value instead of 0. The fix for bz2182 will change the sign of the
result because the real part is negative.

Note that the formula w=clogf(z+ csqrtf(z+1) * csqrtf (z -1)) of other
implementations does give the correct sign right away.

Some examples on a x86_64 linux , Intel(R) Xeon(R) CPU  5160 ,
glibc-2.12-1.7.el6.x86_64:

*** z=-0.680000 + 0.000000*i   cacoshf(z)=+5.960464e-08  -2.318559e+00 *i
*** z=-0.670000 + 0.000000*i   cacoshf(z)=+5.960464e-08  -2.305006e+00 *i
*** z=-0.580000 + 0.000000*i   cacoshf(z)=+5.960464e-08  -2.189526e+00 *i
*** z=-0.570000 + 0.000000*i   cacoshf(z)=+5.960464e-08  -2.177303e+00 *i

Attached is a test program that will print the cacosh values for real arguments
between -1 and +1 , at interval 0.01 and indicate the results with a wrong sign
with "***"

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
@ 2011-05-20 13:31 ` bert.barbe at oracle dot com
  2011-05-20 14:47 ` carlos at codesourcery dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bert.barbe at oracle dot com @ 2011-05-20 13:31 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

--- Comment #1 from Bert Barbe <bert.barbe at oracle dot com> 2011-05-20 13:31:06 UTC ---
Created attachment 5740
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5740
proposed patch for 2.13 release

Also verified problem in glibc release 2.13. Proposed patch for 2.13 for
cacoshf. If agreed, similar patch needs to be applied to cacosh and cacoshl.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
  2011-05-20 13:31 ` [Bug math/12786] " bert.barbe at oracle dot com
@ 2011-05-20 14:47 ` carlos at codesourcery dot com
  2011-06-09 15:18 ` carlos at systemhalted dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: carlos at codesourcery dot com @ 2011-05-20 14:47 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

Carlos O'Donell <carlos at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |glibc_2.13
                 CC|                            |carlos at codesourcery dot
                   |                            |com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
  2011-05-20 13:31 ` [Bug math/12786] " bert.barbe at oracle dot com
  2011-05-20 14:47 ` carlos at codesourcery dot com
@ 2011-06-09 15:18 ` carlos at systemhalted dot org
  2011-11-23  9:05 ` kreckel at ginac dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: carlos at systemhalted dot org @ 2011-06-09 15:18 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

Carlos O'Donell <carlos at systemhalted dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at systemhalted dot
                   |                            |org

--- Comment #2 from Carlos O'Donell <carlos at systemhalted dot org> 2011-06-09 15:18:14 UTC ---
Has this been fixed in trunk yet?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
                   ` (2 preceding siblings ...)
  2011-06-09 15:18 ` carlos at systemhalted dot org
@ 2011-11-23  9:05 ` kreckel at ginac dot de
  2011-12-23 15:59 ` drepper.fsp at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kreckel at ginac dot de @ 2011-11-23  9:05 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

Richard B. Kreckel <kreckel at ginac dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kreckel at ginac dot de

--- Comment #3 from Richard B. Kreckel <kreckel at ginac dot de> 2011-11-23 09:04:57 UTC ---
(In reply to comment #1)
> Created attachment 5740 [details]
> proposed patch for 2.13 release

That patch only fixes a symptom and not the cause. A better patch has been
attached to BZ 13305.

The rounding errors in cacosh[fl] are a completely different problem and should
be analyzed and fixed separately. They are due to the argument of the final
clog(y) being close to 1. The instability of log(1+x) for small x are
well-known and have lead to the log1p function. I believe the rounding errors
in cacosh[fl] would go away if the clog(y) would be replaced by clog1p(y), if
that would exist.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
                   ` (3 preceding siblings ...)
  2011-11-23  9:05 ` kreckel at ginac dot de
@ 2011-12-23 15:59 ` drepper.fsp at gmail dot com
  2011-12-23 16:03 ` drepper.fsp at gmail dot com
  2014-06-27 13:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-12-23 15:59 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5738|application/octet-stream    |text/plain
          mime type|                            |

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
                   ` (4 preceding siblings ...)
  2011-12-23 15:59 ` drepper.fsp at gmail dot com
@ 2011-12-23 16:03 ` drepper.fsp at gmail dot com
  2014-06-27 13:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-12-23 16:03 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12786

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |drepper.fsp at gmail dot
                   |                            |com
         Resolution|                            |DUPLICATE

--- Comment #4 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-12-23 16:02:28 UTC ---
Already fixed in another BZ

*** This bug has been marked as a duplicate of bug 13305 ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug math/12786] cacosh sometimes returning wrong result for real values between -1 and 1
  2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
                   ` (5 preceding siblings ...)
  2011-12-23 16:03 ` drepper.fsp at gmail dot com
@ 2014-06-27 13:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 13:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12786

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-27 13:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 15:49 [Bug math/12786] New: cacosh sometimes returning wrong result for real values between -1 and 1 bert.barbe at oracle dot com
2011-05-20 13:31 ` [Bug math/12786] " bert.barbe at oracle dot com
2011-05-20 14:47 ` carlos at codesourcery dot com
2011-06-09 15:18 ` carlos at systemhalted dot org
2011-11-23  9:05 ` kreckel at ginac dot de
2011-12-23 15:59 ` drepper.fsp at gmail dot com
2011-12-23 16:03 ` drepper.fsp at gmail dot com
2014-06-27 13:20 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).