Mercurial > hg > octave-nkf
changeset 8904:4de5544a1d1d
simplify also float version of xmin/xmax
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 03 Mar 2009 13:39:32 +0100 |
parents | c174a1fc3fde |
children | 24dd61b36591 |
files | liboctave/ChangeLog liboctave/lo-mappers.cc |
diffstat | 2 files changed, 6 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2009-03-03 Jaroslav Hajek <highegg@gmail.com> + + * lo-mappers.cc (xmin (float, float), xmax (float, float)): Simplify. + 2009-03-02 Jaroslav Hajek <highegg@gmail.com> * mx-inlines.cc: Add missing #include.
--- a/liboctave/lo-mappers.cc +++ b/liboctave/lo-mappers.cc @@ -561,39 +561,13 @@ float xmin (float x, float y) { - if (x < y) - return x; - - if (y <= x) - return y; - - if (xisnan (x) && ! xisnan (y)) - return y; - else if (xisnan (y) && ! xisnan (x)) - return x; - else if (octave_is_NA (x) || octave_is_NA (y)) - return octave_Float_NA; - else - return octave_Float_NaN; + return xisnan (y) ? x : (x <= y ? x : y); } float xmax (float x, float y) { - if (x > y) - return x; - - if (y >= x) - return y; - - if (xisnan (x) && ! xisnan (y)) - return y; - else if (xisnan (y) && ! xisnan (x)) - return x; - else if (octave_is_NA (x) || octave_is_NA (y)) - return octave_Float_NA; - else - return octave_Float_NaN; + return xisnan (y) ? x : (x >= y ? x : y); } // complex -> complex mappers.