Path: utzoo!mnetor!uunet!lll-winken!lll-crg.llnl.gov!brooks From: brooks@lll-crg.llnl.gov (Eugene D. Brooks III) Newsgroups: comp.arch Subject: Re: Performance increase - a suggestion Message-ID: <3177@lll-winken.llnl.gov> Date: 1 Feb 88 23:19:27 GMT References: <235@unicom.UUCP> <28200089@ccvaxa> <3127@phri.UUCP> <408@micropen> Sender: usenet@lll-winken.llnl.gov Reply-To: brooks@lll-crg.llnl.gov.UUCP (Eugene D. Brooks III) Organization: Lawrence Livermore National Laboratory Lines: 29 In article <408@micropen> dave@micropen (David F. Carlson) writes: >This is a question/problem that has been gnawing on me for a long time: >It is the case (K&R p184) that "All floating arithmetic in C is carried >out in double-precision;" regardless whether declared as single precision >or not. Given that a large majority of code being written (at least at >a typical UNIX site) is in C, why not dispose of single precision floating >point altogether and concentrate the silicon real-estate to something >that my compiler might actaully use. Alternately, perhaps hardware/arch. >people can convince C compiler writers that (as I often find) single >precision is more than sufficient for all but the most numerically nasty >problems and should be used for float arithmetic unless code directed >otherwise. (It seems to go against UNIX philosophy to have a compiler >force a double precision arithmetic when source code clearly indicates >that single precision would suffice.) I am willing to be that my FPA >has *never* executed a single precision arithmetic operation (other than >double->single and single->double)!! This is the "boondoggle" of the C programming language, which I know and love, that arose from its early PDP11+FP11 targets. It is being "fixed", read that PATCHED, in the ANSI spec by introducing the new type "long double" and or by the use of function prototypes. Lets not reinvent the FP11 arcanity which is the source of all this evil! Many C compilers have some flag which causes float expressions to be handled in single precision, and a whole lot of users are using this option to get fast code. For those of you who are younger than the PDP11, the FP11 was the PDP11's floating point hardware, which had two modes (single and double precison) and could only be in one mode at a time. The cheap fix was to do all computation in double, the "double mode" did have a conversion instruction which allowed loading a float, converting it to a double on the fly. Doing all computation in 64, 80, or 128 bits is no way to make a computer run fast.