CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   [Fortran] (-real number)**(- or + real number) (

jinwon June 13, 2007 15:17

[Fortran] (-real number)**(- or + real number)
I am computing a switch to choose a criteria depending on a value. In doing it, I need to compute a value like below

(-real number)**(- or + real number)..

so I used the usual syntax "**" to consider the power as the pow in c++.

But it gave me a NaN value. Please let me know how to treat such a power in fortran.

Thanks in advance.

jinwon June 13, 2007 15:46

Re: [Fortran] (-real number)**(- or + real number)
The problem is occurred when I tried to compute following

-0.24987**0.3846 --> it's okay but when I tried to use

r**GammaK --> it cause NaN

Of course, r is a value containing -0.24978 and Gammak has something.

Markus Lummer June 14, 2007 02:27

Re: [Fortran] (-real number)**(- or + real number)
1) -0.24987**0.3846 is evaluated as -(0.24987**0.3846) because of the operator precedence in Fortran

2) r**GammaK is not a real number for r<0 and GammaK real. Check your formulas!

jinwon June 14, 2007 14:50

Re: [Fortran] (-real number)**(- or + real number)
Thanks. You're right. It's a complex number.

All times are GMT -4. The time now is 14:20.