From owner-freebsd-standards@FreeBSD.ORG Fri Jan 9 18:41:17 2009 Return-Path: Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 621CB1065674; Fri, 9 Jan 2009 18:41:17 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 1BB728FC0C; Fri, 9 Jan 2009 18:41:16 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n09IfbPa061269; Fri, 9 Jan 2009 13:41:37 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n09Ifaj3061268; Fri, 9 Jan 2009 13:41:36 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Fri, 9 Jan 2009 13:41:36 -0500 From: David Schultz To: John Hein Message-ID: <20090109184136.GA61165@zim.MIT.EDU> Mail-Followup-To: John Hein , =?iso-8859-1?Q?V=E1clav?= Haisman , freebsd-standards@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG, imp@FreeBSD.ORG References: <200812302231.mBUMVUtf092910@www.freebsd.org> <20081231215445.S3923@delplex.bde.org> <20090106190313.GA15233@zim.MIT.EDU> <496676AB.9040905@sh.cvut.cz> <18791.29670.321788.799095@gromit.timing.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18791.29670.321788.799095@gromit.timing.com> Cc: imp@FreeBSD.ORG, =?iso-8859-1?Q?V=E1clav?= Haisman , freebsd-standards@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG Subject: Re: standards/130067: Wrong numeric limits in system headers? X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jan 2009 18:41:17 -0000 On Fri, Jan 09, 2009, John Hein wrote: > FWIW, when you compile the OP's sample code on i386 with -pedantic > (with 6.x's base gcc 3.4.6 or 7.x's base gcc 4.2.1), you get: > > x.cc:11: error: floating constant exceeds range of 'long double' > > (the LDBL_MAX line) > > That seems to tip the scale more to the 'float.h is wrong' side. gcc doesn't do quite the right thing with long double constants in FreeBSD, and it causes no end of trouble when writing long double routines that are intended to work when the FPU is switched to extended precision mode. Older versions of gcc would evaluate long double constant expressions at compile time using extended precision, which was wrong because it didn't reflect what the FPU would have done at runtime. More recent versions of gcc were "fixed" to evaluate all long double constants using double precision, which matches what the FPU does by default. However, now it's not even possible to write a program that uses long double constants, even if the program changes the FPU precision at runtime, because gcc truncates all the constants at compile time (and generates spurious complaints such as the one you mention). C99 defines some pragmas that would improve the situation, but gcc doesn't implement them.