[ncl-talk] commands to handle exponential calculation to return E100 instead of infinity
Yi-Chih Huang
dscpln at gmail.com
Wed Apr 26 20:27:00 MDT 2017
Hello,
The exp(230.84d) is working. But b12^log(L(j,k))d in the do loop is
not working. What would be the command to handle extreme large or extreme
small numbers in do loop?
Thanks,
Yi-Chih
On Thu, Apr 27, 2017 at 1:34 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
> 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/Do
>> cument/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/20170427/7134624b/attachment.html
More information about the ncl-talk
mailing list