From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20442 invoked by alias); 15 Jan 2006 15:44:08 -0000 Received: (qmail 20424 invoked by uid 22791); 15 Jan 2006 15:44:08 -0000 X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 15 Jan 2006 15:44:05 +0000 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 00B81E9CB for ; Sun, 15 Jan 2006 16:44:00 +0100 (CET) Received: from aj by arthur.inka.de with local (Exim 4.51) id 1EyA2r-00046J-EP for libc-hacker@sources.redhat.com; Sun, 15 Jan 2006 16:43:53 +0100 From: Andreas Jaeger To: Glibc hackers Subject: BZ#2153: cacosh bug OpenPGP: id=C272A126; url=http://www.suse.de/~aj/keys.txt Date: Sun, 15 Jan 2006 15:44:00 -0000 Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00065.txt.bz2 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 12991 The appended patch fixes BZ#2153. Ok to commit? I only updated the ulps file for x86-64, other archs might need a similar change. Andreas 2006-01-15 Andreas Jaeger * sysdeps/x86_64/fpu/libm-test-ulps: Updated. BZ #2153 * math/s_cacosh.c (__cacosh): Do not return a negative value. Patch by Wes Loewer . * math/s_cacoshl.c (__cacoshl): Likewise. * math/s_cacoshf.c (__cacoshf): Likewise. * math/libm-test.inc (cacosh_test): Add new testcases and fix existing ones. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: math/s_cacosh.c --- math/s_cacosh.c 14 Dec 2005 10:12:27 -0000 1.1 +++ math/s_cacosh.c 15 Jan 2006 15:43:35 -0000 @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for double value. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. =20 @@ -73,6 +73,9 @@ __cacosh (__complex__ double x) =20 y =3D __csqrt (y); =20 + if (__real__ x < 0.0) + y =3D -y; + __real__ y +=3D __real__ x; __imag__ y +=3D __imag__ x; =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: math/s_cacoshf.c --- math/s_cacoshf.c 14 Dec 2005 10:12:45 -0000 1.1 +++ math/s_cacoshf.c 15 Jan 2006 15:43:35 -0000 @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for float value. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. =20 @@ -75,6 +75,9 @@ __cacoshf (__complex__ float x) =20 y =3D __csqrtf (y); =20 + if (__real__ x < 0.0) + y =3D -y; + __real__ y +=3D __real__ x; __imag__ y +=3D __imag__ x; =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: math/s_cacoshl.c --- math/s_cacoshl.c 14 Dec 2005 10:13:05 -0000 1.1 +++ math/s_cacoshl.c 15 Jan 2006 15:43:35 -0000 @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. =20 @@ -73,6 +73,9 @@ __cacoshl (__complex__ long double x) =20 y =3D __csqrtl (y); =20 + if (__real__ x < 0.0) + y =3D -y; + __real__ y +=3D __real__ x; __imag__ y +=3D __imag__ x; =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: math/libm-test.inc --- math/libm-test.inc 13 Oct 2005 19:07:12 -0000 1.66 +++ math/libm-test.inc 15 Jan 2006 15:43:36 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundatio= n, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1997. =20 @@ -1116,7 +1116,11 @@ cacosh_test (void) TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value); =20 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, = 1.11752014915610270578240049553777969L); - TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414= 491111159960199416055713254211L); + TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414= 491111159960199416055713254211L); + TEST_c_c (cacosh, 0.3, 0.4, 0.405112337178030872507338405200229579L, 1.2= 9016676450309079292712537938218583L); + TEST_c_c (cacosh, -0.3, 0.4, 0.405112337178030872507338405200229579L, 1.= 85142588908670244553551800389731705L); + TEST_c_c (cacosh, 0.3, -0.4, 0.405112337178030872507338405200229579L, -1= .29016676450309079292712537938218583L); + TEST_c_c (cacosh, -0.3, -0.4, 0.405112337178030872507338405200229579L, -= 1.85142588908670244553551800389731705L); =20 END (cacosh, complex); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: sysdeps/x86_64/fpu/libm-test-ulps --- sysdeps/x86_64/fpu/libm-test-ulps 20 Jul 2005 18:15:21 -0000 1.10 +++ sysdeps/x86_64/fpu/libm-test-ulps 15 Jan 2006 15:43:36 -0000 @@ -48,20 +48,54 @@ ildouble: 2 ldouble: 2 =20 # cacosh -Test "Real part of: cacosh (-2 - 3 i) =3D=3D -1.98338702991653543234707690= 28940395 + 2.1414491111159960199416055713254211 i": +Test "Real part of: cacosh (-0.3 + 0.4 i) =3D=3D 0.40511233717803087250733= 8405200229579 + 1.85142588908670244553551800389731705 i": +float: 1 +ifloat: 1 +ildouble: 735 +ldouble: 735 +Test "Imaginary part of: cacosh (-0.3 + 0.4 i) =3D=3D 0.405112337178030872= 507338405200229579 + 1.85142588908670244553551800389731705 i": +ildouble: 119 +ldouble: 119 +Test "Real part of: cacosh (-0.3 - 0.4 i) =3D=3D 0.40511233717803087250733= 8405200229579 - 1.85142588908670244553551800389731705 i": +float: 1 +ifloat: 1 +ildouble: 735 +ldouble: 735 +Test "Imaginary part of: cacosh (-0.3 - 0.4 i) =3D=3D 0.405112337178030872= 507338405200229579 - 1.85142588908670244553551800389731705 i": +ldouble: 119 +Test "Real part of: cacosh (-2 - 3 i) =3D=3D 1.983387029916535432347076902= 8940395 + 2.1414491111159960199416055713254211 i": double: 1 float: 7 idouble: 1 ifloat: 7 ildouble: 6 ldouble: 6 -Test "Imaginary part of: cacosh (-2 - 3 i) =3D=3D -1.983387029916535432347= 0769028940395 + 2.1414491111159960199416055713254211 i": +Test "Imaginary part of: cacosh (-2 - 3 i) =3D=3D 1.9833870299165354323470= 769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 3 idouble: 1 ifloat: 3 ildouble: 1 ldouble: 1 +Test "Real part of: cacosh (0.3 + 0.4 i) =3D=3D 0.405112337178030872507338= 405200229579 + 1.29016676450309079292712537938218583 i": +float: 1 +ifloat: 1 +ildouble: 735 +ldouble: 735 +Test "Imaginary part of: cacosh (0.3 + 0.4 i) =3D=3D 0.4051123371780308725= 07338405200229579 + 1.29016676450309079292712537938218583 i": +ildouble: 118 +ldouble: 118 +Test "Real part of: cacosh (0.3 - 0.4 i) =3D=3D 0.405112337178030872507338= 405200229579 - 1.29016676450309079292712537938218583 i": +float: 1 +ifloat: 1 +ildouble: 735 +ldouble: 735 +Test "Imaginary part of: cacosh (0.3 - 0.4 i) =3D=3D 0.4051123371780308725= 07338405200229579 - 1.29016676450309079292712537938218583 i": +ildouble: 118 +ldouble: 118 +Test "Imaginary part of: cacosh (-0.3 - 0.4 i) =3D=3D 0.405112337178030872= 507338405200229579 - 1.85142588908670244553551800389731705 i": +ildouble: 119 +ldouble: 119 Test "Real part of: cacosh (0.75 + 1.25 i) =3D=3D 1.1323936316053081952226= 6333696834467 + 1.11752014915610270578240049553777969 i": ildouble: 1 ldouble: 1 @@ -103,8 +137,8 @@ double: 1 float: 1 idouble: 1 ifloat: 1 -ldouble: 1 ildouble: 1 +ldouble: 1 =20 # catan Test "Real part of: catan (-2 - 3 i) =3D=3D -1.409921049596575522530619384= 4604208 - 0.22907268296853876629588180294200276 i": @@ -168,10 +202,10 @@ ifloat: 1 ildouble: 1 ldouble: 1 Test "Imaginary part of: ccos (0.75 + 1.25 i) =3D=3D 1.3817387306342588853= 0729933139078645 - 1.09193013555397466170919531722024128 i": -ildouble: 1 -ldouble: 1 float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 =20 # ccosh Test "Real part of: ccosh (-2 - 3 i) =3D=3D -3.724545504915322565473970703= 25597253 + 0.511822569987384608834463849801875634 i": @@ -304,6 +338,9 @@ idouble: 1 ifloat: 1 =20 # cos +Test "cos (0.80190127184058835) =3D=3D 0.69534156199418473": +double: 1 +idouble: 1 Test "cos (M_PI_6l * 2.0) =3D=3D 0.5": double: 1 float: 1 @@ -323,16 +360,13 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "cos (0.80190127184058835) =3D=3D 0.69534156199418473": -double: 1 -idouble: 1 =20 # cpow Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) =3D=3D 0.33182543917= 7608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 ifloat: 1 -ldouble: 1 ildouble: 1 +ldouble: 1 Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) =3D=3D 0.331825= 439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": float: 1 ifloat: 1 @@ -380,15 +414,15 @@ ildouble: 1 ldouble: 1 =20 # csin +Test "Imaginary part of: csin (-2 - 3 i) =3D=3D -9.15449914691142957346729= 954460983256 + 4.16890695996656435075481305885375484 i": +double: 1 +idouble: 1 Test "Real part of: csin (0.75 + 1.25 i) =3D=3D 1.287222910026491885758735= 10790565441 + 1.17210635989270256101081285116138863 i": ildouble: 1 ldouble: 1 Test "Imaginary part of: csin (0.75 + 1.25 i) =3D=3D 1.2872229100264918857= 5873510790565441 + 1.17210635989270256101081285116138863 i": float: 1 ifloat: 1 -Test "Imaginary part of: csin (-2 - 3 i) =3D=3D -9.15449914691142957346729= 954460983256 + 4.16890695996656435075481305885375484 i": -double: 1 -idouble: 1 =20 # csinh Test "Real part of: csinh (-2 - 3 i) =3D=3D 3.5905645899857799520125654477= 9481679 - 0.530921086248519805267040090660676560 i": @@ -440,12 +474,12 @@ ldouble: 3 =20 # ctanh Test "Real part of: ctanh (-2 - 3 i) =3D=3D -0.965385879022133124278480269= 394560686 + 0.988437503832249372031403430350121098e-2 i": +double: 1 float: 2 +idouble: 1 ifloat: 2 ildouble: 5 ldouble: 5 -double: 1 -idouble: 1 Test "Imaginary part of: ctanh (-2 - 3 i) =3D=3D -0.9653858790221331242784= 80269394560686 + 0.988437503832249372031403430350121098e-2 i": ildouble: 25 ldouble: 25 @@ -456,10 +490,10 @@ Test "Real part of: ctanh (0.75 + 1.25 i double: 1 idouble: 1 Test "Imaginary part of: ctanh (0.75 + 1.25 i) =3D=3D 1.372607570533783202= 58048606571226857 + 0.385795952609750664177596760720790220 i": -ildouble: 1 -ldouble: 1 double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 =20 # erf Test "erf (1.25) =3D=3D 0.922900128256458230136523481197281140": @@ -481,26 +515,26 @@ ldouble: 1 =20 # exp10 Test "exp10 (-1) =3D=3D 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 ildouble: 1 ldouble: 1 +Test "exp10 (0.75) =3D=3D 5.62341325190349080394951039776481231": +double: 1 float: 1 +idouble: 1 ifloat: 1 -double: 2 -idouble: 2 -Test "exp10 (0.75) =3D=3D 5.62341325190349080394951039776481231": ildouble: 2 ldouble: 2 -float: 1 -ifloat: 1 -double: 1 -idouble: 1 Test "exp10 (3) =3D=3D 1000": -ildouble: 8 -ldouble: 8 -float: 2 -ifloat: 2 double: 6 +float: 2 idouble: 6 +ifloat: 2 +ildouble: 8 +ldouble: 8 =20 # expm1 Test "expm1 (0.75) =3D=3D 1.11700001661267466854536981983709561": @@ -714,12 +748,12 @@ ldouble: 1 =20 # log10 Test "log10 (0.75) =3D=3D -0.124938736608299953132449886193870744": -ildouble: 1 -ldouble: 1 -float: 2 -ifloat: 2 double: 1 +float: 2 idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 Test "log10 (e) =3D=3D log10(e)": float: 1 ifloat: 1 @@ -732,6 +766,9 @@ float: 1 ifloat: 1 =20 # sincos +Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.695341561994= 18473 in cos_res": +double: 1 +idouble: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 float: 1 @@ -754,9 +791,6 @@ ldouble: 1 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646763723170= 75293616 in cos_res": float: 1 ifloat: 1 -Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.695341561994= 18473 in cos_res": -double: 1 -idouble: 1 =20 # tan Test "tan (pi/4) =3D=3D 1": @@ -970,16 +1004,16 @@ double: 1 float: 7 idouble: 1 ifloat: 7 -ildouble: 6 -ldouble: 6 +ildouble: 735 +ldouble: 735 =20 Function: Imaginary part of "cacosh": double: 1 float: 3 idouble: 1 ifloat: 3 -ildouble: 1 -ldouble: 1 +ildouble: 119 +ldouble: 119 =20 Function: Real part of "casin": double: 1 @@ -1178,12 +1212,12 @@ ildouble: 5 ldouble: 5 =20 Function: Imaginary part of "ctanh": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 25 ldouble: 25 -double: 1 -idouble: 1 =20 Function: "erf": double: 1 @@ -1196,12 +1230,12 @@ ildouble: 1 ldouble: 1 =20 Function: "exp10": -ildouble: 8 -ldouble: 8 -float: 2 -ifloat: 2 double: 6 +float: 2 idouble: 6 +ifloat: 2 +ildouble: 8 +ldouble: 8 =20 Function: "expm1": double: 1 @@ -1250,12 +1284,12 @@ ildouble: 1 ldouble: 1 =20 Function: "log10": +double: 1 float: 2 +idouble: 1 ifloat: 2 ildouble: 1 ldouble: 1 -double: 1 -idouble: 1 =20 Function: "log1p": float: 1 --=20 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GPG fingerprint =3D 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 --=-=-= Content-Type: application/pgp-signature Content-length: 188 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDym25OJpWPMJyoSYRAi9zAKCIbUeEl1NlftTkc0ehV8I4iJeBpwCfUvGf gPgwXECHlkYOknUF7284h/c= =ljAC -----END PGP SIGNATURE----- --=-=-=--