Mercurial > hg > qm-dsp
comparison ext/clapack/src/ieeeck.c @ 427:905e45637745
Add the CLAPACK and CBLAS/F2C-BLAS files we use
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 30 Sep 2016 15:51:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
426:a23b9f8b4a59 | 427:905e45637745 |
---|---|
1 /* ieeeck.f -- translated by f2c (version 20061008). | |
2 You must link the resulting object file with libf2c: | |
3 on Microsoft Windows system, link with libf2c.lib; | |
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm | |
5 or, if you install libf2c.a in a standard place, with -lf2c -lm | |
6 -- in that order, at the end of the command line, as in | |
7 cc *.o -lf2c -lm | |
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., | |
9 | |
10 http://www.netlib.org/f2c/libf2c.zip | |
11 */ | |
12 | |
13 #include "f2c.h" | |
14 #include "blaswrap.h" | |
15 | |
16 integer ieeeck_(integer *ispec, real *zero, real *one) | |
17 { | |
18 /* System generated locals */ | |
19 integer ret_val; | |
20 | |
21 /* Local variables */ | |
22 real nan1, nan2, nan3, nan4, nan5, nan6, neginf, posinf, negzro, newzro; | |
23 | |
24 | |
25 /* -- LAPACK auxiliary routine (version 3.2) -- */ | |
26 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ | |
27 /* November 2006 */ | |
28 | |
29 /* .. Scalar Arguments .. */ | |
30 /* .. */ | |
31 | |
32 /* Purpose */ | |
33 /* ======= */ | |
34 | |
35 /* IEEECK is called from the ILAENV to verify that Infinity and */ | |
36 /* possibly NaN arithmetic is safe (i.e. will not trap). */ | |
37 | |
38 /* Arguments */ | |
39 /* ========= */ | |
40 | |
41 /* ISPEC (input) INTEGER */ | |
42 /* Specifies whether to test just for inifinity arithmetic */ | |
43 /* or whether to test for infinity and NaN arithmetic. */ | |
44 /* = 0: Verify infinity arithmetic only. */ | |
45 /* = 1: Verify infinity and NaN arithmetic. */ | |
46 | |
47 /* ZERO (input) REAL */ | |
48 /* Must contain the value 0.0 */ | |
49 /* This is passed to prevent the compiler from optimizing */ | |
50 /* away this code. */ | |
51 | |
52 /* ONE (input) REAL */ | |
53 /* Must contain the value 1.0 */ | |
54 /* This is passed to prevent the compiler from optimizing */ | |
55 /* away this code. */ | |
56 | |
57 /* RETURN VALUE: INTEGER */ | |
58 /* = 0: Arithmetic failed to produce the correct answers */ | |
59 /* = 1: Arithmetic produced the correct answers */ | |
60 | |
61 /* .. Local Scalars .. */ | |
62 /* .. */ | |
63 /* .. Executable Statements .. */ | |
64 ret_val = 1; | |
65 | |
66 posinf = *one / *zero; | |
67 if (posinf <= *one) { | |
68 ret_val = 0; | |
69 return ret_val; | |
70 } | |
71 | |
72 neginf = -(*one) / *zero; | |
73 if (neginf >= *zero) { | |
74 ret_val = 0; | |
75 return ret_val; | |
76 } | |
77 | |
78 negzro = *one / (neginf + *one); | |
79 if (negzro != *zero) { | |
80 ret_val = 0; | |
81 return ret_val; | |
82 } | |
83 | |
84 neginf = *one / negzro; | |
85 if (neginf >= *zero) { | |
86 ret_val = 0; | |
87 return ret_val; | |
88 } | |
89 | |
90 newzro = negzro + *zero; | |
91 if (newzro != *zero) { | |
92 ret_val = 0; | |
93 return ret_val; | |
94 } | |
95 | |
96 posinf = *one / newzro; | |
97 if (posinf <= *one) { | |
98 ret_val = 0; | |
99 return ret_val; | |
100 } | |
101 | |
102 neginf *= posinf; | |
103 if (neginf >= *zero) { | |
104 ret_val = 0; | |
105 return ret_val; | |
106 } | |
107 | |
108 posinf *= posinf; | |
109 if (posinf <= *one) { | |
110 ret_val = 0; | |
111 return ret_val; | |
112 } | |
113 | |
114 | |
115 | |
116 | |
117 /* Return if we were only asked to check infinity arithmetic */ | |
118 | |
119 if (*ispec == 0) { | |
120 return ret_val; | |
121 } | |
122 | |
123 nan1 = posinf + neginf; | |
124 | |
125 nan2 = posinf / neginf; | |
126 | |
127 nan3 = posinf / posinf; | |
128 | |
129 nan4 = posinf * *zero; | |
130 | |
131 nan5 = neginf * negzro; | |
132 | |
133 nan6 = nan5 * 0.f; | |
134 | |
135 if (nan1 == nan1) { | |
136 ret_val = 0; | |
137 return ret_val; | |
138 } | |
139 | |
140 if (nan2 == nan2) { | |
141 ret_val = 0; | |
142 return ret_val; | |
143 } | |
144 | |
145 if (nan3 == nan3) { | |
146 ret_val = 0; | |
147 return ret_val; | |
148 } | |
149 | |
150 if (nan4 == nan4) { | |
151 ret_val = 0; | |
152 return ret_val; | |
153 } | |
154 | |
155 if (nan5 == nan5) { | |
156 ret_val = 0; | |
157 return ret_val; | |
158 } | |
159 | |
160 if (nan6 == nan6) { | |
161 ret_val = 0; | |
162 return ret_val; | |
163 } | |
164 | |
165 return ret_val; | |
166 } /* ieeeck_ */ |