Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Nov 2000 03:12:55 +0100 (CET)
From:      pfeifer@dbai.tuwien.ac.at (Gerald Pfeifer)
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/23103: <math.h> lacks many ISO C99 features (NAN, isfinite,...)
Message-ID:  <200011260212.eAQ2Ctr44509@taygeta.dbai.tuwien.ac.at>

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

>Number:         23103
>Category:       misc
>Synopsis:       <math.h> lacks many ISO C99 features (NAN, isfinite,...)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 25 18:20:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Gerald Pfeifer
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
>Environment:

	FreeBSD 4.2-RELEASE

>Description:

	<math.h> AKA /usr/include/math.h lacks a couple of features
	required by ISO C99. ISO compliant programs will thus fail to
 	compile; one (more or less) prominent one is Wine.

	Features missing include macros FP_INFINITE, FP_NAN, FP_NORMAL,
	FP_SUBNORMAL, FP_ZERO, fpclassify(), and isfinite().

>How-To-Repeat:


>Fix:

	Implement the following (and probably further macros); the
	descriptions are copied from a draft of ISO C99.

       7.12  Mathematics <math.h>

       [#6] The macros

               FP_INFINITE
               FP_NAN
               FP_NORMAL
               FP_SUBNORMAL
               FP_ZERO

       are for number classification.  They represent the  mutually
       exclusive  kinds  of  floating-point values.  They expand to
       integer constant expressions with distinct values.

       7.12.3.1  The fpclassify macro

       Synopsis

       [#1]

               #include <math.h>
               int fpclassify(real-floating x);

       Description

       [#2]  The  fpclassify macro classifies its argument value as
       NaN,  infinite,  normal,  subnormal,  or  zero.   First,  an
       argument  represented  in  a  format wider than its semantic
       type is converted to its semantic type.  Then classification
       is based on the type of the argument.184)

       Returns

       [#3]  The  fpclassify  macro returns the value of the number
       classification  macro  appropriate  to  the  value  of   its
       argument.

       [#4]  EXAMPLE  The  fpclassify macro might be implemented in
       terms of ordinary functions as

               #define fpclassify(x) \
                       ((sizeof (x) == sizeof (float)) ? \
                               __fpclassifyf(x) \
                       : (sizeof (x) == sizeof (double)) ? \
                               __fpclassifyd(x) \
                       :       __fpclassifyl(x))


       7.12.3.2  The isfinite macro

       Synopsis

       [#1]

               #include <math.h>
               int isfinite(real-floating x);

       Description

       [#2] The isfinite macro determines whether its argument  has
       a finite value (zero, subnormal, or normal, and not infinite
       or NaN).  First, an argument represented in a  format  wider
       than  its  semantic  type is converted to its semantic type.
       Then determination is based on the type of the argument.

       Returns

       [#3] The isfinite macro returns a nonzero value if and  only  
       if its argument has a finite value.

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


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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