[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#136836: marked as done (libc6: pow(nan, 0) returns 0?)



Your message dated Thu, 02 Jan 2003 13:33:45 +0900
with message-id <80y9645fx2.wl@oris.opensource.jp>
and subject line libc6: pow(nan, 0) returns 0?
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 4 Mar 2002 21:32:22 +0000
>From joey@silk.kitenet.net Mon Mar 04 15:32:22 2002
Return-path: <joey@silk.kitenet.net>
Received: from pm3naxs5-221.access.naxs.com (silk.kitenet.net) [216.98.91.221] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 16i04A-00009G-00; Mon, 04 Mar 2002 15:32:22 -0600
Received: from joey by silk.kitenet.net with local (Exim 3.34 #1 (Debian))
	id 16i06j-0004NG-00; Mon, 04 Mar 2002 16:34:57 -0500
From: Joey Hess <joeyh@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6: pow(nan, 0) returns 0?
X-Mailer: reportbug 1.44
Date: Mon, 04 Mar 2002 16:34:57 -0500
Message-Id: <E16i06j-0004NG-00@silk.kitenet.net>
Sender: Joey Hess <joey@silk.kitenet.net>
Delivered-To: submit@bugs.debian.org

Package: libc6
Version: 2.2.5-3
Severity: normal

Looks like pow(nan, 0) returns 0. It's supposed to return nan, or maybe 1.

#include <math.h>
#include <errno.h>
main(){
        double nan = sqrt(-1.0);
        printf("isnan: %i\n", isnan(nan));
        printf("pow(nan, 0) = %d\n", pow(nan, (double) 0.0));
        printf("pow(nan, 0) isnan: %i\n", isnan(pow(nan, (double) 0.0)));
}

The ANSI part of the LSB test suite doesn't like this.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux silk 2.4.18 #1 Tue Feb 26 00:23:37 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C


---------------------------------------
Received: (at 136836-done) by bugs.debian.org; 2 Jan 2003 04:33:49 +0000
>From gotom@debian.or.jp Wed Jan 01 22:33:48 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18Tx3D-00011g-00; Wed, 01 Jan 2003 22:33:48 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
	by oris.opensource.gr.jp (Postfix) with ESMTP id C7BB6C33C6
	for <136836-done@bugs.debian.org>; Thu,  2 Jan 2003 13:33:45 +0900 (JST)
Date: Thu, 02 Jan 2003 13:33:45 +0900
Message-ID: <80y9645fx2.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: 136836-done@bugs.debian.org
Subject: Re: libc6: pow(nan, 0) returns 0?
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 136836-done@bugs.debian.org
X-Spam-Status: No, hits=-4.0 required=5.0
	tests=QUOTED_EMAIL_TEXT,SPAM_PHRASE_00_01,USER_AGENT
	version=2.41
X-Spam-Level: 

> Looks like pow(nan, 0) returns 0. It's supposed to return nan, or maybe 1.
> 
> #include <math.h>
> #include <errno.h>
> main(){
>         double nan = sqrt(-1.0);
>         printf("isnan: %i\n", isnan(nan));
>         printf("pow(nan, 0) = %d\n", pow(nan, (double) 0.0));
>         printf("pow(nan, 0) isnan: %i\n", isnan(pow(nan, (double) 0.0)));
> }
> 
> The ANSI part of the LSB test suite doesn't like this.

Your test program is wrong. Appropriate code is:

         printf("pow(nan, 0) = %f\n", pow(nan, (double) 0.0));
			       ~~
For every X, X^(0) is 1.0, so isnan() returns 0.

In addition, if (_LIB_VERSION == _SVID_ & _XOPEN_) is defined, isnan()
returns non 0 and pow() returns NaN.  You can look this behavior on
Solaris.

I don't have IEEE754 and ANSI floating point issue, so I don't know
whether ANSI defines this behavior or not.  If you have IEEE754 or any
related standards, and if such standards say pow(NaN, 0) have to
return NaN, reopen this bug.  We can fix easily if an appropriate
information is supplied.

I close this bug.

Regards,
-- gotom



Reply to: