Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!we13!ihnp4!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: Numerical C Message-ID: <1886@rlgvax.UUCP> Date: Sat, 28-Apr-84 12:35:59 EDT Article-I.D.: rlgvax.1886 Posted: Sat Apr 28 12:35:59 1984 Date-Received: Sun, 29-Apr-84 07:58:15 EDT References: <3000022@uokvax.UUCP> <882@elsie.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 28 > BTW: What is the origin of the double-precision only nature of C? I've heard > three differing, but non-conflicting reasons: > 1.) PDP-11's did all floating point calculations in double (is this true?) > anyway, so why not. It's not true, so this isn't the reason. > 2.) C was written as a systems language which required little little use of > floats, so they were added only as an afterthought. > 3.) The compilers are much easier to write if one doesn't have to worry > about two or more types of float. I suspect this may have been part of the reason; *on the PDP-11*, it's easier to write the compiler that way, but not in general. The reason is that the PDP-11 floating point instruction set (the *real* floating point instruction set, not the abortion that came on the 11/35, 11/40, and LSI-11) has two "mode bits". There wasn't enough room in the instruction set for an "add float" and an "add double" instruction, so they had a "set floating" and a "set double" instruction, and the "add float/add double" instruction was one or the other depending on the current mode. Any compiler for the PDP-11 has to keep track of the mode if it doesn't want to generate a flood of unnecessary "set floating" or "set double" instructions. It *can* be done - DEC's Fortran IV Plus compiler does it, although I think it assumes the mode is unknown at the entry to a basic block. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy