Mercurial > hg > octave-nkf
changeset 5042:3914c4ad3ffa
[project @ 2004-10-01 19:59:40 by jwe]
author | jwe |
---|---|
date | Fri, 01 Oct 2004 19:59:40 +0000 |
parents | b2ce28713791 |
children | a0da258f64e6 |
files | src/ChangeLog src/ov-range.h src/ov-scalar.h |
diffstat | 3 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2004-10-01 John W. Eaton <jwe@octave.org> + + * ov-range.h (octave_range::valid_as_scalar_index): Ensure int value. + (octave_range::valid_as_zero_index): Likewise. + + * ov-scalar.h (octave_scalar::valid_as_scalar_index): Ensure int value. + (octave_scalar::valid_as_zero_index): Likewise. + 2004-09-24 John W. Eaton <jwe@octave.org> * version.h (OCTAVE_VERSION): Now 2.1.60.
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -130,16 +130,16 @@ bool valid_as_scalar_index (void) const { + double b = range.base (); return (range.nelem () == 1 - && ! xisnan (range.base ()) - && NINT (range.base ()) == 1); + && ! xisnan (b) && D_NINT (b) == b && NINT (b) == 1); } bool valid_as_zero_index (void) const { + double b = range.base (); return (range.nelem () == 1 - && ! xisnan (range.base ()) - && NINT (range.base ()) == 0); + && ! xisnan (b) && D_NINT (b) == b && NINT (b) == 0); } bool is_numeric_type (void) const { return true; }
--- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -82,10 +82,18 @@ bool is_real_type (void) const { return true; } bool valid_as_scalar_index (void) const - { return (! xisnan (scalar) && NINT (scalar) == 1); } + { + return (! xisnan (scalar) + && D_NINT (scalar) == scalar + && NINT (scalar) == 1); + } bool valid_as_zero_index (void) const - { return (! xisnan (scalar) && NINT (scalar) == 0); } + { + return (! xisnan (scalar) + && D_NINT (scalar) == scalar + && NINT (scalar) == 0); + } double double_value (bool = false) const { return scalar; }