Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ames!skipper!altair!maine From: maine@altair.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: Uses for EQUIVALENCE Message-ID: Date: 7 Jun 91 18:15:15 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> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 63 In-reply-to: leipold@eplrx7.uucp's message of 7 Jun 91 17:13:57 GMT On 7 Jun 91 17:13:57 GMT, leipold@eplrx7.uucp (Walt Leipold) said: Walt> EPS(), HUGE()) for each constant? And why aren't functions like Walt> this part of X3.9-1978, so I can write portable numerical code? Walt> Or (the real $64K question) are these functions included in the Walt> long-expected and oft-delayed FORTRAN 90? Yes. From the S8.115 (June 1990) draft of F90, (More detailed descriptions are in other subsections; also pardon any typos I might have made in transcribing this). 13.10.8 Numeric Inquiry Functions digits(x) - Number of significant digits in the model epsilon(x) - Number that is almost negligible compared to one huge(x) - Largest number in the model maxexponent(x) - Maximum exponent in the model minexponent(x) - Minimum exponent in the model precision(x) - decimal precision radix(x) - base of model range(x) - decimal exponent range tiny(x) - Smallest positive number in the model 13.10.9 Bit Inquiry Function bit_size(i) - Number of bits in the model 13.10.10 Bit Manipulation Functions ... 13.10.12 Floating-point Manipulation Functions exponent(x) - Exponent part of a modewl number fraction(x) - Fractional part of a model number nearest(x,s) - Nearest different processor number in given direction rrspacing(x) - Reciprocal of the relative spacing of model numbers near given number scale(x,i) - Multiply a real by its base to an integer power set_exponent(x,i) - Set exponent part of a number spacing(x) - Absolute spacing of model numbers near given number Also relevant are the selected_int_kind and selected_real_kind functions that allow you to portably specify what precision you want as in !--- You probably put the parameter declaration in a module !--- or include file when doing thid for real. integer, parameter :: wr_kind = selected_real_kind(10,30) real(wr_kind) :: x,y,z That specifies that x, y, and z are of the "smallest" floating point type that has at least 10 digits of precision and a range of at least 10**(-30) to 10**30. This would be double precision on most 32-bit systems and single precision on 60- and 64-bit ones. -- -- Richard Maine maine@altair.dfrf.nasa.gov