annotate liboctave/util/lo-ieee.cc @ 21202:f7121e111991

maint: indent #ifdef blocks in liboctave and src directories. * Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc, Array-voidp.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, CSparse.h, DiagArray2.cc, MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MDiagArray2.cc, MSparse-C.cc, MSparse-d.cc, MSparse.h, MatrixType.cc, PermMatrix.cc, Range.cc, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, boolMatrix.cc, boolNDArray.cc, boolSparse.cc, chMatrix.cc, chNDArray.cc, dColVector.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dSparse.h, dim-vector.cc, fCColVector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fColVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, idx-vector.cc, int16NDArray.cc, int32NDArray.cc, int64NDArray.cc, int8NDArray.cc, intNDArray.cc, uint16NDArray.cc, uint32NDArray.cc, uint64NDArray.cc, uint8NDArray.cc, blaswrap.c, cquit.c, f77-extern.cc, f77-fcn.c, f77-fcn.h, lo-error.c, quit.cc, quit.h, CmplxAEPBAL.cc, CmplxCHOL.cc, CmplxGEPBAL.cc, CmplxHESS.cc, CmplxLU.cc, CmplxQR.cc, CmplxQRP.cc, CmplxSCHUR.cc, CmplxSVD.cc, CollocWt.cc, DASPK.cc, DASRT.cc, DASSL.cc, EIG.cc, LSODE.cc, ODES.cc, Quad.cc, base-lu.cc, base-qr.cc, dbleAEPBAL.cc, dbleCHOL.cc, dbleGEPBAL.cc, dbleHESS.cc, dbleLU.cc, dbleQR.cc, dbleQRP.cc, dbleSCHUR.cc, dbleSVD.cc, eigs-base.cc, fCmplxAEPBAL.cc, fCmplxCHOL.cc, fCmplxGEPBAL.cc, fCmplxHESS.cc, fCmplxLU.cc, fCmplxQR.cc, fCmplxQRP.cc, fCmplxSCHUR.cc, fCmplxSVD.cc, fEIG.cc, floatAEPBAL.cc, floatCHOL.cc, floatGEPBAL.cc, floatHESS.cc, floatLU.cc, floatQR.cc, floatQRP.cc, floatSCHUR.cc, floatSVD.cc, lo-mappers.cc, lo-specfun.cc, oct-convn.cc, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-rand.cc, oct-spparms.cc, randgamma.c, randmtzig.c, randpoisson.c, sparse-chol.cc, sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, mx-defs.h, dir-ops.cc, file-ops.cc, file-stat.cc, lo-sysdep.cc, mach-info.cc, oct-env.cc, oct-group.cc, oct-openmp.h, oct-passwd.cc, oct-syscalls.cc, oct-time.cc, oct-uname.cc, pathlen.h, sysdir.h, syswait.h, cmd-edit.cc, cmd-hist.cc, data-conv.cc, f2c-main.c, glob-match.cc, lo-array-errwarn.cc, lo-array-gripes.cc, lo-cutils.c, lo-cutils.h, lo-ieee.cc, lo-math.h, lo-regexp.cc, lo-utils.cc, oct-base64.cc, oct-glob.cc, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.cc, oct-mutex.cc, oct-refcount.h, oct-rl-edit.c, oct-rl-hist.c, oct-shlib.cc, oct-sort.cc, pathsearch.cc, singleton-cleanup.cc, sparse-sort.cc, sparse-util.cc, statdefs.h, str-vec.cc, unwind-prot.cc, url-transfer.cc, display-available.h, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-config.in.cc, shared-fcns.h: indent #ifdef blocks in liboctave and src directories.
author Rik <rik@octave.org>
date Sat, 06 Feb 2016 06:40:13 -0800
parents 7cac4e7458f2
children 40de9f8f23a6
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
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19326
diff changeset
3 Copyright (C) 1996-2015 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: 5307
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: 5307
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: 5307
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: 5307
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 #ifdef HAVE_CONFIG_H
21202
f7121e111991 maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents: 21136
diff changeset
24 # include <config.h>
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
25 #endif
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
26
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
27 #include <cfloat>
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
28 #include <cmath>
9592
5828d64ca004 lo-ieee.cc: include cstdlib, update copyright date
John W. Eaton <jwe@octave.org>
parents: 9591
diff changeset
29 #include <cstdlib>
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
30
11234
2718e1fdf82f IEEE math initialization tweaks
John W. Eaton <jwe@octave.org>
parents: 11230
diff changeset
31 #include <limits>
2508
f8d5dbbbc50a [project @ 1996-11-13 17:21:07 by jwe]
jwe
parents: 1993
diff changeset
32
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
33 static double lo_inf;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
34 static double lo_nan;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
35 static double lo_na;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
36
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
37 static float lo_float_inf;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
38 static float lo_float_nan;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
39 static float lo_float_na;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
40
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
41 static int lo_ieee_hw;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
42 static int lo_ieee_lw;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
43
4698
737fd5c0ae06 [project @ 2004-01-19 19:25:26 by jwe]
jwe
parents: 4603
diff changeset
44 #include "lo-error.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
45 #include "lo-ieee.h"
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
46 #include "lo-math.h"
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3475
diff changeset
47 #include "mach-info.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
48
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
49 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
50 __lo_ieee_isnan (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
51 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
52 #if defined (HAVE_CMATH_ISNAN)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
53 return std::isnan (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
54 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
55 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
56 return isnan (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
57 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
58 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
59
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
60 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
61 __lo_ieee_finite (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
62 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
63 #if defined (HAVE_CMATH_ISFINITE)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
64 return std::isfinite (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
65 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
66 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
67 return finite (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
68 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
69 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
70
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
71 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
72 __lo_ieee_isinf (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
73 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
74 #if defined (HAVE_CMATH_ISINF)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
75 return std::isinf (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
76 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
77 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
78 return isinf (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
79 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
80 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
81
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
82 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
83 __lo_ieee_is_NA (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
84 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
85 lo_ieee_double t;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
86 t.value = x;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
87 return (__lo_ieee_isnan (x) && t.word[lo_ieee_hw] == LO_IEEE_NA_HW
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
88 && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
89 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
90
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
91 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
92 __lo_ieee_is_old_NA (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
93 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
94 lo_ieee_double t;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
95 t.value = x;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
96 return (__lo_ieee_isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
97 && t.word[lo_ieee_hw] == LO_IEEE_NA_HW_OLD) ? 1 : 0;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
98 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
99
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
100 double
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
101 __lo_ieee_replace_old_NA (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
102 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
103 if (__lo_ieee_is_old_NA (x))
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
104 return lo_ieee_na_value ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
105 else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
106 return x;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
107 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
108
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
109 double
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
110 lo_ieee_inf_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
111 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
112 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
113
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
114 return lo_inf;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
115 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
116
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
117 double
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
118 lo_ieee_na_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
119 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
120 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
121
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
122 return lo_na;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
123 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
124
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
125 double
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
126 lo_ieee_nan_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
127 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
128 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
129
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
130 return lo_nan;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
131 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
132
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
133 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
134 __lo_ieee_signbit (double x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
135 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
136 #if defined (HAVE_CMATH_SIGNBIT)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
137 return std::signbit (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
138 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
139 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
140 return signbit (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
141 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
142 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
143
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
144 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
145 __lo_ieee_float_isnan (float x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
146 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
147 #if defined (HAVE_CMATH_ISNAN)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
148 return std::isnan (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
149 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
150 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
151 return isnan (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
152 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
153 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
154
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
155 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
156 __lo_ieee_float_finite (float x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
157 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
158 #if defined (HAVE_CMATH_ISFINITE)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
159 return std::isfinite (x) != 0 && ! __lo_ieee_float_isnan (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
160 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
161 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
162 return finite (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
163 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
164 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
165
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
166 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
167 __lo_ieee_float_isinf (float x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
168 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
169 #if defined (HAVE_CMATH_ISINF)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
170 return std::isinf (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
171 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
172 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
173 return isinf (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
174 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
175 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
176
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
177 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
178 __lo_ieee_float_is_NA (float x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
179 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
180 lo_ieee_float t;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
181 t.value = x;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
182 return (__lo_ieee_float_isnan (x) && (t.word == LO_IEEE_NA_FLOAT)) ? 1 : 0;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
183 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
184
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
185 float
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
186 lo_ieee_float_inf_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
187 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
188 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
189
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
190 return lo_float_inf;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
191 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
192
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
193 float
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
194 lo_ieee_float_na_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
195 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
196 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
197
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
198 return lo_float_na;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
199 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
200
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
201 float
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
202 lo_ieee_float_nan_value (void)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
203 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
204 octave_ieee_init ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
205
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
206 return lo_float_nan;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
207 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
208
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
209 int
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
210 __lo_ieee_float_signbit (float x)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
211 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
212 #if defined (HAVE_CMATH_SIGNBIT)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
213 return std::signbit (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
214 #else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
215 // Gnulib provides.
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
216 return signbit (x);
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
217 #endif
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
218 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
219
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
220 void
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
221 octave_ieee_init (void)
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
222 {
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
223 bool initialized = false;
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
224
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
225 if (! initialized)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
226 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
227 oct_mach_info::float_format ff = oct_mach_info::native_float_format ();
4698
737fd5c0ae06 [project @ 2004-01-19 19:25:26 by jwe]
jwe
parents: 4603
diff changeset
228
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
229 switch (ff)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
230 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
231 case oct_mach_info::flt_fmt_ieee_big_endian:
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
232 case oct_mach_info::flt_fmt_ieee_little_endian:
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
233 {
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
234 lo_nan = std::numeric_limits<double>::quiet_NaN ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
235 lo_inf = std::numeric_limits<double>::infinity ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
236
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
237 lo_float_nan = std::numeric_limits<float>::quiet_NaN ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
238 lo_float_inf = std::numeric_limits<float>::infinity ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
239
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
240 // The following is patterned after code in R.
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3475
diff changeset
241
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
242 if (ff == oct_mach_info::flt_fmt_ieee_big_endian)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
243 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
244 lo_ieee_hw = 0;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
245 lo_ieee_lw = 1;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
246 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
247 else
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
248 {
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
249 lo_ieee_hw = 1;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
250 lo_ieee_lw = 0;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
251 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7231
diff changeset
252
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
253 lo_ieee_double t;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
254 t.word[lo_ieee_hw] = LO_IEEE_NA_HW;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
255 t.word[lo_ieee_lw] = LO_IEEE_NA_LW;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
256
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
257 lo_na = t.value;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
258
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
259 lo_ieee_float tf;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
260 tf.word = LO_IEEE_NA_FLOAT;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
261
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
262 lo_float_na = tf.value;
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
263 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
264 break;
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3475
diff changeset
265
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
266 default:
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
267 // If the format is unknown, then you will probably not have a
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
268 // useful system, so we will abort here. Anyone wishing to
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
269 // experiment with building Octave on a system without IEEE
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
270 // floating point should be capable of removing this check and
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
271 // the configure test.
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 19697
diff changeset
272 // FIXME: Should this be a warning so that abort is reached?
18540
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
273 (*current_liboctave_error_handler)
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
274 ("lo_ieee_init: floating point format is not IEEE! Maybe DLAMCH is miscompiled, or you are using some strange system without IEEE floating point math?");
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
275 abort ();
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
276 }
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
277
89bd70fae066 fix initialization problem for Inf, NaN, and NA values (bug #41667)
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
278 initialized = true;
4601
1ed6cfbc8ea4 [project @ 2003-11-12 18:30:29 by jwe]
jwe
parents: 4574
diff changeset
279 }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
280 }