Showing results for 
Search instead for 
Did you mean: 



I have a module where I need to evaluate a lot of exp functions inside a big loop. Inside this loop I don't need full precision and the /Qfast-transcendentals compiler option is tempting to apply. However other places in the module I need full precision. Is there a way to specify exactly where to use the fast algorithm?

Is it possible to apply the fast versions by a proper use statement as a replacement for the compiler option?

use some_fast_intel_module, only: exp_fast => exp

Then I could apply the optimized algorithm where i specify exp_fast and obtain full precision when I specify the standard exp.

If I make a small module like this

module math_fast ! In a separate file compiled with /Qfast-transcendentals
real, elemental function exp_fast(x)
real, intent(in) :: x
exp_fast = exp(x)
end function exp_fast
end module math_fast

If I inline this function into the other module which is not compiled with /Qfast-transcendentals will I obtain the fast trascendental algorithm when I apply exp_fast(x)?

Thanks for your help!

Jens B. Helmers

0 Kudos
1 Reply
Black Belt

As the main point of fast-transcendentals is the use of svml function calls, you may be able to control them with !dir$ [no]vector directives.  These fast calls would occur only in vectorized loops.

Although the docs have said the default fast exp is permitted to deviate by up to 4 ULPs, such large deviations seem to apply only for large magnitude values.  You would still expect better than 5 digits accuracy for default real in the border cases, and mostly 6.

I suppose you could try compiling the procedure with exp call only with fast-transcendentals while using Qipo.