Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!jato!vsnyder From: vsnyder@jato.jpl.nasa.gov (Van Snyder) Newsgroups: comp.lang.fortran Subject: Re: Cheating on the types Message-ID: <1991Mar29.014537.23918@jato.jpl.nasa.gov> Date: 29 Mar 91 01:45:37 GMT References: <1991Mar20.195732.15376@appmag.com> <4554@alliant.Alliant.COM> <1991Mar25.163447.10166@cl.cam.ac.uk> Reply-To: vsnyder@jato.Jpl.Nasa.Gov (Van Snyder) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 42 In article <1991Mar25.163447.10166@cl.cam.ac.uk> cet1@cl.cam.ac.uk (C.E. Thompson) writes: >In article <4554@alliant.Alliant.COM> tj@Alliant.COM (Tom Jaskiewicz) writes: >>In article <1991Mar20.195732.15376@appmag.com> pa@appmag.com (Pierre Asselin) writes: >>}This simplified fragment violates the standard by passing reals to a >>}routine that expects integers. >>} >>} program wrong >>} real rin, rout >>} rin= 0.577215665 ! or whatever... >>} call icopy(rin, rout) >>} write(6,*) rout >>} end >>} >>} subroutine icopy(iin, iout) >>} integer iin, iout >>} iout= iin >>} return >>} end >>} >>}Seems fairly innocuous, though. Q: are there implementations >>}where it would fail ? >> >>Yes. It been 10 years since I've used one, but there is at least one >>Fortran implementation that uses 16 bit INTEGER's and 32 bit REAL's. >>(this in itself violates Fortran-77). >> > >From the mists of time: on TITAN (and other Atlas-1 and Atlas-2 Fortran >implementations as well, I expect) integers were halfwords (24 bits) while >reals were words (48 bits). The above code would not have worked... [stuff > deleted] Also from the mists of time: I think on CDC 6600/7600, an integer was represented using only the fraction of a floating point number, with the exponent zero. If a number with zero exponent was acted upon by a floating point instruction, or a number with non-zero exponent was acted upon by an integer instruction, interrupts happened. But I may have this wrong. -- vsnyder@jato.Jpl.Nasa.Gov ames!elroy!jato!vsnyder vsnyder@jato.uucp