Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!pacific.mps.ohio-state.edu!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: <1991Jun7.193552.20308@jato.jpl.nasa.gov> Date: 7 Jun 91 19:35:52 GMT References: <1991Jun1.171914.802@weyrich.UUCP> <1991Jun5.220805.4653@alchemy.chem.utoronto.ca> <1991Jun6.232026.10172@jato.jpl.nasa.gov> <1991Jun7.171357.3941@eplrx7.uucp> Reply-To: vsnyder@jato.Jpl.Nasa.Gov (Van Snyder) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 32 In article <1991Jun7.171357.3941@eplrx7.uucp> leipold@eplrx7.uucp (Walt Leipold) writes: >In article <1991Jun6.232026.10172@jato.jpl.nasa.gov> Van Snyder writes: >>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. > >Is anyone else bothered by D1MACH et al? I mean, talk about gratuitously >non-portable code... Why did the author use EQUIVALENCEd hex constants? >Was it to get more precision in specifying a floating point value than he >could get by writing a floating point constant? If so, how would you print >one of these values, and what does that say about the state of the art in >FORTRAN compilers (and their users)? And why do I have to ask for each >constant by number (1..5), instead of having a separate function (e.g., >EPS(), HUGE()) for each constant? And why aren't functions like this part >of X3.9-1978, so I can write portable numerical code? Or (the real $64K >question) are these functions included in the long-expected and oft-delayed >FORTRAN 90? You're right about equivalence and hex being non-portable. The benefit is that the non-portability is concentrated in one easily replaced routine, instead of being scattered around throughout the code. You can change the interface if you like. I'd recommend using multiple entries so you don't have to change 5 files, or one file in 5 places, when porting code. the stuff in *1MACH is in F 90, and more. -- vsnyder@jato.Jpl.Nasa.Gov ames!elroy!jato!vsnyder vsnyder@jato.uucp