# HG changeset patch # User John W. Eaton # Date 1397695533 14400 # Node ID 7d0014bb9e4e5b19d5c8cdc61b1aebb0e3f8bdf2 # Parent 3647db1a37d7513b32f37a3723412f0721f3e52b also switch from unsigned integer to real format for negative values * oct-stream.cc (ok_for_unsigned_int_conv): Return false if value is negative. diff -r 3647db1a37d7 -r 7d0014bb9e4e libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Wed Apr 16 20:44:00 2014 -0400 +++ b/libinterp/corefcn/oct-stream.cc Wed Apr 16 20:45:33 2014 -0400 @@ -2405,14 +2405,21 @@ ok_for_unsigned_int_conv (const octave_value& val) { if (val.is_integer_type ()) - return true; + { + // Easier than dispatching here... + + octave_value ov_is_ge_zero + = do_binary_op (octave_value::op_ge, val, octave_value (0.0)); + + return ov_is_ge_zero.is_true (); + } else { double dval = val.double_value (); uint64_t limit = std::numeric_limits::max (); - if (dval == xround (dval) && dval <= limit) + if (dval == xround (dval) && dval >= 0 && dval <= limit) return true; }