<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Gus,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are right, this doesn't work! I'm surprised somebody didn't run into this before.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've created a ticket for this (NCL-2604) and hopefully we can get a fix in for 6.4.1.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 3, 2017 at 10:58 AM, Gus Correa <span dir="ltr"><<a href="mailto:gus@ldeo.columbia.edu" target="_blank">gus@ldeo.columbia.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear NCL Pros<br>
<br>
I have noticed a minor problem when using constants of double<br>
type in an arithmetic expression.<br>
When I separate the tokens with spaces,<br>
NCL parses the expression properly, and gives the correct result.<br>
When I write the expresion tightly, without spaces, I get<br>
a syntax error.<br>
<br>
Am I doing something wrong, or does the parser really expect<br>
spaces between the tokens?<br>
<br>
Of course I can continue to write the expressions with spaces,<br>
but the problem may propagate to, say, automatically<br>
generated NCL code, etc.<br>
<br>
I enclose a simple example below.<br>
As you can see, I am using NCL 6.4.0,<br>
pre-compiled with gcc on CentOS, and downloaded from ESG.<br>
<br>
Thank you,<br>
Gus Correa<br>
<br>
*** syntax error in arithmetic expression with constant doubles ***<br>
<br>
[gus@master ~]$ ncl<br>
Copyright (C) 1995-2017 - All Rights Reserved<br>
University Corporation for Atmospheric Research<br>
NCAR Command Language Version 6.4.0<br>
The use of this software is governed by a License Agreement.<br>
See <a href="http://www.ncl.ucar.edu/" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
ncl 0> a=3.2d + 4.5d<br>
ncl 1> print("a="+sprintf("%g",a))<br>
(0) a=7.7<br>
ncl 2> delete(a)<br>
ncl 3> a=3.2d+4.5d<br>
fatal:syntax error: line 3 before or near .5d<br>
a=3.2d+4.5d<br>
----------^<br>
<br>
ncl 4> b=3.2d+4.5d<br>
fatal:syntax error: line 4 before or near .5d<br>
b=3.2d+4.5d<br>
----------^<br>
<br>
ncl 5> b=3.2d +4.5d<br>
ncl 6> print("b="+sprintf("%g",b))<br>
(0) b=7.7<br>
<br>
<br>
[Note that the "d" (for double) needs a space after it, and before the<br>
next token. Maybe that is the behavior one should expect,<br>
but I was surprised.]<br>
<br>
******************************<wbr>******************************<wbr>**********<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>