]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_real_concept.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / test_real_concept.cpp
CommitLineData
7c673cae
FG
1// Copyright John Maddock 2010
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt
5// or copy at http://www.boost.org/LICENSE_1_0.txt)
6
1e59de90
TL
7#include <boost/math/tools/config.hpp>
8#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
9
7c673cae
FG
10#include <boost/math/concepts/real_concept.hpp> // for real_concept
11#include <boost/math/constants/constants.hpp>
12
13#define BOOST_TEST_MAIN
14#include <boost/test/unit_test.hpp> // Boost.Test
15#include <boost/test/results_collector.hpp>
16#include <boost/test/unit_test.hpp>
92f5a8d4 17#include <boost/test/tools/floating_point_comparison.hpp>
7c673cae
FG
18#include <iostream>
19#include <iomanip>
20
21
22BOOST_AUTO_TEST_CASE( test_main )
23{
24#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
25
26 typedef boost::math::concepts::real_concept rc_t;
27
28 rc_t r1(2.5), r2(0.125), r3(45.5);
29 long double l1(2.5), l2(0.125), l3(45.5);
30 long double tol = std::numeric_limits<long double>::epsilon() * 2;
31
32 {
33 rc_t t(r1);
34 long double t2(l1);
35 t += r2;
36 t2 += l2;
37 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
38 t = r1;
39 t += l2;
40 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
41 t = r1;
42 t += 0.125;
43 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
44 t = r1;
45 t += 0.125f;
46 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
47
48 t = r1;
49 t += 23L;
50 t2 = 23 + l1;
51 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
52 t = r1;
53 t += 23uL;
54 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
55 t = r1;
56 t += 23;
57 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
58 t = r1;
59 t += 23u;
60 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
61 t = r1;
62 t += static_cast<short>(23);
63 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
64 t = r1;
65 t += static_cast<unsigned short>(23);
66 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
67 t = r1;
68 t += static_cast<char>(23);
69 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
70 t = r1;
71 t += static_cast<signed char>(23);
72 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
73 t = r1;
74 t += static_cast<unsigned char>(23);
75 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
76 }
77
78 {
79 rc_t t(r1);
80 long double t2(l1);
81 t -= r2;
82 t2 -= l2;
83 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
84 t = r1;
85 t -= l2;
86 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
87 t = r1;
88 t -= 0.125;
89 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
90 t = r1;
91 t -= 0.125f;
92 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
93
94 t = r1;
95 t -= 23L;
96 t2 = l1 - 23;
97 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
98 t = r1;
99 t -= 23uL;
100 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
101 t = r1;
102 t -= 23;
103 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
104 t = r1;
105 t -= 23u;
106 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
107 t = r1;
108 t -= static_cast<short>(23);
109 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
110 t = r1;
111 t -= static_cast<unsigned short>(23);
112 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
113 t = r1;
114 t -= static_cast<char>(23);
115 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
116 t = r1;
117 t -= static_cast<signed char>(23);
118 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
119 t = r1;
120 t -= static_cast<unsigned char>(23);
121 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
122 }
123
124 {
125 rc_t t(r1);
126 long double t2(l1);
127 t *= r2;
128 t2 *= l2;
129 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
130 t = r1;
131 t *= l2;
132 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
133 t = r1;
134 t *= 0.125;
135 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
136 t = r1;
137 t *= 0.125f;
138 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
139
140 t = r1;
141 t *= 23L;
142 t2 = 23 * l1;
143 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
144 t = r1;
145 t *= 23uL;
146 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
147 t = r1;
148 t *= 23;
149 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
150 t = r1;
151 t *= 23u;
152 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
153 t = r1;
154 t *= static_cast<short>(23);
155 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
156 t = r1;
157 t *= static_cast<unsigned short>(23);
158 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
159 t = r1;
160 t *= static_cast<char>(23);
161 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
162 t = r1;
163 t *= static_cast<signed char>(23);
164 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
165 t = r1;
166 t *= static_cast<unsigned char>(23);
167 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
168 }
169 {
170 rc_t t(r1);
171 long double t2(l1);
172 t /= r2;
173 t2 /= l2;
174 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
175 t = r1;
176 t /= l2;
177 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
178 t = r1;
179 t /= 0.125;
180 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
181 t = r1;
182 t /= 0.125f;
183 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
184
185 t = r1;
186 t /= 23L;
187 t2 = l1 / 23;
188 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
189 t = r1;
190 t /= 23uL;
191 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
192 t = r1;
193 t /= 23;
194 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
195 t = r1;
196 t /= 23u;
197 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
198 t = r1;
199 t /= static_cast<short>(23);
200 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
201 t = r1;
202 t /= static_cast<unsigned short>(23);
203 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
204 t = r1;
205 t /= static_cast<char>(23);
206 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
207 t = r1;
208 t /= static_cast<signed char>(23);
209 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
210 t = r1;
211 t /= static_cast<unsigned char>(23);
212 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
213 }
214
215 {
216 rc_t t;
217 long double t2;
218 t = r1 + r2;
219 t2 = l1 + l2;
220 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
221 t = r1 + l2;
222 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
223 t = r1 + 0.125;
224 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
225 t = r1 + 0.125f;
226 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
227 t = l2 + r1;
228 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
229 t = 0.125 + r1;
230 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
231 t = 0.125f + r1;
232 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
233
234 t2 = l1 + 23L;
235 t = r1 + 23L;
236 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
237 t = r1 + 23uL;
238 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
239 t = r1 + 23;
240 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
241 t = r1 + 23u;
242 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
243 t = r1 + static_cast<short>(23);
244 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
245 t = r1 + static_cast<unsigned short>(23);
246 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
247 t = r1 + static_cast<char>(23);
248 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
249 t = r1 + static_cast<signed char>(23);
250 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
251 t = r1 + static_cast<unsigned char>(23);
252 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
253
254 t = 23L + r1;
255 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
256 t = 23uL + r1;
257 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
258 t = 23 + r1;
259 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
260 t = 23u + r1;
261 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
262 t = static_cast<short>(23) + r1;
263 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
264 t = static_cast<unsigned short>(23) + r1;
265 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
266 t = static_cast<char>(23) + r1;
267 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
268 t = static_cast<signed char>(23) + r1;
269 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
270 t = static_cast<unsigned char>(23) + r1;
271 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
272 }
273 {
274 rc_t t;
275 long double t2;
276 t = r1 - r2;
277 t2 = l1 - l2;
278 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
279 t = r1 - l2;
280 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
281 t = r1 - 0.125;
282 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
283 t = r1 - 0.125f;
284 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
285 t2 = l2 - l1;
286 t = l2 - r1;
287 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
288 t = 0.125 - r1;
289 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
290 t = 0.125f - r1;
291 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
292
293 t2 = l1 - 23L;
294 t = r1 - 23L;
295 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
296 t = r1 - 23uL;
297 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
298 t = r1 - 23;
299 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
300 t = r1 - 23u;
301 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
302 t = r1 - static_cast<short>(23);
303 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
304 t = r1 - static_cast<unsigned short>(23);
305 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
306 t = r1 - static_cast<char>(23);
307 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
308 t = r1 - static_cast<signed char>(23);
309 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
310 t = r1 - static_cast<unsigned char>(23);
311 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
312
313 t2 = 23L - l1;
314 t = 23L - r1;
315 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
316 t = 23uL - r1;
317 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
318 t = 23 - r1;
319 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
320 t = 23u - r1;
321 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
322 t = static_cast<short>(23) - r1;
323 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
324 t = static_cast<unsigned short>(23) - r1;
325 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
326 t = static_cast<char>(23) - r1;
327 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
328 t = static_cast<signed char>(23) - r1;
329 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
330 t = static_cast<unsigned char>(23) - r1;
331 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
332 }
333 {
334 rc_t t;
335 long double t2;
336 t = r1 * r2;
337 t2 = l1 * l2;
338 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
339 t = r1 * l2;
340 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
341 t = r1 * 0.125;
342 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
343 t = r1 * 0.125f;
344 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
345 t = l2 * r1;
346 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
347 t = 0.125 * r1;
348 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
349 t = 0.125f * r1;
350 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
351
352 t2 = l1 * 23L;
353 t = r1 * 23L;
354 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
355 t = r1 * 23uL;
356 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
357 t = r1 * 23;
358 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
359 t = r1 * 23u;
360 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
361 t = r1 * static_cast<short>(23);
362 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
363 t = r1 * static_cast<unsigned short>(23);
364 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
365 t = r1 * static_cast<char>(23);
366 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
367 t = r1 * static_cast<signed char>(23);
368 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
369 t = r1 * static_cast<unsigned char>(23);
370 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
371
372 t = 23L * r1;
373 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
374 t = 23uL * r1;
375 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
376 t = 23 * r1;
377 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
378 t = 23u * r1;
379 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
380 t = static_cast<short>(23) * r1;
381 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
382 t = static_cast<unsigned short>(23) * r1;
383 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
384 t = static_cast<char>(23) * r1;
385 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
386 t = static_cast<signed char>(23) * r1;
387 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
388 t = static_cast<unsigned char>(23) * r1;
389 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
390 }
391 {
392 rc_t t;
393 long double t2;
394 t = r1 / r2;
395 t2 = l1 / l2;
396 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
397 t = r1 / l2;
398 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
399 t = r1 / 0.125;
400 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
401 t = r1 / 0.125f;
402 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
403 t2 = l2 / l1;
404 t = l2 / r1;
405 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
406 t = 0.125 / r1;
407 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
408 t = 0.125f / r1;
409 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
410
411 t2 = l1 / 23L;
412 t = r1 / 23L;
413 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
414 t = r1 / 23uL;
415 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
416 t = r1 / 23;
417 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
418 t = r1 / 23u;
419 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
420 t = r1 / static_cast<short>(23);
421 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
422 t = r1 / static_cast<unsigned short>(23);
423 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
424 t = r1 / static_cast<char>(23);
425 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
426 t = r1 / static_cast<signed char>(23);
427 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
428 t = r1 / static_cast<unsigned char>(23);
429 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
430
431 t2 = 23L / l1;
432 t = 23L / r1;
433 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
434 t = 23uL / r1;
435 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
436 t = 23 / r1;
437 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
438 t = 23u / r1;
439 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
440 t = static_cast<short>(23) / r1;
441 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
442 t = static_cast<unsigned short>(23) / r1;
443 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
444 t = static_cast<char>(23) / r1;
445 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
446 t = static_cast<signed char>(23) / r1;
447 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
448 t = static_cast<unsigned char>(23) / r1;
449 BOOST_CHECK_CLOSE_FRACTION(t.value(), t2, tol);
450 }
451
452 {
453 BOOST_CHECK_EQUAL(r1 == r2, l1 == l2);
454 BOOST_CHECK_EQUAL(r1 == l2, l1 == l2);
455 BOOST_CHECK_EQUAL(r1 == 0.125, l1 == l2);
456 BOOST_CHECK_EQUAL(r1 == 0.125f, l1 == l2);
457 BOOST_CHECK_EQUAL(l1 == r2, l1 == l2);
458 BOOST_CHECK_EQUAL(2.5 == r2, l1 == l2);
459 BOOST_CHECK_EQUAL(2.5f == r2, l1 == l2);
460
461 BOOST_CHECK_EQUAL(r1 <= r2, l1 <= l2);
462 BOOST_CHECK_EQUAL(r1 <= l2, l1 <= l2);
463 BOOST_CHECK_EQUAL(r1 <= 0.125, l1 <= l2);
464 BOOST_CHECK_EQUAL(r1 <= 0.125f, l1 <= l2);
465 BOOST_CHECK_EQUAL(l1 <= r2, l1 <= l2);
466 BOOST_CHECK_EQUAL(2.5 <= r2, l1 <= l2);
467 BOOST_CHECK_EQUAL(2.5f <= r2, l1 <= l2);
468
469 BOOST_CHECK_EQUAL(r1 >= r2, l1 >= l2);
470 BOOST_CHECK_EQUAL(r1 >= l2, l1 >= l2);
471 BOOST_CHECK_EQUAL(r1 >= 0.125, l1 >= l2);
472 BOOST_CHECK_EQUAL(r1 >= 0.125f, l1 >= l2);
473 BOOST_CHECK_EQUAL(l1 >= r2, l1 >= l2);
474 BOOST_CHECK_EQUAL(2.5 >= r2, l1 >= l2);
475 BOOST_CHECK_EQUAL(2.5f >= r2, l1 >= l2);
476
477 BOOST_CHECK_EQUAL(r1 < r2, l1 < l2);
478 BOOST_CHECK_EQUAL(r1 < l2, l1 < l2);
479 BOOST_CHECK_EQUAL(r1 < 0.125, l1 < l2);
480 BOOST_CHECK_EQUAL(r1 < 0.125f, l1 < l2);
481 BOOST_CHECK_EQUAL(l1 < r2, l1 < l2);
482 BOOST_CHECK_EQUAL(2.5 < r2, l1 < l2);
483 BOOST_CHECK_EQUAL(2.5f < r2, l1 < l2);
484
485 BOOST_CHECK_EQUAL(r1 > r2, l1 > l2);
486 BOOST_CHECK_EQUAL(r1 > l2, l1 > l2);
487 BOOST_CHECK_EQUAL(r1 > 0.125, l1 > l2);
488 BOOST_CHECK_EQUAL(r1 > 0.125f, l1 > l2);
489 BOOST_CHECK_EQUAL(l1 > r2, l1 > l2);
490 BOOST_CHECK_EQUAL(2.5 > r2, l1 > l2);
491 BOOST_CHECK_EQUAL(2.5f > r2, l1 > l2);
492 }
493
494 {
495 BOOST_MATH_STD_USING
496 BOOST_CHECK_CLOSE_FRACTION(acos(r2), acos(l2), tol);
497 BOOST_CHECK_CLOSE_FRACTION(cos(r2), cos(l2), tol);
498 BOOST_CHECK_CLOSE_FRACTION(asin(r2), asin(l2), tol);
499 BOOST_CHECK_CLOSE_FRACTION(atan(r2), atan(l2), tol);
500 BOOST_CHECK_CLOSE_FRACTION(atan2(r2, r3), atan2(l2, l3), tol);
501 BOOST_CHECK_CLOSE_FRACTION(ceil(r2), ceil(l2), tol);
502 BOOST_CHECK_CLOSE_FRACTION(fmod(r2, r3), fmod(l2, l3), tol);
503 BOOST_CHECK_CLOSE_FRACTION(cosh(r2), cosh(l2), tol);
504 BOOST_CHECK_CLOSE_FRACTION(exp(r2), exp(l2), tol);
505 BOOST_CHECK_CLOSE_FRACTION(fabs(r2), fabs(l2), tol);
506 BOOST_CHECK_CLOSE_FRACTION(abs(r2), abs(l2), tol);
507 rc_t rc_result;
508 long double ld_result;
509#ifdef __MINGW32__
510 BOOST_CHECK_CLOSE_FRACTION(modf(r2, &rc_result), boost::math::modf(l2, &ld_result), tol);
511#else
512 BOOST_CHECK_CLOSE_FRACTION(modf(r2, &rc_result), modf(l2, &ld_result), tol);
513#endif
514 BOOST_CHECK_CLOSE_FRACTION(rc_result, ld_result, tol);
515 int i1, i2;
516 BOOST_CHECK_CLOSE_FRACTION(frexp(r3, &i1), frexp(l3, &i2), tol);
517 BOOST_CHECK_EQUAL(i1, i2);
518 BOOST_CHECK_CLOSE_FRACTION(ldexp(r3, i1), ldexp(l3, i1), tol);
519 BOOST_CHECK_CLOSE_FRACTION(log(r2), log(l2), tol);
520 BOOST_CHECK_CLOSE_FRACTION(log10(r2), log10(l2), tol);
521 BOOST_CHECK_CLOSE_FRACTION(tan(r2), tan(l2), tol);
522 BOOST_CHECK_CLOSE_FRACTION(pow(r2, r3), pow(l2, l3), tol);
523 BOOST_CHECK_CLOSE_FRACTION(pow(r2, i1), pow(l2, i1), tol);
524 BOOST_CHECK_CLOSE_FRACTION(sin(r2), sin(l2), tol);
525 BOOST_CHECK_CLOSE_FRACTION(sinh(r2), sinh(l2), tol);
526 BOOST_CHECK_CLOSE_FRACTION(sqrt(r2), sqrt(l2), tol);
527 BOOST_CHECK_CLOSE_FRACTION(tanh(r2), tanh(l2), tol);
528
529 BOOST_CHECK_EQUAL(iround(r2), boost::math::iround(l2));
530 BOOST_CHECK_EQUAL(lround(r2), boost::math::lround(l2));
531#ifdef BOOST_HAS_LONG_LONG
532 BOOST_CHECK_EQUAL(llround(r2), boost::math::llround(l2));
533#endif
534 BOOST_CHECK_EQUAL(itrunc(r2), boost::math::itrunc(l2));
535 BOOST_CHECK_EQUAL(ltrunc(r2), boost::math::ltrunc(l2));
536#ifdef BOOST_HAS_LONG_LONG
537 BOOST_CHECK_EQUAL(lltrunc(r2), boost::math::lltrunc(l2));
538#endif
539 }
540
541 {
542 using namespace boost::math::tools;
543 tol = std::numeric_limits<long double>::epsilon();
544 BOOST_CHECK_CLOSE_FRACTION(max_value<rc_t>(), max_value<long double>(), tol);
545 BOOST_CHECK_CLOSE_FRACTION(min_value<rc_t>(), min_value<long double>(), tol);
546 BOOST_CHECK_CLOSE_FRACTION(log_max_value<rc_t>(), log_max_value<long double>(), tol);
547 BOOST_CHECK_CLOSE_FRACTION(log_min_value<rc_t>(), log_min_value<long double>(), tol);
548 BOOST_CHECK_CLOSE_FRACTION(epsilon<rc_t>(), epsilon<long double>(), tol);
549 BOOST_CHECK_EQUAL(digits<rc_t>(), digits<long double>());
550 }
551
552 {
553 using namespace boost::math::constants;
554 BOOST_CHECK_CLOSE_FRACTION(pi<rc_t>(), pi<long double>(), tol);
555 BOOST_CHECK_CLOSE_FRACTION(root_pi<rc_t>(), root_pi<long double>(), tol);
556 BOOST_CHECK_CLOSE_FRACTION(root_half_pi<rc_t>(), root_half_pi<long double>(), tol);
557 BOOST_CHECK_CLOSE_FRACTION(root_two_pi<rc_t>(), root_two_pi<long double>(), tol);
558 BOOST_CHECK_CLOSE_FRACTION(root_ln_four<rc_t>(), root_ln_four<long double>(), tol);
559 BOOST_CHECK_CLOSE_FRACTION(half<rc_t>(), half<long double>(), tol);
560 BOOST_CHECK_CLOSE_FRACTION(euler<rc_t>(), euler<long double>(), tol);
561 BOOST_CHECK_CLOSE_FRACTION(root_two<rc_t>(), root_two<long double>(), tol);
562 BOOST_CHECK_CLOSE_FRACTION(ln_two<rc_t>(), ln_two<long double>(), tol);
563 BOOST_CHECK_CLOSE_FRACTION(ln_ln_two<rc_t>(), ln_ln_two<long double>(), tol);
564 BOOST_CHECK_CLOSE_FRACTION(third<rc_t>(), third<long double>(), tol);
565 BOOST_CHECK_CLOSE_FRACTION(twothirds<rc_t>(), twothirds<long double>(), tol);
566 BOOST_CHECK_CLOSE_FRACTION(pi_minus_three<rc_t>(), pi_minus_three<long double>(), tol);
567 BOOST_CHECK_CLOSE_FRACTION(four_minus_pi<rc_t>(), four_minus_pi<long double>(), tol);
568 // BOOST_CHECK_CLOSE_FRACTION(pow23_four_minus_pi<rc_t>(), pow23_four_minus_pi<long double>(), tol);
569 BOOST_CHECK_CLOSE_FRACTION(exp_minus_half<rc_t>(), exp_minus_half<long double>(), tol);
570 }
571
572#else
573 std::cout << "<note>The long double tests have been disabled on this platform "
574 "either because the long double overloads of the usual math functions are "
575 "not available at all, or because they are too inaccurate for these tests "
576 "to pass.</note>" << std::endl;
577#endif
578
579
580} // BOOST_AUTO_TEST_CASE( test_main )
581
1e59de90
TL
582#else
583int main(void) { return 0; }
584#endif // BOOST_MATH_NO_REAL_CONCEPT_TESTS