help-octave
[Top][All Lists]

## max() and min() of nan/inf

 From: Joao Cardoso Subject: max() and min() of nan/inf Date: Thu, 16 Sep 1999 20:01:24 +0100

```Hi,

Is this a correct behaviour?

max() or min() return nan is a nan is one of its arguments? max() or
min() considering +/-Inf looks OK.

Is there any rationale for this? arithmetic or comparition operations
are of course not defined on nans...

I'm using octave 2.2.14 on sco-unix.

Thanks,
Joao

octave:26> max([inf [] 1 3 5 nan])
ans = NaN
??

octave:27> min([inf [] 1 3 5 nan])
ans = NaN
??

octave:28> min([inf [] 1 3 5 ])
ans = 1
OK

octave:29> max([inf [] 1 3 5 ])
ans = Inf
OK

octave:34> min([nan [] 1 3 5 ])
ans = NaN
??

octave:35> max([nan [] 1 3 5 ])
ans = NaN
??

octave:37> min([nan [] 1 3 5 -inf])
ans = NaN
??

octave:38> min([inf [] 1 3 5 -inf])
ans = -Inf
OK

---
U.N. FORCES TO DILI, IMMEDIATELY
FREEDOM TO EAST TIMOR - TIMOR LOROSAE
------------------------------------------------------------
INESC, R. Jose Falcao 110   |   tel:    + 351 2 2094322
4050 Porto, Portugal        |   fax:    + 351 2 2008487

---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure