🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1321

Re: Questions about NCEG

#1321
From: Paul Eggert
Date: Tue, 29 May 1990 19:34
27 lines
1707 bytes
O'Keefe makes several good points about IEEE floating point and ANSI C,
including:

|(1) If you stick to the letter of the IEEE 754 and IEEE 854 standards,
|    conversion of numeric literals from decimal to binary (or possibly,
|    in the case of 854, to internal decimal) is a *run* *time* operation,

No C compiler that I know of does this.  Does this mean that no C compiler can
claim conformance to both IEEE 754 and ANSI C?  I fear that if we ask either
standards committee for a ruling, they'll refer us to the other committee.

|(3) There are special numbers (+ and - infinity, -0, NaNs, Vax reserved
|    operands, &c) which have no standard syntax.

There are ways to say the IEEE numbers in ANSI C + IEEE 754:

	#define minus_0 (-0.0)
	#define infinity (1e300*1e300)
	#define NaN1 (infinity-infinity)
	#define minus_infinity (-infinity)
	#define minus_NaN1 (-NaN1)

This lets you say some things portably that you can't say with hex contants,
e.g. ``the NaN that you get when you subtract infinity from itself'',
which has a different hex value in different implementations of IEEE 754.
Unfortunately, many compilers (e.g. GCC) get this sort of thing wrong,
and these bugs are further arguments for hex floating constants.
Technical Details
Message-ID: <1990May29.193451.6533@twinsun.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uci-ics!ucla-cs!twinsun!eggert
References: <15519@bfmny0.UU.NET> <73.UUL1.3#5109@pantor.UUCP> <3094@goanna.cs.rmit.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uci-ics!ucla-cs!twinsun!eggert
From: eggert@twinsun.com (Paul Eggert)
Newsgroups: comp.std.c
Subject: Re: Questions about NCEG
Message-ID: <1990May29.193451.6533@twinsun.com>
Date: 29 May 90 19:34:51 GMT
References: <15519@bfmny0.UU.NET> <73.UUL1.3#5109@pantor.UUCP> <3094@goanna.cs.rmit.oz.au>
Sender: usenet@twinsun.com
Organization: Twin Sun, Inc
Lines: 27