Debasish Pai Mazumder wrote:
>
> I declared the value of Z in program which is given below,
>
>
>
> Z=2*(1.3806*10^(-23))^4/(((6.626*10^(-34))^3)*((3*10^8)^2))
>
>
>
>
>
> But I got a error massage "fatal:divide: Division by 0, Can't continue
>
> fatal:Div: operator failed, can't continue" in the above mentioned line.
>
> I guess this error occurs due to division by very low value.
>
>
>
> Is there any way to get rid of this error and compute the value of Z?
>
How about:
ncl 7>
Z=2*(1.3806*flt2dble(10^(-23)))^4/(((6.626*flt2dble(10^(-34)))^3)*((3*10^8)^2))
ncl 8> print(Z)
Variable: Z
Type: double
Total Size: 8 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 2.775265831051694e-09
You need to load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
to get the function flt2dble.
Your original problem is that some of the expressions on the right-hand
side are underflowing to zero in single precision. Notice that Z is now
a double, which could be converted back to single precision using dble2flt.
Andy
-- Andrew W. Mai --- __o National Center for Atmospheric Research ---- _`\<,_ Boulder, CO 80307 USA mai_at_ucar.edu --- (*)/ (*) http://www.cgd.ucar.edu/cdp/mai/mai.html
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 10 2006 - 14:00:56 MST
This archive was generated by hypermail 2.2.0 : Fri Nov 10 2006 - 14:37:35 MST