annotate liboctave/lo-ieee.h @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents 12df7854fa7c
children d40349493d87
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
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
3 Copyright (C) 1996-2012 John W. Eaton
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
4
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
6
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
10 option) any later version.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
11
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
15 for more details.
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
16
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
17 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
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 <http://www.gnu.org/licenses/>.
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 */
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
22
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_liboctave_ieee_h)
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
24 #define octave_liboctave_ieee_h 1
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
25
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
26 #ifdef __cplusplus
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
27 extern "C" {
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
28 #endif
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
29
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
30 /* Octave's idea of infinity. */
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
31 extern OCTAVE_API double octave_Inf;
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
32
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
33 /* Octave's idea of a missing value. */
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
34 extern OCTAVE_API double octave_NA;
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
35
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
36 /* Octave's idea of not a number. */
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
37 extern OCTAVE_API double octave_NaN;
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4075
diff changeset
38
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
39 /* Octave's idea of infinity. */
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
40 extern OCTAVE_API float octave_Float_Inf;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
41
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
42 /* Octave's idea of a missing value. */
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
43 extern OCTAVE_API float octave_Float_NA;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
44
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
45 /* Octave's idea of not a number. */
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
46 extern OCTAVE_API float octave_Float_NaN;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
47
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5389
diff changeset
48 /* FIXME -- this code assumes that a double has twice the
5388
7099eb9841b4 [project @ 2005-06-14 20:04:31 by jwe]
jwe
parents: 5307
diff changeset
49 number of bits as an int */
7099eb9841b4 [project @ 2005-06-14 20:04:31 by jwe]
jwe
parents: 5307
diff changeset
50
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
51 extern OCTAVE_API int lo_ieee_hw;
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
52 extern OCTAVE_API int lo_ieee_lw;
4075
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
53
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
54 typedef union
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
55 {
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
56 double value;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
57 unsigned int word[2];
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
58 } lo_ieee_double;
9a2102864eb0 [project @ 2002-09-27 21:37:56 by jwe]
jwe
parents: 4074
diff changeset
59
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
60 typedef union
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
61 {
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
62 float value;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
63 unsigned int word;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
64 } lo_ieee_float;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
65
7991
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
66 #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
67 #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
68 #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
69 #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
70 #define LO_IEEE_NA_FLOAT 0x7FC207A2
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
71
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
72 extern OCTAVE_API void octave_ieee_init (void);
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
73
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
74 extern OCTAVE_API int __lo_ieee_isnan (double x);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
75 extern OCTAVE_API int __lo_ieee_finite (double x);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
76 extern OCTAVE_API int __lo_ieee_isinf (double x);
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
77
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
78 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
79 extern OCTAVE_API int __lo_ieee_is_old_NA (double);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
80 extern OCTAVE_API int __lo_ieee_is_NaN_or_NA (double) GCC_ATTR_DEPRECATED;
7991
139f47cf17ab Change NA value to support single to double precision conversion
David Bateman <dbateman@free.fr>
parents: 7814
diff changeset
81 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
82
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
83 extern OCTAVE_API double lo_ieee_inf_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
84 extern OCTAVE_API double lo_ieee_na_value (void);
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5775
diff changeset
85 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
86
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
87 extern OCTAVE_API int __lo_ieee_signbit (double);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
88
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
89 extern OCTAVE_API int __lo_ieee_float_isnan (float x);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
90 extern OCTAVE_API int __lo_ieee_float_finite (float x);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
91 extern OCTAVE_API int __lo_ieee_float_isinf (float x);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
92
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
93 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
94 extern OCTAVE_API int __lo_ieee_float_is_NaN_or_NA (float) GCC_ATTR_DEPRECATED;
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 float lo_ieee_float_inf_value (void);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
97 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
98 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
99
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
100 extern OCTAVE_API int __lo_ieee_float_signbit (float);
4349
a6c22c2c9b09 [project @ 2003-02-21 18:59:07 by jwe]
jwe
parents: 4102
diff changeset
101
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
102 #ifdef __cplusplus
4072
3cc39e3b8fa5 [project @ 2002-09-27 17:54:53 by jwe]
jwe
parents: 4025
diff changeset
103 }
2522
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
104 #endif
4f095783ee43 [project @ 1996-11-15 20:00:59 by jwe]
jwe
parents: 1993
diff changeset
105
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
106 #define lo_ieee_isnan(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
107 __lo_ieee_float_isnan (x) : __lo_ieee_isnan (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
108 #define lo_ieee_finite(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
109 __lo_ieee_float_finite (x) : __lo_ieee_finite (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
110 #define lo_ieee_isinf(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
111 __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
112
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
113
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
114 #define lo_ieee_is_NA(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
115 __lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
116 #define lo_ieee_is_NaN_or_NA(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
117 __lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_NaN_or_NA (x))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
118 #define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
119 __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
120
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
121 #endif