diff liboctave/oct-inttypes.h @ 6402:fe9817a6ee98

[project @ 2007-03-13 02:25:31 by jwe]
author jwe
date Tue, 13 Mar 2007 02:25:31 +0000
parents 143b556ce725
children 7e958a1532c6
line wrap: on
line diff
--- a/liboctave/oct-inttypes.h	Fri Mar 09 15:34:45 2007 +0000
+++ b/liboctave/oct-inttypes.h	Tue Mar 13 02:25:31 2007 +0000
@@ -211,6 +211,8 @@
   template <class U>
   octave_int (U i) : ival (OCTAVE_INT_FIT_TO_RANGE (i, T)) { }
 
+  octave_int (double d) : ival (OCTAVE_INT_FIT_TO_RANGE (xround (d), T)) { }
+
   octave_int (bool b) : ival (b) { }
 
   template <class U>
@@ -424,7 +426,7 @@
 {
   double tx = static_cast<double> (x.value ());
   double ty = static_cast<double> (y.value ());
-  double r = (tx == 0 && ty == 0) ? 0 : tx / ty;
+  double r = (tx == 0 && ty == 0) ? 0 : xround (tx / ty);
   return OCTAVE_INT_FIT_TO_RANGE2 (r, T1, T2);
 }