RE: Input format and NaNs



In a previous article, Bruce Bowler <bbowler@xxxxxxxxxxx> wrote:
>I have a datafile that I'm trying to read that has NaNs in it, on
>occasion, where the result of a calculation in another language was a NaN.
>Where there aren't NaNs there are floating point numbers.
>
>Is there a format specifier I can use that won't puke on NaN in the input
>stream, or do I have to read things into a string, check for NaN and then
>using an internal read if there isn't a NaN or preprocess the file with
>something else to replace the NaNs with a "known bad value" that FORTRAN
>can read on it's own?
>
>Using Salford f95 compiler, if it makes a difference.
>
>TIA,
>Bruce

Yes - I had that problem when using ncdump.exe to write
contents of a netcdf file in ascii -
(An earlier version of ncdump.exe - with no distinguishing
features except smaller size! gave extra unsolicited numbers!!
Beware of netcdf !)

I assumed that NaN stood for gap, and edited it accordingly
in the DOS editor.

Chris
.



Relevant Pages

  • Re: math.nroot [was Re: A brief question.]
    ... >> py> inf ... INF-INF as a particular bit-pattern and call it NaN, ... In floating point, ... In mathematics, the order you do your calculation shouldn't ...
    (comp.lang.python)
  • Re: converting float to ascii w/o printf
    ... Going to floating point because one do not properly define system ... you end up with INF or NAN. ... For some control systems this is a VERY bad idea. ...
    (comp.arch.embedded)
  • Re: converting float to ascii w/o printf
    ... Going to floating point because one do not properly define system ... you end up with INF or NAN. ... How do you represent infinity or an invalid value in an integer? ... Poor system design / specification ?. ...
    (comp.arch.embedded)
  • Re: Floating-point arithmetic in CL
    ... At its core this is a consequence of mandatory checked exceptions. ... language designers admitted that floating point calculations such as ... non-numbers such as NaN. ...
    (comp.lang.lisp)
  • Re: "0 in [True,False]" returns True
    ... a float is always a float. ... >> depending on type but on value. ... > Your examples are still both very different from the NaN ... A NaN is a floating point operation that supports all ...
    (comp.lang.python)