public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/2182] New: cacosh() will not always return correct value after bug#2181 is fixed
@ 2006-01-19 18:31 wjltemp-temp01 at yahoo dot com
  2006-04-23 17:21 ` [Bug libc/2182] " drepper at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: wjltemp-temp01 at yahoo dot com @ 2006-01-19 18:31 UTC (permalink / raw)
  To: glibc-bugs

After csqrt() is fixed (see bug #2181), cacosh(x+y*I) will return incorrect
values whenever (x<0) or whenever (x=0 and y<0).

I now realize that my previously suggested cacosh() patch (see bug#2153) only
adjusts for the csqrt() bug that was masking the other problem.

Going back to the original, pre-patched s_cacosh.c (s_cacoshf.c, s_cacoshl.c)

------------- unpatched s_cacosh.c near line 67 --------------
  else
    {
      __complex__ double y;

      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
      __imag__ y = 2.0 * __real__ x * __imag__ x;

      y = __csqrt (y);

      __real__ y += __real__ x;
      __imag__ y += __imag__ x;

      res = __clog (y);
    }

---------------------------------------------

since cacosh(x+y*I) gives the wrong result when (x<0) or when (x=0 and y<0),
both of these problems can be corrected by adding

------------- suggested s_cacosh.c near line 67 --------------
  else
    {
      __complex__ double y;

      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
      __imag__ y = 2.0 * __real__ x * __imag__ x;

      y = __csqrt (y);

      __real__ y += __real__ x;
      __imag__ y += __imag__ x;

      res = __clog (y);

>>>   if (__real__ res < 0.0)
>>>     res = -res;
    }

---------------------------------------------

Instead of testing y after the csqrt(), by testing res at the end it fixes the
sign problem regardless of what caused it in the first place.

One thing that should be tested is whether or not this generates negative zeros
where appropriate.

-Wes Loewer

-- 
           Summary: cacosh() will not always return correct value after
                    bug#2181 is fixed
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: aj at suse dot de
        ReportedBy: wjltemp-temp01 at yahoo dot com
                CC: glibc-bugs at sources dot redhat dot com
 BugsThisDependsOn: 2181


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2182] cacosh() will not always return correct value after bug#2181 is fixed
  2006-01-19 18:31 [Bug libc/2182] New: cacosh() will not always return correct value after bug#2181 is fixed wjltemp-temp01 at yahoo dot com
@ 2006-04-23 17:21 ` drepper at redhat dot com
  2006-04-23 17:34 ` drepper at redhat dot com
  2006-08-03 20:36 ` drepper at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2006-04-23 17:21 UTC (permalink / raw)
  To: glibc-bugs



-- 
Bug 2182 depends on bug 2181, which changed state.

Bug 2181 Summary: csqrt() sometimes returns negative real
http://sourceware.org/bugzilla/show_bug.cgi?id=2181

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2182] cacosh() will not always return correct value after bug#2181 is fixed
  2006-01-19 18:31 [Bug libc/2182] New: cacosh() will not always return correct value after bug#2181 is fixed wjltemp-temp01 at yahoo dot com
  2006-04-23 17:21 ` [Bug libc/2182] " drepper at redhat dot com
@ 2006-04-23 17:34 ` drepper at redhat dot com
  2006-08-03 20:36 ` drepper at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2006-04-23 17:34 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-04-23 17:34 -------
Test cases needed.  I'm not changing anything until we have some.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper at redhat dot com
             Status|NEW                         |WAITING


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2182] cacosh() will not always return correct value after bug#2181 is fixed
  2006-01-19 18:31 [Bug libc/2182] New: cacosh() will not always return correct value after bug#2181 is fixed wjltemp-temp01 at yahoo dot com
  2006-04-23 17:21 ` [Bug libc/2182] " drepper at redhat dot com
  2006-04-23 17:34 ` drepper at redhat dot com
@ 2006-08-03 20:36 ` drepper at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2006-08-03 20:36 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-08-03 20:36 -------
I've done research myself and applied the patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2006-08-03 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 18:31 [Bug libc/2182] New: cacosh() will not always return correct value after bug#2181 is fixed wjltemp-temp01 at yahoo dot com
2006-04-23 17:21 ` [Bug libc/2182] " drepper at redhat dot com
2006-04-23 17:34 ` drepper at redhat dot com
2006-08-03 20:36 ` drepper 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).