Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jato!vsnyder From: vsnyder@jato.jpl.nasa.gov (Van Snyder) Newsgroups: comp.lang.fortran Subject: Re: Uses for EQUIVALENCE Message-ID: <1991Jun6.232026.10172@jato.jpl.nasa.gov> Date: 6 Jun 91 23:20:26 GMT References: <1991May30.040829.8696@eplrx7.uucp> <1017@DIALix.oz.au> <1991Jun1.171914.802@weyrich.UUCP> <1991Jun5.220805.4653@alchemy.chem.utoronto.ca> Reply-To: vsnyder@jato.Jpl.Nasa.Gov (Van Snyder) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 37 In article <1991Jun5.220805.4653@alchemy.chem.utoronto.ca> mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes: >In article <1991Jun1.171914.802@weyrich.UUCP> orville@weyrich.UUCP >(Orville R. Weyrich) writes: >[on using EQUIVALENCE with variables of differing types] >>This leads to the $500,000 question: do algorithms exist which can do something >>intelligent with such uses of EQUIVALENCE? >> >>YES, I WOULD BE VERY INTERESTED IN THE ANSWER TO THE ABOVE QUESTION. > >I can see one possible legitimate use of EQUIVALENCE with different data >types: to decide on the endianism of your machine (and similarly to decide >other quirks of the number system of the computer). You can load up some >variables with known values, equivalence them to appropriate-sized integers >and then use these integers to diagnose the endianism (round-off, etc.). Such >diagnostic toolkits are probably the only legitimate use of equivalence >across data types though (other than saving space). Anyone know any others? > > Marc R. Roussel > mroussel@alchemy.chem.utoronto.ca I can understand that one might want to know the endianism of your machine if you were tearing apart telemetry data or something like that. But a rationally designed bit access facility should make that invisible. You may need a different such subprogram set for each of several classes of machines (until it becomes standard in F90). But scattering EQUIVALENCE all over the place just to be able to scatter endianism-denendencies all over the place seems like a poor programming practice. I'd also be surprised if you could use EQUIVALENCE to discover the round- off level or the overflow or underflow limits. Mike Malcolm wrote some routines to compute such things a long time ago. Or you could get the routines R1MACH, D1MACH and I1MACH from Netlib. -- vsnyder@jato.Jpl.Nasa.Gov ames!elroy!jato!vsnyder vsnyder@jato.uucp