annotate liboctave/util/lo-ieee.h @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
1 /*
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
2
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 Copyright (C) 1996-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
6 or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
7
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
8
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
9 This file is part of Octave.
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
10
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23622
diff changeset
11 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23622
diff changeset
13 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 (at your option) any later version.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
15
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
17 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
19 GNU General Public License for more details.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
20
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
22 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23622
diff changeset
23 <https://www.gnu.org/licenses/>.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
24
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
25 */
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
26
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 #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
28 #define octave_lo_ieee_h 1
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
29
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
30 #include <cmath>
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
31
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
32 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
33
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
34 #if defined (__cplusplus)
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
35 extern "C" {
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
36 #endif
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
37
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
38 /* 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
39 #define octave_Inf (lo_ieee_inf_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
40
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
41 /* 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
42 #define octave_NA (lo_ieee_na_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
43
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
44 /* 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
45 #define octave_NaN (lo_ieee_nan_value ())
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
46
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
47 /* 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
48 #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
49
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
50 /* 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
51 #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
52
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
53 /* 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
54 #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
55
21066
258c787cd9ce maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents: 20791
diff changeset
56 /* 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
57 number of bits as an int */
5388
7099eb9841b4 [project @ 2005-06-14 20:04:31 by jwe]
jwe
parents: 5307
diff changeset
58
4075
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
59 typedef union
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
60 {
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
61 double value;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
62 unsigned int word[2];
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
63 } lo_ieee_double;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
64
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
65 typedef union
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
66 {
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
67 float value;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
68 unsigned int word;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
69 } lo_ieee_float;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
70
7991
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_HW_OLD 0x7ff00000
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_LW_OLD 1954
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_HW 0x7FF840F4
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_LW 0x40000000
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
75 #define LO_IEEE_NA_FLOAT 0x7FC207A2
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
76
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
77 extern OCTAVE_API void octave_ieee_init (void);
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
78
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
79 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
80 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
81 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
82
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
83 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
84 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
85 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
86
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
87 extern OCTAVE_API double lo_ieee_inf_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
88 extern OCTAVE_API double lo_ieee_na_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
89 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
90
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
91 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
92
23622
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_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
94 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
95 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
96
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
97 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
98
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
99 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
100 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
101 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
102
23622
0abe8d85ecce Use isnan, isinf, isfinite, signbit functions from C++ std lib.
Rik <rik@octave.org>
parents: 23220
diff changeset
103 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
104
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
105 #if defined (__cplusplus)
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
106 }
2522
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
107 #endif
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
108
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
109 #define lo_ieee_isnan(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
110 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
111 ? __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
112
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
113 #define lo_ieee_finite(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
114 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
115 ? __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
116
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
117 #define lo_ieee_isinf(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
118 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
119 ? __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
120
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
121 #define lo_ieee_is_NA(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
122 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
123 ? __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
124
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
125 #define lo_ieee_is_NaN_or_NA(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
126 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
127 ? __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
128
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
129 #define lo_ieee_signbit(x) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
130 (sizeof (x) == sizeof (float) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
131 ? __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
132
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
133 #if defined (__cplusplus)
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
134
21734
11af9c03400c write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
135 namespace octave
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
136 {
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
137 template <typename T>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
138 struct numeric_limits
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
139 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
140 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
141 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
142 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
143 };
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
144
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
145 template <>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
146 struct numeric_limits<double>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
147 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
148 static double NA (void) { return octave_NA; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
149 static double NaN (void) { return octave_NaN; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
150 static double Inf (void) { return octave_Inf; }
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
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
153 template <>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
154 struct numeric_limits<float>
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
155 {
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
156 static float NA (void) { return octave_Float_NA; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
157 static float NaN (void) { return octave_Float_NaN; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
158 static float Inf (void) { return octave_Float_Inf; }
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
159 };
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
160 }
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
161
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
162 #endif
14810
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
163
d40349493d87 provide template version of octave_NA
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
164 #endif