Mercurial > octave
changeset 24296:3981e3a11150
eps: error if input is not of floating point type
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Thu, 23 Nov 2017 18:12:40 +0000 |
parents | 48e7efceb427 |
children | 9a1b193ddd01 |
files | libinterp/corefcn/data.cc |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc Thu Nov 23 16:27:02 2017 +0000 +++ b/libinterp/corefcn/data.cc Thu Nov 23 18:12:40 2017 +0000 @@ -4521,11 +4521,13 @@ FloatNDArray epsval = eps (arg0.float_array_value ()); retval = epsval; } - else + else if (arg0.is_double_type ()) { NDArray epsval = eps (arg0.array_value ()); retval = epsval; } + else + error ("eps: X must be of a floating point type"); } else retval = fill_matrix (args, std::numeric_limits<double>::epsilon (), @@ -4557,7 +4559,7 @@ %!assert (eps (single (NaN)), single (NaN)) %!assert (eps (single ([1/2 1 2 realmax("single") 0 realmin("single")/2 realmin("single")/16 Inf NaN])), %! single ([2^(-24) 2^(-23) 2^(-22) 2^104 2^(-149) 2^(-149) 2^(-149) NaN NaN])) - +%!error <X must be of a floating point type> eps (uint8 ([0 1 2])) */ DEFUN (pi, args, ,