comparison 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
comparison
equal deleted inserted replaced
6401:f8cbc0871ed6 6402:fe9817a6ee98
209 octave_int (void) : ival () { } 209 octave_int (void) : ival () { }
210 210
211 template <class U> 211 template <class U>
212 octave_int (U i) : ival (OCTAVE_INT_FIT_TO_RANGE (i, T)) { } 212 octave_int (U i) : ival (OCTAVE_INT_FIT_TO_RANGE (i, T)) { }
213 213
214 octave_int (double d) : ival (OCTAVE_INT_FIT_TO_RANGE (xround (d), T)) { }
215
214 octave_int (bool b) : ival (b) { } 216 octave_int (bool b) : ival (b) { }
215 217
216 template <class U> 218 template <class U>
217 octave_int (const octave_int<U>& i) 219 octave_int (const octave_int<U>& i)
218 : ival (OCTAVE_INT_FIT_TO_RANGE (i.value (), T)) { } 220 : ival (OCTAVE_INT_FIT_TO_RANGE (i.value (), T)) { }
422 octave_int<typename octave_int_binop_traits<T1, T2>::TR> 424 octave_int<typename octave_int_binop_traits<T1, T2>::TR>
423 operator / (const octave_int<T1>& x, const octave_int<T2>& y) 425 operator / (const octave_int<T1>& x, const octave_int<T2>& y)
424 { 426 {
425 double tx = static_cast<double> (x.value ()); 427 double tx = static_cast<double> (x.value ());
426 double ty = static_cast<double> (y.value ()); 428 double ty = static_cast<double> (y.value ());
427 double r = (tx == 0 && ty == 0) ? 0 : tx / ty; 429 double r = (tx == 0 && ty == 0) ? 0 : xround (tx / ty);
428 return OCTAVE_INT_FIT_TO_RANGE2 (r, T1, T2); 430 return OCTAVE_INT_FIT_TO_RANGE2 (r, T1, T2);
429 } 431 }
430 432
431 #define OCTAVE_INT_DOUBLE_BIN_OP(OP) \ 433 #define OCTAVE_INT_DOUBLE_BIN_OP(OP) \
432 template <class T> \ 434 template <class T> \