From: Ken Garlington <garlingtonke@lmtas.lmco.com>
Subject: Re: 'Digit in generic package
Date: 1996/08/27
Date: 1996-08-27T00:00:00+00:00 [thread overview]
Message-ID: <32231881.2A09@lmtas.lmco.com> (raw)
In-Reply-To: 9608261530.AA06035@most
W. Wesley Groleau (Wes) wrote:
>
> R. A. O'Keefe asked
> [how to make a generic use the most precise type out of its actuals]
>
> R. Eachus answered
>
> [Write the generic body to dispatch at run-time]
>
> At least one vendor supplied a generic math package that did exactly
> that AND on examining the disassembled code for an instantiation, we
> found that the compiler had looked at the parameters and eliminated
> the "dead code" so that the effect was exactly what Mr. O'Keefe had
> asked for.
If you have DEC Ada installed, you can look at the body of the generic
SQRT routine in ADA$PREDEFINED:MATH_LIB.ADC and see:
function SQRT (A: REAL) return REAL is
begin
if REAL'MACHINE_MANTISSA = SYSTEM.F_FLOAT'MACHINE_MANTISSA then
return REAL(VAX_F.SQRT(F_FLOAT(A)));
elsif REAL'MACHINE_MANTISSA = SYSTEM.D_FLOAT'MACHINE_MANTISSA then
...
Usually, this gets optimized to a simple call to the pre-defined VAX
SQRT routine of the appropriate precision.
--
LMTAS - "Our Brand Means Quality"
next prev parent reply other threads:[~1996-08-27 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-08-26 0:00 'Digit in generic package W. Wesley Groleau (Wes)
1996-08-27 0:00 ` Ken Garlington [this message]
1996-08-27 0:00 ` Robert I. Eachus
1996-08-28 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox