annotate libinterp/octave-value/ov-magic-int.cc @ 28631:70cdf8de553d

move non-member octave_value operator functions to octave namespace * ov.h, ov.cc (unary_op, binary_op, cat_op, colon_op): New functions in octave namespace that replace do_unary_op, do_binary_op, do_cat_op, and do_colon_op, respectively. (do_unary_op, do_binary_op, do_cat_op, do_colon_op): Deprecate global functions. Forward to corresponding new functions in octave namespace. * bsxfun.cc, cellfun.cc, data.cc, dot.cc, fft.cc, oct-stream.cc, stack-frame.h, tril.cc, ov-base-diag.cc, ov-bool.cc, ov-class.cc, ov-complex.cc, ov-float.cc, ov-flt-complex.cc, ov-intx.h, ov-lazy-idx.h, ov-magic-int.cc, ov-perm.cc, ov-range.cc, ov-scalar.cc, oct-lvalue.cc, oct-lvalue.h, pt-binop.cc, pt-cbinop.cc, pt-colon.cc, pt-eval.cc, pt-tm-const.cc, pt-unop.cc: Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 30 Jul 2020 16:16:04 -0400
parents c83e0c850386
children bbff46267cad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 ////////////////////////////////////////////////////////////////////////
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 // Copyright (C) 2020 The Octave Project Developers
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 // distribution or <https://octave.org/copyright/>.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 // This file is part of Octave.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 // under the terms of the GNU General Public License as published by
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 // (at your option) any later version.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 // GNU General Public License for more details.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 // along with Octave; see the file COPYING. If not, see
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 // <https://www.gnu.org/licenses/>.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 //
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 ////////////////////////////////////////////////////////////////////////
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if defined (HAVE_CONFIG_H)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 # include "config.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #endif
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <istream>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <ostream>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "oct-inttypes.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "data-conv.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 #include "mach-info.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "lo-specfun.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 #include "lo-mappers.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 #include "defun.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 #include "errwarn.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 #include "mxarray.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 #include "ovl.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 #include "oct-hdf5.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 #include "oct-stream.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 #include "ov-scalar.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 #include "ov-float.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 #include "ov-base.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 #include "ov-magic-int.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 #include "ov-base-scalar.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 #include "ov-re-mat.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 #include "ov-typeinfo.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 #include "pr-output.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 #include "xdiv.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 #include "xpow.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 #include "ops.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 #include "ls-oct-text.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 #include "ls-hdf5.h"
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 // NOTE: Although there is some additional overhead, for all but the
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 // simplest data type extraction operations, we convert to an
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 // octave_scalar object and forward the operation to avoid code
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 // duplication and ensure that operations on magic_int objects are
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 // identical to operations on octave_scalar objects. We could also
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 // avoid code duplication by deriving octave_magic_int from
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 // octave_scalar, but then we would need to store both the double and
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 // octave_uint64 or octave_int64 values, doubling the storage
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 // requirement.
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 static octave_base_value *
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 default_numeric_conv_fcn (const octave_base_value& a)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 return new octave_scalar (a.double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 octave_base_magic_int<T>::do_index_op (const octave_value_list& idx,
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 bool resize_ok)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83
28631
70cdf8de553d move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents: 28591
diff changeset
84 return tmp.index_op (idx, resize_ok);
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 idx_vector
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 octave_base_magic_int<T>::index_vector (bool require_integers) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 return tmp.index_vector (require_integers);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 octave_base_magic_int<T>::resize (const dim_vector& dv, bool fill) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 return tmp.resize (dv, fill);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 octave_base_magic_int<T>::as_double (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 return static_cast<double> (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 octave_base_magic_int<T>::as_single (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 return static_cast<float> (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 octave_base_magic_int<T>::as_int8 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 return octave_int8 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 octave_base_magic_int<T>::as_int16 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130 return octave_int16 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135 octave_base_magic_int<T>::as_int32 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 return octave_int32 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 octave_base_magic_int<T>::as_int64 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144 return octave_int64 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
149 octave_base_magic_int<T>::as_uint8 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151 return octave_uint8 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 octave_base_magic_int<T>::as_uint16 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 return octave_uint16 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163 octave_base_magic_int<T>::as_uint32 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 return octave_uint32 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 octave_base_magic_int<T>::as_uint64 (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 return octave_uint64 (scalar_ref ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 octave_base_magic_int<T>::diag (octave_idx_type m, octave_idx_type n) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 return tmp.diag (m, n);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186 octave_base_magic_int<T>::convert_to_str_internal (bool, bool, char type) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188 octave_value retval;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190 int ival;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 if (scalar_ref ().value () > std::numeric_limits<unsigned char>::max ())
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194 // FIXME: is there something better we could do?
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196 ival = 0;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 ::warning ("range error for conversion to character value");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 else
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201 ival = scalar_ref ().value ();
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203 retval = octave_value (std::string (1, static_cast<char> (ival)), type);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 return retval;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 octave_base_magic_int<T>::save_ascii (std::ostream& os)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 return tmp.save_ascii (os);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 octave_base_magic_int<T>::load_ascii (std::istream&)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 error ("octave_base_magic_int<T>::load_ascii: internal error");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 return false;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229 octave_base_magic_int<T>::save_binary (std::ostream& os, bool save_as_floats)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 return tmp.save_binary (os, save_as_floats);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 octave_base_magic_int<T>::load_binary (std::istream&, bool,
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 octave::mach_info::float_format)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 error ("octave_base_magic_int<T>::load_binary: internal error");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243 return false;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
248 octave_base_magic_int<T>::save_hdf5 (octave_hdf5_id loc_id, const char *name,
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249 bool save_as_floats)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
250 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
251 bool retval = false;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
252
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253 #if defined (HAVE_HDF5)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257 return tmp.save_hdf5 (loc_id, name, save_as_floats);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
258
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259 #else
28591
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
260
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261 octave_unused_parameter (loc_id);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 octave_unused_parameter (name);
28591
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
263 octave_unused_parameter (save_as_floats);
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264
28591
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
265 octave_base_value::warn_save ("hdf5");
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
266
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 #endif
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
269 return retval;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 bool
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
274 octave_base_magic_int<T>::load_hdf5 (octave_hdf5_id, const char *)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 #if defined (HAVE_HDF5)
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278 error ("octave_base_magic_int<T>::load_binary: internal error");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280 return false;
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282 #else
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283
28591
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
284 octave_base_value::warn_load ("hdf5");
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 return false;
28591
c83e0c850386 * ov-magic-int.cc: Allow compilation to succeed if HDF5 is not available.
John W. Eaton <jwe@octave.org>
parents: 28588
diff changeset
287
28588
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
288 #endif
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
289 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
291 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 mxArray *
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293 octave_base_magic_int<T>::as_mxArray (bool interleaved) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
297 return tmp.as_mxArray (interleaved);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
299
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 template <typename T>
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301 octave_value
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 octave_base_magic_int<T>::map (octave_base_value::unary_mapper_t umap) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
304 octave_value tmp (double_value ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
305
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306 return tmp.map (umap);
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
307 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_magic_uint, "magic_uint",
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
310 "double");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
311
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
312 octave_base_value::type_conv_info
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
313 octave_magic_uint::numeric_conversion_function (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
314 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315 return octave_base_value::type_conv_info (default_numeric_conv_fcn,
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
316 octave_scalar::static_type_id ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317 }
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
318
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
319 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_magic_int, "magic_int",
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320 "double");
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
321
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322 octave_base_value::type_conv_info
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323 octave_magic_int::numeric_conversion_function (void) const
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 {
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 return octave_base_value::type_conv_info (default_numeric_conv_fcn,
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
326 octave_scalar::static_type_id ());
ee9b1081471f allow integer constants > flintmax to be represented exactly (bug #45945)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327 }