Mercurial > octave-libgccjit
diff scripts/time/datestr.m @ 18650: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 | 2ff47214de72 |
children | 7bbe3658c5ef |
line wrap: on
line diff
--- a/scripts/time/datestr.m Wed Apr 16 05:57:06 2014 -0700 +++ b/scripts/time/datestr.m Tue Apr 15 14:12:56 2014 -0400 @@ -252,7 +252,8 @@ df = regexprep (df, '[Ss][Ss]', "%S"); - df = strrep (df, "FFF", sprintf ("%03d", 1000 * (v(i,6) - fix (v(i,6))))); + df = strrep (df, "FFF", sprintf ("%03d", + round (1000 * (v(i,6) - fix (v(i,6)))))); df = strrep (df, 'QQ', sprintf ("Q%d", fix ((v(i,2) + 2) / 3)));