From owner-freebsd-standards Fri Jan 3 16:52:32 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 30BB237B401 for ; Fri, 3 Jan 2003 16:52:30 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CFDD43EC2 for ; Fri, 3 Jan 2003 16:52:29 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id 904E79C10; Fri, 3 Jan 2003 19:41:48 -0500 (EST) Date: Fri, 3 Jan 2003 19:41:48 -0500 From: Mike Barcroft To: Kyle Martin Cc: Ryan Younce , standards@freebsd.org Subject: Re: a few missing types in math.h Message-ID: <20030103194148.A79470@espresso.q9media.com> References: <20021017213133.GE364@marvin.bsdng.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021017213133.GE364@marvin.bsdng.org>; from mkm@ieee.org on Thu, Oct 17, 2002 at 04:31:33PM -0500 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Sorry for the very late reply.] Kyle Martin writes: > double_t and float_t were missing, easy enough: > > Index: math.h > =================================================================== > RCS file: /home/ncvs/src/lib/msun/src/math.h,v > retrieving revision 1.18 > diff -c -r1.18 math.h > *** math.h 1 Oct 2002 11:44:35 -0000 1.18 > --- math.h 17 Oct 2002 20:56:31 -0000 > *************** > *** 24,29 **** > --- 24,35 ---- > #define HUGE_VAL (*(double *) __infinity) > > /* > + * C99 > + */ > + typedef float float_t; > + typedef double double_t; > + > + /* > * XOPEN/SVID > */ > #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) This needs to at least be conditional on __ISO_C_VISIBLE >= 1999, but I wonder if we should make these variable types MD. If we don't want to make them MD, I'd recommend the following patch: %%% Index: math.h =================================================================== RCS file: /work/repo/src/lib/msun/src/math.h,v retrieving revision 1.20 diff -u -r1.20 math.h --- math.h 31 Oct 2002 23:05:20 -0000 1.20 +++ math.h 4 Nov 2002 15:25:29 -0000 @@ -17,6 +17,8 @@ #ifndef _MATH_H_ #define _MATH_H_ +#include + /* * ANSI/POSIX */ @@ -26,6 +28,12 @@ } __infinity; #define HUGE_VAL (__infinity.__ud) +#if __ISO_C_VISIBLE >= 1999 +typedef float float_t; +typedef double double_t; +#define FLT_EVAL_METHOD 0 +#endif + /* * XOPEN/SVID */ @@ -102,8 +110,6 @@ #endif /* !_XOPEN_SOURCE */ #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ - -#include /* * Most of these functions have the side effect of setting errno, so they %%% Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Jan 4 0:43:56 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CE5637B401; Sat, 4 Jan 2003 00:43:55 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF1A943EEC; Sat, 4 Jan 2003 00:43:53 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA00280; Sat, 4 Jan 2003 19:43:38 +1100 Date: Sat, 4 Jan 2003 19:43:51 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Mike Barcroft Cc: Kyle Martin , Ryan Younce , Subject: Re: a few missing types in math.h In-Reply-To: <20030103194148.A79470@espresso.q9media.com> Message-ID: <20030104192813.S8432-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 3 Jan 2003, Mike Barcroft wrote: > This needs to at least be conditional on __ISO_C_VISIBLE >= 1999, but I > wonder if we should make these variable types MD. > > If we don't want to make them MD, I'd recommend the following patch: > > %%% > Index: math.h > =================================================================== > RCS file: /work/repo/src/lib/msun/src/math.h,v > retrieving revision 1.20 > diff -u -r1.20 math.h > --- math.h 31 Oct 2002 23:05:20 -0000 1.20 > +++ math.h 4 Nov 2002 15:25:29 -0000 > ... > @@ -26,6 +28,12 @@ > } __infinity; > #define HUGE_VAL (__infinity.__ud) > > +#if __ISO_C_VISIBLE >= 1999 > +typedef float float_t; > +typedef double double_t; > +#define FLT_EVAL_METHOD 0 > +#endif All these are are MD. For i386's FLT_EVAL_METHOD should be some negative number < -1 (implementation defined as broken: the evaluation method depends on whether the operands are const, and on their types and compiler flags and optimization side effects if they are variables), and double seems to be least incorrect for both float_t and float_t (float_t should not be float since floats are inefficient, especially if method 0 is actually implemented for them). I think this stuff is less broken for other arches since the hardware supports method 0 efficiently which is what gcc prefers. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message