Mercurial > hg > octave-shane
changeset 7576:7ebdc99a0bab
new isfloat function
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 10 Mar 2008 22:24:49 -0400 |
parents | d20a2f261306 |
children | ba8fcc115fee |
files | src/ChangeLog src/data.cc src/ov-base.h src/ov-complex.h src/ov-cx-mat.h src/ov-cx-sparse.h src/ov-range.h src/ov-re-mat.h src/ov-re-sparse.h src/ov-scalar.h src/ov.h |
diffstat | 11 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2008-03-10 John W. Eaton <jwe@octave.org> + * data.cc (Fisfloat): New function. + * ov.h (octave_value::is_float_type): Ditto. + * ov-base.h (octave_base_value::is_float_type): Ditto. + * ov-complex.h (octave_complex): Ditto. + * ov-cx-mat.h (octave_complex_matrix): Ditto. + * ov-cx-sparse.h (octave_sparse_complex_matrix): Ditto. + * ov-range.h (octave_range): Ditto. + * ov-re-mat.h (octave_matrix): Ditto. + * ov-re-sparse.h (octave_sparse_matrix): Ditto. + * ov-scalar.h (octave_scalar): Ditto. + * mxarray.h.in (mxLogical): Use unsigned char instead of int. From Antwerpen, G. (Gert) van <gert.vanantwerpen@tno.nl>.
--- a/src/data.cc +++ b/src/data.cc @@ -1870,6 +1870,22 @@ return retval; } +DEFUN (isfloat, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} isfloat (@var{x})\n\ +Return true if @var{x} is a floating-point numeric object.\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 1) + retval = args(0).is_float_type (); + else + print_usage (); + + return retval; +} + // FIXME -- perhaps this should be implemented with an // octave_value member function?
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -242,6 +242,8 @@ virtual bool is_single_type (void) const { return false; } + virtual bool is_float_type (void) const { return false; } + virtual bool is_int8_type (void) const { return false; } virtual bool is_int16_type (void) const { return false; }
--- a/src/ov-complex.h +++ b/src/ov-complex.h @@ -91,6 +91,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + // FIXME ??? bool valid_as_scalar_index (void) const { return false; } bool valid_as_zero_index (void) const { return false; }
--- a/src/ov-cx-mat.h +++ b/src/ov-cx-mat.h @@ -98,6 +98,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + bool valid_as_scalar_index (void) const; double double_value (bool = false) const;
--- a/src/ov-cx-sparse.h +++ b/src/ov-cx-sparse.h @@ -104,6 +104,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + bool valid_as_scalar_index (void) const; double double_value (bool = false) const;
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -143,6 +143,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + bool valid_as_scalar_index (void) const { double b = range.base ();
--- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -97,6 +97,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + bool valid_as_scalar_index (void) const; int8NDArray
--- a/src/ov-re-sparse.h +++ b/src/ov-re-sparse.h @@ -100,6 +100,8 @@ bool is_double_type (void) const { return true; } + bool is_float_type (void) const { return true; } + bool valid_as_scalar_index (void) const; double double_value (bool = false) const;