annotate liboctave/util/lo-ieee.h @ 27923:bd51beb6205e

update formatting of copyright notices * Use <https://octave.org/copyright/> instead of <https://octave.org/COPYRIGHT.html/>. * For consistency with other comments in the Octave sources, use C++-style comments for copyright blocks in C and C++ files. * Use delimiters above and below copyright blocks that are appropriate for the language used in the file. * Eliminate extra spacing inside copyright blocks. * lex.ll (looks_like_copyright): Also allow newlines and carriage returns before the word "Copyright". * scripts/mk-doc.pl (gethelp): Also skip empty comment lines. * bp-table.cc, type.m: Adjust tests.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Jan 2020 11:59:41 -0500
parents 1891570abac8
children 0a5b15007766
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 1996-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_lo_ieee_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
27 #define octave_lo_ieee_h 1
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
28
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
29 #include <cmath>
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
30
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
31 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
32
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
33 #if defined (__cplusplus)
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
34 extern "C" {
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
35 #endif
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
36
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
37 /* Octave's idea of infinity. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
38 #define octave_Inf (lo_ieee_inf_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
39
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
40 /* Octave's idea of a missing value. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
41 #define octave_NA (lo_ieee_na_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
42
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
43 /* Octave's idea of not a number. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
44 #define octave_NaN (lo_ieee_nan_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
45
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
46 /* Octave's idea of infinity. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
47 #define octave_Float_Inf (lo_ieee_float_inf_value ())
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
48
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
49 /* Octave's idea of a missing value. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
50 #define octave_Float_NA (lo_ieee_float_na_value ())
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
51
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
52 /* Octave's idea of not a number. */
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
53 #define octave_Float_NaN (lo_ieee_float_nan_value ())
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
54
21066
258c787cd9ce maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents: 20791
diff changeset
55 /* FIXME: This code assumes that a double has twice the
258c787cd9ce maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents: 20791
diff changeset
56 number of bits as an int */
5388
7099eb9841b4 [project @ 2005-06-14 20:04:31 by jwe]
jwe
parents: 5307
diff changeset
57
4075
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
58 typedef union
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
59 {
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
60 double value;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
61 unsigned int word[2];
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
62 } lo_ieee_double;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
63
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
64 typedef union
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
65 {
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
66 float value;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
67 unsigned int word;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
68 } lo_ieee_float;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
69
7991
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
70 #define LO_IEEE_NA_HW_OLD 0x7ff00000
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
71 #define LO_IEEE_NA_LW_OLD 1954
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
72 #define LO_IEEE_NA_HW 0x7FF840F4
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
73 #define LO_IEEE_NA_LW 0x40000000
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
74 #define LO_IEEE_NA_FLOAT 0x7FC207A2
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
75
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
76 extern OCTAVE_API void octave_ieee_init (void);
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
77
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
78 inline int __lo_ieee_isnan (double x) { return std::isnan (x); }
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
79 inline int __lo_ieee_finite (double x) { return std::isfinite (x); }
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
80 inline int __lo_ieee_isinf (double x) { return std::isinf (x); }
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
81
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
82 extern OCTAVE_API int __lo_ieee_is_NA (double);
7991
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
83 extern OCTAVE_API int __lo_ieee_is_old_NA (double);
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
84 extern OCTAVE_API double __lo_ieee_replace_old_NA (double);
4075
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
85
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
86 extern OCTAVE_API double lo_ieee_inf_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
87 extern OCTAVE_API double lo_ieee_na_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
88 extern OCTAVE_API double lo_ieee_nan_value (void);
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
89
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
90 inline int __lo_ieee_signbit (double x) { return std::signbit (x); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
91
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
92 inline int __lo_ieee_float_isnan (float x) { return std::isnan (x); }
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
93 inline int __lo_ieee_float_finite (float x) { return std::isfinite (x); }
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
94 inline int __lo_ieee_float_isinf (float x) { return std::isinf (x); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
95
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
96 extern OCTAVE_API int __lo_ieee_float_is_NA (float);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
97
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
98 extern OCTAVE_API float lo_ieee_float_inf_value (void);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
99 extern OCTAVE_API float lo_ieee_float_na_value (void);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
100 extern OCTAVE_API float lo_ieee_float_nan_value (void);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
101
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
102 inline int __lo_ieee_float_signbit (float x) { return std::signbit (x); }
4349
a6c22c2c9b09 [project @ 2003-02-21 18:59:07 by jwe]
jwe
parents: 4102
diff changeset
103
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
104 #if defined (__cplusplus)
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
105 }
2522
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
106 #endif
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
107
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
108 #define lo_ieee_isnan(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
109 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
110 ? __lo_ieee_float_isnan (x) : __lo_ieee_isnan (x))
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
111
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
112 #define lo_ieee_finite(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
113 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
114 ? __lo_ieee_float_finite (x) : __lo_ieee_finite (x))
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
115
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
116 #define lo_ieee_isinf(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
117 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
118 ? __lo_ieee_float_isinf (x) : __lo_ieee_isinf (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
119
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
120 #define lo_ieee_is_NA(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
121 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
122 ? __lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x))
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
123
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
124 #define lo_ieee_is_NaN_or_NA(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
125 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
126 ? __lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_NaN_or_NA (x))
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
127
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
128 #define lo_ieee_signbit(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
129 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
130 ? __lo_ieee_float_signbit (x) : __lo_ieee_signbit (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
131
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
132 #if defined (__cplusplus)
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
133
21734
11af9c03400c write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
134 namespace octave
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
135 {
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
136 template <typename T>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
137 struct numeric_limits
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
138 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
139 static T NA (void) { return static_cast<T> (0); }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
140 static T NaN (void) { return static_cast<T> (0); }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
141 static T Inf (void) { return static_cast<T> (0); }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
142 };
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
143
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
144 template <>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
145 struct numeric_limits<double>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
146 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
147 static double NA (void) { return octave_NA; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
148 static double NaN (void) { return octave_NaN; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
149 static double Inf (void) { return octave_Inf; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
150 };
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
151
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
152 template <>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
153 struct numeric_limits<float>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
154 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
155 static float NA (void) { return octave_Float_NA; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
156 static float NaN (void) { return octave_Float_NaN; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
157 static float Inf (void) { return octave_Float_Inf; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
158 };
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
159 }
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
160
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
161 #endif
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
162
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
163 #endif