Mercurial > hg > octave-nkf
comparison libinterp/octave-value/ov-range.cc @ 18805:491b0adfec95
compatibility fixes for printf integer format specifiers
Attempt to handle automatic conversion from integer floating point
format in a way that is more compatible with Matlab behavior,
including working properly for 64-bit integer values.
* ov-base-diag.cc, ov-base-diag.h, ov-base-scalar.cc,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-perm.cc,
ov-perm.h, ov-range.cc, ov-range.h:
Provide fast_elem_extract member function.
* oct-stream.cc, oct-stream.h
(printf_format_list::process_conversion): Ignore modifiers for integer
formats.
(printf_value_cache::curr_val): Store octave_value instead of NDArray.
(printf_value_cache::data): Delete.
(printf_value_cache::have_data): New member variable.
(printf_value_cache::get_next_value): Rename from double_value, return
individual value as an octave_value object instead of a double.
(is_nan_or_inf, ok_for_signed_int_conv, ok_for_unsigned_int_conv,
switch_to_g_format): New static functions.
(DO_DOUBLE_CONV_1, DO_DOUBLE_CONV): Delete macros.
(octave_base_stream::do_numeric_printf_conv): New function.
(octave_base_stream::do_printf): Move code for handling numeric
formats to do_numeric_printf_conv.
* datestr.m: Round value for %d format.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 15 Apr 2014 14:12:56 -0400 |
parents | bcd71a2531d3 |
children | 76478d2da117 |
comparison
equal
deleted
inserted
replaced
18804:7485f8a8e431 | 18805:491b0adfec95 |
---|---|
673 | 673 |
674 for (mwSize i = 0; i < nel; i++) | 674 for (mwSize i = 0; i < nel; i++) |
675 pr[i] = p[i]; | 675 pr[i] = p[i]; |
676 | 676 |
677 return retval; | 677 return retval; |
678 } | |
679 | |
680 octave_value | |
681 octave_range::fast_elem_extract (octave_idx_type n) const | |
682 { | |
683 return (n < range.nelem ()) | |
684 ? octave_value (range.elem (n)) : octave_value (); | |
678 } | 685 } |
679 | 686 |
680 DEFUN (allow_noninteger_range_as_index, args, nargout, | 687 DEFUN (allow_noninteger_range_as_index, args, nargout, |
681 "-*- texinfo -*-\n\ | 688 "-*- texinfo -*-\n\ |
682 @deftypefn {Built-in Function} {@var{val} =} allow_noninteger_range_as_index ()\n\ | 689 @deftypefn {Built-in Function} {@var{val} =} allow_noninteger_range_as_index ()\n\ |