Re: fspan (problem?)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 16 Nov 2007 12:18:35 -0700 (MST)

Hi Prince,

I checked with Dave Brown, and he thinks this is a characteristic of
the floating point system on your particular machine. We tried some
tests of your code on various systems, and on some we got a number like
what you're seeing, and on others we got exactly "0.0".

We will look into the possibility of having fspan do double precision
under the hood to see if this returns better results.

Meanwhile, if you really need that number to be "0.0" and if you are
okay with double precision from the NCL side, then you can
do something which Dave tried on his machine:

   xd = fspan(-1.0d,1.0d,11)
   x = doubletofloat(xd)
   print(x)

--Mary

On Fri, 16 Nov 2007 xavier_at_lmd.ens.fr wrote:

> Hi all,
>
> For a few days I'm working on a Windows Cygwin installation of NCL on my
> home PC. I am getting a strange error from fspan, which I think never
> happened on my linux PC!
>
> x = fspan(-1.0,1.0,11)
> print(x)
>
> gives
>
> Variable: x
> Type: float
> Total Size: 44 bytes
> 11 values
> Number of Dimensions: 1
> Dimensions and sizes: [11]
> Coordinates:
> (0) -1
> (1) -0.8
> (2) -0.6
> (3) -0.4
> (4) -0.2
> (5) 1.490116e-08
> (6) 0.2
> (7) 0.4
> (8) 0.6
> (9) 0.8
> (10) 1
>
> I am expecting a 'zero' as the 6th element of the array, but can't figure
> out what this '1.490116e-08' is doing here!
>
> could someone help?
>
> Prince
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 16 2007 - 12:18:35 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 25 2007 - 07:21:25 MST