Re: A question about basic operation

From: Dennis Shea (shea AT XXXXXX)
Date: Wed Sep 01 2004 - 20:46:34 MDT


On Thu, 2 Sep 2004, [ks_c_5601-1987] ±èÁÖ¿Ï wrote:
> Hi,
> I found a strange thing in basic operation in NCL
>
> ncl 11> print( -(0.5)^2 )
> (0) 0.25
>
> but generally it is -0.25
> It seems that the ncl does (-0.5)*(-0.5) = 0.25
>
> but conventionally is should be -(0.5)*(0.5) = -0.25
>
> I think, it may cause some problems.
> Regards
> =======================================
> Kim joo-wan
> =======================================

Hello,

I think this is related to how NCL handles 'algebraic expressions'.
For example:
            ncl > print( -(0.5^2) ) ===> -0.25
            ncl > x = 0.5
            ncl > x2 = -x^2 ===> 0.25 [ treated as -x to be squared]
            ncl > X2 = -(x^2) ===> -0.25

However, I agree it is a bit confusing. Perhaps an NCL developer
can add more to this thread.

_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Thu Sep 09 2004 - 08:04:36 MDT