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	Tue Mar 03 11:56:51 2009 +0100
+++ b/liboctave/ChangeLog	Tue Mar 03 13:39:32 2009 +0100
@@ -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	Tue Mar 03 11:56:51 2009 +0100
+++ b/liboctave/lo-mappers.cc	Tue Mar 03 13:39:32 2009 +0100
@@ -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.