[ncl-talk] commands to handle exponential calculation to return E100 instead of infinity

Rick Brownrigg brownrig at ucar.edu
Wed Apr 26 11:34:44 MDT 2017


This yields a float result, which is out of range for floats:

b10   = exp(230.84)
b20   = exp(203.22)

Try explicitly making the constants double:

b10   = exp(230.84d)
b20   = exp(203.22d)


On Wed, Apr 26, 2017 at 5:27 AM, Yi-Chih Huang <dscpln at gmail.com> wrote:

> Hello,
>
>     I work on NCL Version 6.1.2.  It said the range of double type is
> e-308 - e+307 on https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/
> NclDataTypes.shtml.  Although I have tried several ways, I only got
> infinity and 8 bits in return.  Could you show me the command to
> handle exponential calculation
>
>
> b10   = todouble(exp(230.84))
> b20   = todouble(exp(203.22))
> b30   = new(1,double,0)
> print(b10+"  "+b20+"  "+b30)
>
> Variable: b30
> Type: double
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
>
> (0)     inf  inf  inf
>
> $ ncl -v
> Unknown option `-v'
>  Copyright (C) 1995-2013 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.1.2
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
>     Thanks much,
>
>                      Yi-Chih
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170426/ff9fe510/attachment.html 


More information about the ncl-talk mailing list