# NaN problem

 Classic List Threaded
4 messages
Reply | Threaded
Open this post in threaded view
|

## NaN problem

 gg=NaN >> gg!=NaN ans =  1 it's possible? -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Reply | Threaded
Open this post in threaded view
|

## Re: NaN problem

 On 08/08/2018 02:58 PM, shivax wrote: >   gg=NaN > >>> gg!=NaN > ans =  1 > > > it's possible? This is standard IEEE floating-point stuff. Not-A-Numbers should not test as equal to anything, even themselves. So gg != gg ought to be true. it is one way of testing for NaNs in many languages.
Reply | Threaded
Open this post in threaded view
|

## Re: NaN problem

 In reply to this post by shivax On Wed, 8 Aug 2018 08:58:59 -0500 (CDT) shivax <[hidden email]> wrote: >  gg=NaN > > >> gg!=NaN   > ans =  1 > > > it's possible? NaN is to be assigned to a computation, when the result of an operation is not well defined.  There are many ways to produce answers which are not well defined.  Because of this, one NaN does not (necessarily) equal another NaN.  Octave provides a function which will tell you if the result is NaN (isnan). > Mapping Function: isnan (x) >    Return a logical array which is true where the elements of x are >    NaN values and false where they are not. >    NA values are also considered NaN values. For example: >    isnan ([13, Inf, NA, NaN]) >          ⇒ [ 0, 0, 1, 1 ] Gord
Reply | Threaded
Open this post in threaded view
|

## Re: NaN problem

 good thanks -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html