diff libinterp/octave-value/ov.h @ 28588:ee9b1081471f

allow integer constants > flintmax to be represented exactly (bug #45945) * ov-magic-int.h, ov-magic-int.cc: New files to provide "magic" integer data type that can store integer constants larger than flintmax but that behaves like a double constant in nearly all cases. The primary exception is when the value is processed by the int64 and uint64 functions. * libinterp/octave-value/module.mk: Update. * op-mi.cc: New file. Provide unary + and - operators for magic integers so that explicit positive or negative magic integers will work as expected. * libinterp/operators/module.mk: Update. * ov-base.h (octave_base_value::is_magic_int): New virtual function. * ov.h, ov.cc (octave_value::is_magic_int): New function. (octave_value::storable_value, octave_value::make_storable_value): Also handle magic integer values. (octave_value::install_types): Install octave_magic_int and octave_magic_uint types. * lex.ll (flintmax): New static function. (base_lexer::handle_number<10>): Create magic integers from constants that contain only digits and have values in the range flintmax to std::numeric_limits<uint64_t>::max(). * pt-eval.cc (tree_evaluator::bind_ans): Display stored value.
author John W. Eaton <jwe@octave.org>
date Mon, 20 Jul 2020 17:43:16 -0400
parents b743a63e2dab
children 70cdf8de553d
line wrap: on
line diff
--- a/libinterp/octave-value/ov.h	Fri Jul 17 14:36:47 2020 -0700
+++ b/libinterp/octave-value/ov.h	Mon Jul 20 17:43:16 2020 -0400
@@ -631,6 +631,9 @@
   bool is_magic_colon (void) const
   { return rep->is_magic_colon (); }
 
+  bool is_magic_int (void) const
+  { return rep->is_magic_int (); }
+
   bool isnull (void) const
   { return rep->isnull (); }