~ubuntu-branches/ubuntu/raring/blitz++/raring

« back to all changes in this revision

Viewing changes to blitz/numinquire.h

  • Committer: Bazaar Package Importer
  • Author(s): Konstantinos Margaritis
  • Date: 2005-02-28 20:25:01 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050228202501-3i4f2sknnprsqfhz
Tags: 1:0.8-4
Added missing build-depends (Closes: #297323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
2
 * blitz/numinquire.h    Numeric inquiry functions
3
3
 *
4
 
 * $Id: numinquire.h,v 1.1.1.1 2000/06/19 12:26:12 tveldhui Exp $
 
4
 * $Id: numinquire.h,v 1.4 2003/12/11 03:44:22 julianc Exp $
5
5
 *
6
 
 * Copyright (C) 1997-1999 Todd Veldhuizen <tveldhui@oonumerics.org>
 
6
 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License
21
21
 * For more information, please see the Blitz++ Home Page:
22
22
 *    http://oonumerics.org/blitz/
23
23
 *
24
 
 ***************************************************************************
25
 
 * $Log: numinquire.h,v $
26
 
 * Revision 1.1.1.1  2000/06/19 12:26:12  tveldhui
27
 
 * Imported sources
28
 
 *
29
 
 * Revision 1.2  1998/03/14 00:04:47  tveldhui
30
 
 * 0.2-alpha-05
31
 
 *
32
 
 * Revision 1.1  1997/07/16 14:51:20  tveldhui
33
 
 * Update: Alpha release 0.2 (Arrays)
34
 
 *
35
 
 */
 
24
 ***************************************************************************/
36
25
 
37
26
/*
38
27
 * These numeric inquiry functions are provided as an alternative
69
58
 * at link time.  TV 980226
70
59
 */
71
60
 
72
 
template<class T_numtype>
 
61
template<typename T_numtype>
73
62
struct _bz_OneZeroTraits {
74
63
    static inline T_numtype zero() { return 0; }
75
64
    static inline T_numtype one()  { return 1; }
100
89
 
101
90
#endif // BZ_HAVE_COMPLEX
102
91
 
103
 
template<class T>
 
92
template<typename T>
104
93
inline T zero(T)
105
94
{
106
95
    return _bz_OneZeroTraits<T>::zero();
107
96
}
108
97
 
109
 
template<class T>
 
98
template<typename T>
110
99
inline T one(T)
111
100
{
112
101
    return _bz_OneZeroTraits<T>::one();
113
102
}
114
103
 
115
 
template<class T>
 
104
template<typename T>
116
105
inline int digits(T)
117
106
{
118
107
    return numeric_limits<T>::digits;
119
108
}
120
109
 
121
 
template<class T>
 
110
template<typename T>
122
111
inline int digits10(T)
123
112
{
124
113
    return numeric_limits<T>::digits10;
125
114
}
126
115
 
127
 
template<class T>
 
116
template<typename T>
128
117
inline T epsilon(T) BZ_THROW
129
118
{
130
119
    return numeric_limits<T>::epsilon();
132
121
 
133
122
// neghuge() by Theodore Papadopoulo, to fix a problem with
134
123
// max() reductions.
135
 
template<class T>
 
124
template<typename T>
136
125
inline T neghuge(T) BZ_THROW
137
126
{
138
127
    return numeric_limits<T>::is_integer ?    numeric_limits<T>::min()
139
128
                                         : - numeric_limits<T>::max();
140
129
}
141
130
 
142
 
template<class T>
 
131
template<typename T>
143
132
inline T huge(T) BZ_THROW
144
133
{
145
134
    return numeric_limits<T>::max();
146
135
}
147
136
 
148
 
template<class T>
 
137
template<typename T>
149
138
inline T tiny(T) BZ_THROW
150
139
{
151
140
    return numeric_limits<T>::min();
152
141
}
153
142
 
154
 
template<class T>
 
143
template<typename T>
155
144
inline int max_exponent(T)
156
145
{
157
146
    return numeric_limits<T>::max_exponent;
158
147
}
159
148
 
160
 
template<class T>
 
149
template<typename T>
161
150
inline int min_exponent(T)
162
151
{
163
152
    return numeric_limits<T>::min_exponent;
164
153
}
165
154
 
166
 
template<class T>
 
155
template<typename T>
167
156
inline int min_exponent10(T)
168
157
{
169
158
    return numeric_limits<T>::min_exponent10;
170
159
}
171
160
 
172
 
template<class T>
 
161
template<typename T>
173
162
inline int max_exponent10(T)
174
163
{
175
164
    return numeric_limits<T>::max_exponent10;
176
165
}
177
166
 
178
 
template<class T>
 
167
template<typename T>
179
168
inline int precision(T)
180
169
{
181
170
    return numeric_limits<T>::digits10;
182
171
}
183
172
 
184
 
template<class T>
 
173
template<typename T>
185
174
inline int radix(T)
186
175
{
187
176
    return numeric_limits<T>::radix;
188
177
}
189
178
 
190
 
template<class T>
 
179
template<typename T>
191
180
inline Range range(T)
192
181
{
193
182
    return Range(numeric_limits<T>::min_exponent10, 
194
183
        numeric_limits<T>::max_exponent10);
195
184
}
196
185
 
197
 
template<class T>
198
 
inline bool is_signed(T)
199
 
{
 
186
template<typename T>
 
187
inline bool is_signed(T) {
200
188
    return numeric_limits<T>::is_signed;
201
189
}
202
190
 
203
 
template<class T>
204
 
inline bool is_integer(T)
205
 
{
 
191
template<typename T>
 
192
inline bool is_integer(T) {
206
193
    return numeric_limits<T>::is_integer;
207
194
}
208
195
 
209
 
template<class T>
210
 
inline bool is_exact(T)
211
 
{
 
196
template<typename T>
 
197
inline bool is_exact(T) {
212
198
    return numeric_limits<T>::is_exact;
213
199
}
214
200
 
215
 
template<class T>
 
201
template<typename T>
216
202
inline T round_error(T) BZ_THROW
217
203
{
218
204
    return numeric_limits<T>::round_error();
219
205
}
220
206
 
221
 
template<class T>
222
 
inline bool has_infinity(T) 
223
 
{
 
207
template<typename T>
 
208
inline bool has_infinity(T) {
224
209
    return numeric_limits<T>::has_infinity;
225
210
}
226
211
 
227
 
template<class T>
228
 
inline bool has_quiet_NaN(T)
229
 
{
 
212
template<typename T>
 
213
inline bool has_quiet_NaN(T) {
230
214
    return numeric_limits<T>::has_quiet_NaN;
231
215
}
232
216
 
233
 
template<class T>
234
 
inline bool has_signaling_NaN(T)
235
 
{
 
217
template<typename T>
 
218
inline bool has_signaling_NaN(T) {
236
219
    return numeric_limits<T>::has_signaling_NaN;
237
220
}
238
221
 
239
222
// Provided for non-US english users
240
 
template<class T>
241
 
inline bool has_signalling_NaN(T)
242
 
{
 
223
template<typename T>
 
224
inline bool has_signalling_NaN(T) {
243
225
    return numeric_limits<T>::has_signaling_NaN;
244
226
}
245
227
 
246
 
template<class T>
247
 
inline bool has_denorm(T)
248
 
{
 
228
template<typename T>
 
229
inline bool has_denorm(T) {
249
230
    return numeric_limits<T>::has_denorm;
250
231
}
251
232
 
252
 
template<class T>
253
 
inline bool has_denorm_loss(T)
254
 
{
 
233
template<typename T>
 
234
inline bool has_denorm_loss(T) {
255
235
    return numeric_limits<T>::has_denorm_loss;
256
236
}
257
237
 
258
 
template<class T>
 
238
template<typename T>
259
239
inline T infinity(T) BZ_THROW
260
240
{
261
241
    return numeric_limits<T>::infinity();
262
242
}
263
243
 
264
 
template<class T>
 
244
template<typename T>
265
245
inline T quiet_NaN(T) BZ_THROW
266
246
{
267
247
    return numeric_limits<T>::quiet_NaN();
268
248
}
269
249
 
270
 
template<class T>
 
250
template<typename T>
271
251
inline T signaling_NaN(T) BZ_THROW
272
252
{
273
253
    return numeric_limits<T>::signaling_NaN();
274
254
}
275
255
 
276
 
template<class T>
 
256
template<typename T>
277
257
inline T signalling_NaN(T) BZ_THROW
278
258
{
279
259
    return numeric_limits<T>::signaling_NaN();
280
260
}
281
261
 
282
 
template<class T>
 
262
template<typename T>
283
263
inline T denorm_min(T) BZ_THROW
284
264
{
285
265
    return numeric_limits<T>::denorm_min();
286
266
}
287
267
 
288
 
template<class T>
289
 
inline bool is_iec559(T)
290
 
{
 
268
template<typename T>
 
269
inline bool is_iec559(T) {
291
270
    return numeric_limits<T>::is_iec559;
292
271
}
293
272
 
294
 
template<class T>
295
 
inline bool is_bounded(T)
296
 
{
 
273
template<typename T>
 
274
inline bool is_bounded(T) {
297
275
    return numeric_limits<T>::is_bounded;
298
276
}
299
277
 
300
 
template<class T>
301
 
inline bool is_modulo(T)
302
 
{
 
278
template<typename T>
 
279
inline bool is_modulo(T) {
303
280
    return numeric_limits<T>::is_modulo;
304
281
}
305
282
 
306
 
template<class T>
307
 
inline bool traps(T)
308
 
{
 
283
template<typename T>
 
284
inline bool traps(T) {
309
285
    return numeric_limits<T>::traps;
310
286
}
311
287
 
312
 
template<class T>
313
 
inline bool tinyness_before(T)
314
 
{
 
288
template<typename T>
 
289
inline bool tinyness_before(T) {
315
290
    return numeric_limits<T>::tinyness_before;
316
291
}
317
292
 
318
 
template<class T>
 
293
template<typename T>
319
294
inline BZ_STD_SCOPE(float_round_style) round_style(T)
320
295
{
321
296
    return numeric_limits<T>::round_style;