[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #9065] octave::math::min and max template
From: |
Carnë Draug |
Subject: |
[Octave-patch-tracker] [patch #9065] octave::math::min and max template ignore isnan |
Date: |
Tue, 2 Aug 2016 03:29:38 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.gnu.org/patch/?9065>
Summary: octave::math::min and max template ignore isnan
Project: GNU Octave
Submitted by: carandraug
Submitted on: Tue 02 Aug 2016 03:29:36 AM GMT
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Octaves definition of min is the smallest of the non NaN values, but
liboctave's templated octave::math::min function does not behave that way.
Instead, it behaves like std::min and we have a specialization for double and
float.
This is confusing because: 1) the template behaviour is different from Octave,
2) the specialization actually changes the english definition of Octave's min
(given another type, other than double and low, with a concept of nan, min
would not consider the nan value). An actual example:
long double x = 5;
long double y = NAN;
double r = octave::math::min (x, y); // incorrectly returns NAN
I tried to change this so that the general template does check for nan, while
keeping the specialization for octave_int.
This caused problems with int and short because they are missing isnan. These
were required because Octave declares MArray<int> and MArray<short> so I
defined isnan for int and short (although I'm not sure why, MArray<int> and
MArray<short>, are not used anywhere and we already have Marray for all the
octave_int --- or why do we have octave_int at all?).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?9065>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-patch-tracker] [patch #9065] octave::math::min and max template ignore isnan,
Carnë Draug <=