Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!adm!Schauble@mit-multics.arpa From: Schauble@mit-multics.arpa (Paul Schauble) Newsgroups: comp.lang.c Subject: Re: Comments on ANSI public Oct 86 Public review draft. Message-ID: <4804@brl-adm.ARPA> Date: Sun, 8-Mar-87 16:51:56 EST Article-I.D.: brl-adm.4804 Posted: Sun Mar 8 16:51:56 1987 Date-Received: Mon, 9-Mar-87 04:09:03 EST Sender: news@brl-adm.ARPA Lines: 43 This is in response to the comments recently posted by Alan Mycroft. Text bounded by ====== is his. =============== c) page 8, line 41. "Expressions may be evaluated in greater precision than required, provided not precision is lost". I would think that it should not be gained either. Consider IEEE implementation of { float x,y,z; z = x*y; if (z == x*y) ... }. I believe that it is unreasonable for the condition to fail, BUT the current draft seems to permit it. =============== Perhaps it seems unreasonable, but there are current machines where arranging otherwise is awkward and expensive. I have to answer this on HOneywell hardward every few months. Honeywell uses a slightly unusual register structure that give a float or double contained in a register an extra 8 bits precision. This is lost when the value is stored into memory. The most likely code sequence generated for this example is FLD X Get X into register FMP Y Multiply by Y, giving result in register. Result is *double precision plus extra 8 bits*. That's right, single*single yields double. FST Z Store results, truncating to single precision without extra bits. FCMP Z First of IF statement. Compares truncated value In memory to extra precision value in register. Result is probably not equal. The only way around this is to have the compiler never generate a register reuse on a floating point value. This seems a serious inefficiency. It seems to me much more in accord with reality to say that == is not defined for float and double. At least, like it or not, the definition is machine dependant and compiler dependant. It may seem ureasonable that (x*y == x*y) should fail, but it can and does on many machines. Paul Schauble at boTap co at 1