diff liboctave/oct-inttypes.h @ 5029:1ec26bdb120c

[project @ 2004-09-23 16:58:57 by jwe]
author jwe
date Thu, 23 Sep 2004 17:01:13 +0000
parents 52f808101130
children 160365410ad4
line wrap: on
line diff
--- a/liboctave/oct-inttypes.h
+++ b/liboctave/oct-inttypes.h
@@ -462,6 +462,38 @@
 OCTAVE_DOUBLE_INT_BIN_OP(*)
 OCTAVE_DOUBLE_INT_BIN_OP(/)
 
+#define OCTAVE_INT_DOUBLE_CMP_OP(OP) \
+  template <class T> \
+  bool \
+  operator OP (const octave_int<T>& x, const double& y) \
+  { \
+    double tx = static_cast<double> (x.value ()); \
+    return tx OP y.value (); \
+  }
+
+OCTAVE_INT_DOUBLE_CMP_OP (<)
+OCTAVE_INT_DOUBLE_CMP_OP (<=)
+OCTAVE_INT_DOUBLE_CMP_OP (>=)
+OCTAVE_INT_DOUBLE_CMP_OP (>)
+OCTAVE_INT_DOUBLE_CMP_OP (==)
+OCTAVE_INT_DOUBLE_CMP_OP (!=)
+
+#define OCTAVE_DOUBLE_INT_CMP_OP(OP) \
+  template <class T> \
+  bool \
+  operator OP (const double& x, const octave_int<T>& y) \
+  { \
+    double ty = static_cast<double> (y.value ()); \
+    return y.value () OP ty; \
+  }
+
+OCTAVE_DOUBLE_INT_CMP_OP (<)
+OCTAVE_DOUBLE_INT_CMP_OP (<=)
+OCTAVE_DOUBLE_INT_CMP_OP (>=)
+OCTAVE_DOUBLE_INT_CMP_OP (>)
+OCTAVE_DOUBLE_INT_CMP_OP (==)
+OCTAVE_DOUBLE_INT_CMP_OP (!=)
+
 #define OCTAVE_INT_BITCMP_OP(OP) \
  \
   template <class T> \