Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Apr 2007 13:13:21 GMT
From:      Vincent Lefèvre<vincent@vinc17.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   standards/112180: tgamma on negative integers returns Inf instead of NaN
Message-ID:  <200704271313.l3RDDLWw085017@www.freebsd.org>
Resent-Message-ID: <200704271320.l3RDK2rI043094@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help


>Number:         112180
>Category:       standards
>Synopsis:       tgamma on negative integers returns Inf instead of NaN
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 27 13:20:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Vincent Lefèvre
>Release:        6.1
>Organization:
INRIA
>Environment:
FreeBSD td150.testdrive.hp.com 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May  7 04:43:05 UTC 2006     root@pluto2.freebsd.org:/usr/obj/usr/src/sys/GENERIC  ia64
>Description:
The tgamma function returns the value Inf instead of NaN on negative integers (-1, -2, ...) and -Inf. POSIX says:

If x is a negative integer, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.

and

If x is -Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.

See <http://www.opengroup.org/onlinepubs/009695399/functions/tgamma.html>.

Though POSIX allows an implementation-defined value to be returned, this is mainly in the case where NaN is not supported, and NaN is the best choice and is what tgamma returns on other platforms (Linux, HP-UX, Mac OS X).
>How-To-Repeat:
Download http://www.vinc17.org/software/testlgamma.c and compile it with:
gcc -Wall -O2 testlgamma.c -o testlgamma -lm
and run it. For tgamma on -1, -2 and -inf, one gets:
  ERROR! Got inf instead of nan, and sign = 1.

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704271313.l3RDDLWw085017>