p1788 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/AUTHORS +6 -0
  4. data/LICENSE +201 -0
  5. data/NOTICE +29 -0
  6. data/README.md +65 -0
  7. data/ext/libieeep1788_copy/README +3 -0
  8. data/ext/libieeep1788_copy/p1788/AUTHORS +16 -0
  9. data/ext/libieeep1788_copy/p1788/LICENSE +202 -0
  10. data/ext/libieeep1788_copy/p1788/NOTICE +14 -0
  11. data/ext/libieeep1788_copy/p1788/decoration/decoration.hpp +265 -0
  12. data/ext/libieeep1788_copy/p1788/exception/exception.hpp +302 -0
  13. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor.hpp +3443 -0
  14. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_bool_func_impl.hpp +608 -0
  15. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_cancel_func_impl.hpp +229 -0
  16. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_class_impl.hpp +526 -0
  17. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_elem_func_impl.hpp +4533 -0
  18. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_io_impl.hpp +1421 -0
  19. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_mul_rev_to_pair_func_impl.hpp +347 -0
  20. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_num_func_impl.hpp +655 -0
  21. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_bool_func_impl.hpp +146 -0
  22. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_overlap_impl.hpp +188 -0
  23. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rev_func_impl.hpp +1674 -0
  24. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_set_op_impl.hpp +216 -0
  25. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_setup_func_impl.hpp +68 -0
  26. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_util_func_impl.hpp +135 -0
  27. data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_validation_func_impl.hpp +93 -0
  28. data/ext/libieeep1788_copy/p1788/infsup/base_interval.hpp +1529 -0
  29. data/ext/libieeep1788_copy/p1788/infsup/base_interval_bool_func_impl.hpp +481 -0
  30. data/ext/libieeep1788_copy/p1788/infsup/base_interval_cancel_func_impl.hpp +126 -0
  31. data/ext/libieeep1788_copy/p1788/infsup/base_interval_elem_func_impl.hpp +1581 -0
  32. data/ext/libieeep1788_copy/p1788/infsup/base_interval_io_impl.hpp +59 -0
  33. data/ext/libieeep1788_copy/p1788/infsup/base_interval_mul_rev_to_pair_func_impl.hpp +88 -0
  34. data/ext/libieeep1788_copy/p1788/infsup/base_interval_num_func_impl.hpp +345 -0
  35. data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_bool_func_impl.hpp +92 -0
  36. data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_overlap_impl.hpp +72 -0
  37. data/ext/libieeep1788_copy/p1788/infsup/base_interval_rev_func_impl.hpp +656 -0
  38. data/ext/libieeep1788_copy/p1788/infsup/base_interval_set_op_impl.hpp +126 -0
  39. data/ext/libieeep1788_copy/p1788/infsup/decorated_interval.hpp +464 -0
  40. data/ext/libieeep1788_copy/p1788/infsup/forward_declaration.hpp +66 -0
  41. data/ext/libieeep1788_copy/p1788/infsup/interval.hpp +275 -0
  42. data/ext/libieeep1788_copy/p1788/io/io_manip.hpp +531 -0
  43. data/ext/libieeep1788_copy/p1788/overlapping/overlapping.hpp +241 -0
  44. data/ext/libieeep1788_copy/p1788/p1788.hpp +45 -0
  45. data/ext/libieeep1788_copy/p1788/reduction/reduction.hpp +341 -0
  46. data/ext/libieeep1788_copy/p1788/util/io.hpp +63 -0
  47. data/ext/libieeep1788_copy/p1788/util/mixed_type_traits.hpp +140 -0
  48. data/ext/libieeep1788_copy/p1788/util/mpfr_util.hpp +77 -0
  49. data/ext/libieeep1788_copy/p1788/util/mpfr_var.hpp +119 -0
  50. data/ext/libieeep1788_copy/p1788/util/mpfr_var_impl.hpp +382 -0
  51. data/ext/libieeep1788_copy/p1788/version.hpp +34 -0
  52. data/ext/p1788/extconf.rb +49 -0
  53. data/ext/p1788/p1788.cc +3764 -0
  54. data/lib/p1788/version.rb +4 -0
  55. data/lib/p1788.rb +25 -0
  56. data/p1788.gemspec +72 -0
  57. metadata +99 -0
@@ -0,0 +1,608 @@
1
+ //
2
+ // libieeep1788
3
+ //
4
+ // An implementation of the preliminary IEEE P1788 standard for
5
+ // interval arithmetic
6
+ //
7
+ //
8
+ // Copyright 2013 - 2015
9
+ //
10
+ // Marco Nehmeier (nehmeier@informatik.uni-wuerzburg.de)
11
+ // Department of Computer Science,
12
+ // University of Wuerzburg, Germany
13
+ //
14
+ // Licensed under the Apache License, Version 2.0 (the "License");
15
+ // you may not use this file except in compliance with the License.
16
+ // You may obtain a copy of the License at
17
+ //
18
+ // http://www.apache.org/licenses/LICENSE-2.0
19
+ //
20
+ // Unless required by applicable law or agreed to in writing, software
21
+ // distributed under the License is distributed on an "AS IS" BASIS,
22
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ // See the License for the specific language governing permissions and
24
+ // limitations under the License.
25
+
26
+ #ifndef LIBIEEEP1788_P1788_FLAVOR_INFSUP_SETBASED_MPFR_BIN_IEEE754_FLAVOR_BOOL_FUNC_IMPL_HPP
27
+ #define LIBIEEEP1788_P1788_FLAVOR_INFSUP_SETBASED_MPFR_BIN_IEEE754_FLAVOR_BOOL_FUNC_IMPL_HPP
28
+
29
+
30
+ namespace p1788
31
+ {
32
+
33
+ namespace flavor
34
+ {
35
+
36
+ namespace infsup
37
+ {
38
+
39
+ namespace setbased
40
+ {
41
+
42
+ // is_empty ( bare interval )
43
+ template<typename T>
44
+ bool
45
+ mpfr_bin_ieee754_flavor<T>::is_empty(mpfr_bin_ieee754_flavor<T>::representation const& x)
46
+ {
47
+ if (!is_valid(x))
48
+ return false;
49
+
50
+ return std::isnan(x.first) && std::isnan(x.second);
51
+ }
52
+
53
+ // is_empty ( decorated interval )
54
+ template<typename T>
55
+ bool
56
+ mpfr_bin_ieee754_flavor<T>::is_empty(mpfr_bin_ieee754_flavor<T>::representation_dec const& x)
57
+ {
58
+ if (!is_valid(x) || is_nai(x))
59
+ return false;
60
+
61
+ // call bare version if not ill
62
+ return is_empty(x.first);
63
+ }
64
+
65
+
66
+
67
+ // is_entire ( bare interval )
68
+ template<typename T>
69
+ bool
70
+ mpfr_bin_ieee754_flavor<T>::is_entire(mpfr_bin_ieee754_flavor<T>::representation const& x)
71
+ {
72
+ if (!is_valid(x))
73
+ return false;
74
+
75
+ return x.first == -std::numeric_limits<T>::infinity()
76
+ && x.second == std::numeric_limits<T>::infinity();
77
+ }
78
+
79
+ // is_entire ( decorated interval )
80
+ template<typename T>
81
+ bool
82
+ mpfr_bin_ieee754_flavor<T>::is_entire(mpfr_bin_ieee754_flavor<T>::representation_dec const& x)
83
+ {
84
+ if (!is_valid(x) || is_nai(x))
85
+ return false;
86
+
87
+ // call bare version
88
+ return is_entire(x.first);
89
+ }
90
+
91
+
92
+
93
+ // is_nai ( decorated interval )
94
+ template<typename T>
95
+ bool
96
+ mpfr_bin_ieee754_flavor<T>::is_nai(mpfr_bin_ieee754_flavor<T>::representation_dec const& x)
97
+ {
98
+ if (!is_valid(x))
99
+ return false;
100
+
101
+ return std::isnan(x.first.first) && std::isnan(x.first.second) && x.second == p1788::decoration::decoration::ill;
102
+ }
103
+
104
+
105
+
106
+ // equal ( bare interval, bare interval )
107
+ template<typename T>
108
+ bool
109
+ mpfr_bin_ieee754_flavor<T>::equal(mpfr_bin_ieee754_flavor<T>::representation const& x,
110
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
111
+ {
112
+ if (!is_valid(x) || !is_valid(y))
113
+ return false;
114
+
115
+ // call bare mixed type version
116
+ return equal<T>(x,y);
117
+ }
118
+
119
+ // equal ( decorated interval, decorated interval )
120
+ template<typename T>
121
+ bool
122
+ mpfr_bin_ieee754_flavor<T>::equal(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
123
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
124
+ {
125
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
126
+ return false;
127
+
128
+ // call bare mixed type version if not NaI
129
+ return equal<T>(x.first, y.first);
130
+ }
131
+
132
+ // equal ( bare interval, bare interval ) mixed type
133
+ template<typename T>
134
+ template<typename T_>
135
+ bool
136
+ mpfr_bin_ieee754_flavor<T>::equal(mpfr_bin_ieee754_flavor<T>::representation const& x,
137
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
138
+ {
139
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
140
+
141
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
142
+ return false;
143
+
144
+ return (is_empty(x) && mpfr_bin_ieee754_flavor<T_>::is_empty(y))
145
+ || (x.first == y.first && x.second == y.second);
146
+ }
147
+
148
+ // equal ( decorated interval, decorated interval ) mixed type
149
+ template<typename T>
150
+ template<typename T_>
151
+ bool
152
+ mpfr_bin_ieee754_flavor<T>::equal(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
153
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
154
+ {
155
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
156
+
157
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y) || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
158
+ return false;
159
+
160
+ // call bare mixed type version if not NaI
161
+ return equal(x.first, y.first);
162
+ }
163
+
164
+
165
+
166
+ // subset ( bare interval, bare interval )
167
+ template<typename T>
168
+ bool
169
+ mpfr_bin_ieee754_flavor<T>::subset(mpfr_bin_ieee754_flavor<T>::representation const& x,
170
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
171
+ {
172
+ if (!is_valid(x) || !is_valid(y))
173
+ return false;
174
+
175
+ // call bare mixed type version
176
+ return subset<T>(x,y);
177
+ }
178
+
179
+ // subset ( decorated interval, decorated interval )
180
+ template<typename T>
181
+ bool
182
+ mpfr_bin_ieee754_flavor<T>::subset(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
183
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
184
+ {
185
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
186
+ return false;
187
+
188
+ // call bare mixed type version if not NaI
189
+ return subset<T>(x.first, y.first);
190
+ }
191
+
192
+ // subset ( bare interval, bare interval ) mixed type
193
+ template<typename T>
194
+ template<typename T_>
195
+ bool
196
+ mpfr_bin_ieee754_flavor<T>::subset(mpfr_bin_ieee754_flavor<T>::representation const& x,
197
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
198
+ {
199
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
200
+
201
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
202
+ return false;
203
+
204
+ return is_empty(x) || (y.first <= x.first && x.second <= y.second);
205
+ }
206
+
207
+ // subset ( decorated interval, decorated interval ) mixed type
208
+ template<typename T>
209
+ template<typename T_>
210
+ bool
211
+ mpfr_bin_ieee754_flavor<T>::subset(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
212
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
213
+ {
214
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
215
+
216
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
217
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
218
+ return false;
219
+
220
+ // call bare mixed type version if not NaI
221
+ return subset(x.first, y.first);
222
+ }
223
+
224
+
225
+
226
+ // less ( bare interval, bare interval )
227
+ template<typename T>
228
+ bool
229
+ mpfr_bin_ieee754_flavor<T>::less(mpfr_bin_ieee754_flavor<T>::representation const& x,
230
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
231
+ {
232
+ if (!is_valid(x) || !is_valid(y))
233
+ return false;
234
+
235
+ // call bare mixed type version
236
+ return less<T>(x,y);
237
+ }
238
+
239
+ // less ( decorated interval, decorated interval )
240
+ template<typename T>
241
+ bool
242
+ mpfr_bin_ieee754_flavor<T>::less(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
243
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
244
+ {
245
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
246
+ return false;
247
+
248
+ // call bare mixed type version if not NaI
249
+ return less<T>(x.first, y.first);
250
+ }
251
+
252
+ // less ( bare interval, bare interval ) mixed type
253
+ template<typename T>
254
+ template<typename T_>
255
+ bool
256
+ mpfr_bin_ieee754_flavor<T>::less(mpfr_bin_ieee754_flavor<T>::representation const& x,
257
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
258
+ {
259
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
260
+
261
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
262
+ return false;
263
+
264
+ return (is_empty(x) && mpfr_bin_ieee754_flavor<T_>::is_empty(y))
265
+ || (x.first <= y.first && x.second <= y.second);
266
+ }
267
+
268
+ // less ( decorated interval, decorated interval ) mixed type
269
+ template<typename T>
270
+ template<typename T_>
271
+ bool
272
+ mpfr_bin_ieee754_flavor<T>::less(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
273
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
274
+ {
275
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
276
+
277
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
278
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
279
+ return false;
280
+
281
+ // call bare mixed type version if not NaI
282
+ return less(x.first, y.first);
283
+ }
284
+
285
+
286
+
287
+ // precedes ( bare interval, bare interval )
288
+ template<typename T>
289
+ bool
290
+ mpfr_bin_ieee754_flavor<T>::precedes(mpfr_bin_ieee754_flavor<T>::representation const& x,
291
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
292
+ {
293
+ if (!is_valid(x) || !is_valid(y))
294
+ return false;
295
+
296
+ // call bare mixed type version
297
+ return precedes<T>(x,y);
298
+ }
299
+
300
+ // precedes ( decorated interval, decorated interval )
301
+ template<typename T>
302
+ bool
303
+ mpfr_bin_ieee754_flavor<T>::precedes(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
304
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
305
+ {
306
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y) )
307
+ return false;
308
+
309
+ // call bare mixed type version if not NaI
310
+ return precedes<T>(x.first, y.first);
311
+ }
312
+
313
+ // precedes ( bare interval, bare interval ) mixed type
314
+ template<typename T>
315
+ template<typename T_>
316
+ bool
317
+ mpfr_bin_ieee754_flavor<T>::precedes(mpfr_bin_ieee754_flavor<T>::representation const& x,
318
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
319
+ {
320
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
321
+
322
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
323
+ return false;
324
+
325
+ return is_empty(x) || mpfr_bin_ieee754_flavor<T_>::is_empty(y) || x.second <= y.first;
326
+ }
327
+
328
+ // precedes ( decorated interval, decorated interval ) mixed type
329
+ template<typename T>
330
+ template<typename T_>
331
+ bool
332
+ mpfr_bin_ieee754_flavor<T>::precedes(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
333
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
334
+ {
335
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
336
+
337
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
338
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
339
+ return false;
340
+
341
+ // call bare mixed type version if not NaI
342
+ return precedes(x.first, y.first);
343
+ }
344
+
345
+
346
+
347
+ // interior ( bare interval, bare interval )
348
+ template<typename T>
349
+ bool
350
+ mpfr_bin_ieee754_flavor<T>::interior(mpfr_bin_ieee754_flavor<T>::representation const& x,
351
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
352
+ {
353
+ if (!is_valid(x) || !is_valid(y))
354
+ return false;
355
+
356
+ // call bare mixed type version
357
+ return interior<T>(x,y);
358
+ }
359
+
360
+ // interior ( decorated interval, decorated interval )
361
+ template<typename T>
362
+ bool
363
+ mpfr_bin_ieee754_flavor<T>::interior(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
364
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
365
+ {
366
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
367
+ return false;
368
+
369
+ // call bare mixed type version if not NaI
370
+ return interior<T>(x.first, y.first);
371
+ }
372
+
373
+ // interior ( bare interval, bare interval ) mixed type
374
+ template<typename T>
375
+ template<typename T_>
376
+ bool
377
+ mpfr_bin_ieee754_flavor<T>::interior(mpfr_bin_ieee754_flavor<T>::representation const& x,
378
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
379
+ {
380
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
381
+
382
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
383
+ return false;
384
+
385
+ return is_empty(x)
386
+ || ((y.first < x.first
387
+ || (y.first == -std::numeric_limits<T_>::infinity()
388
+ && x.first == -std::numeric_limits<T>::infinity()))
389
+ && (x.second < y.second
390
+ || (x.second == std::numeric_limits<T>::infinity()
391
+ && y.second == std::numeric_limits<T_>::infinity())));
392
+ }
393
+
394
+ // interior ( decorated interval, decorated interval ) mixed type
395
+ template<typename T>
396
+ template<typename T_>
397
+ bool
398
+ mpfr_bin_ieee754_flavor<T>::interior(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
399
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
400
+ {
401
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
402
+
403
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
404
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
405
+ return false;
406
+
407
+ // call bare mixed type version if not NaI
408
+ return interior(x.first, y.first);
409
+ }
410
+
411
+
412
+
413
+ // strictly_less ( bare interval, bare interval )
414
+ template<typename T>
415
+ bool
416
+ mpfr_bin_ieee754_flavor<T>::strictly_less(mpfr_bin_ieee754_flavor<T>::representation const& x,
417
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
418
+ {
419
+ if (!is_valid(x) || !is_valid(y))
420
+ return false;
421
+
422
+
423
+ // call bare mixed type version
424
+ return strictly_less<T>(x,y);
425
+ }
426
+
427
+ // strictly_less ( decorated interval, decorated interval )
428
+ template<typename T>
429
+ bool
430
+ mpfr_bin_ieee754_flavor<T>::strictly_less(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
431
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
432
+ {
433
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
434
+ return false;
435
+
436
+ // call bare mixed type version if not NaI
437
+ return strictly_less<T>(x.first, y.first);
438
+ }
439
+
440
+ // strictly_less ( bare interval, bare interval ) mixed type
441
+ template<typename T>
442
+ template<typename T_>
443
+ bool
444
+ mpfr_bin_ieee754_flavor<T>::strictly_less(mpfr_bin_ieee754_flavor<T>::representation const& x,
445
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
446
+ {
447
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
448
+
449
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
450
+ return false;
451
+
452
+ return (is_empty(x) && mpfr_bin_ieee754_flavor<T_>::is_empty(y))
453
+ || ((x.first < y.first
454
+ || (x.first == -std::numeric_limits<T>::infinity()
455
+ && y.first == -std::numeric_limits<T_>::infinity()))
456
+ && (x.second < y.second
457
+ || (x.second == std::numeric_limits<T>::infinity()
458
+ && y.second == std::numeric_limits<T_>::infinity())));
459
+ }
460
+
461
+ // strictly_less ( decorated interval, decorated interval ) mixed type
462
+ template<typename T>
463
+ template<typename T_>
464
+ bool
465
+ mpfr_bin_ieee754_flavor<T>::strictly_less(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
466
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
467
+ {
468
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
469
+
470
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
471
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
472
+ return false;
473
+
474
+ // call bare mixed type version if not NaI
475
+ return strictly_less(x.first, y.first);
476
+ }
477
+
478
+
479
+
480
+ // strictly_precedes ( bare interval, bare interval )
481
+ template<typename T>
482
+ bool
483
+ mpfr_bin_ieee754_flavor<T>::strictly_precedes(mpfr_bin_ieee754_flavor<T>::representation const& x,
484
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
485
+ {
486
+ if (!is_valid(x) || !is_valid(y))
487
+ return false;
488
+
489
+ // call bare mixed type version
490
+ return strictly_precedes<T>(x,y);
491
+ }
492
+
493
+ // strictly_precedes ( decorated interval, decorated interval )
494
+ template<typename T>
495
+ bool
496
+ mpfr_bin_ieee754_flavor<T>::strictly_precedes(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
497
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
498
+ {
499
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
500
+ return false;
501
+
502
+ // call bare mixed type version if not NaI
503
+ return strictly_precedes<T>(x.first, y.first);
504
+ }
505
+
506
+ // strictly_precedes ( bare interval, bare interval ) mixed type
507
+ template<typename T>
508
+ template<typename T_>
509
+ bool
510
+ mpfr_bin_ieee754_flavor<T>::strictly_precedes(mpfr_bin_ieee754_flavor<T>::representation const& x,
511
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
512
+ {
513
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
514
+
515
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
516
+ return false;
517
+
518
+ return is_empty(x) || mpfr_bin_ieee754_flavor<T_>::is_empty(y) || x.second < y.first;
519
+ }
520
+
521
+ // strictly_precedes ( decorated interval, decorated interval ) mixed type
522
+ template<typename T>
523
+ template<typename T_>
524
+ bool
525
+ mpfr_bin_ieee754_flavor<T>::strictly_precedes(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
526
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
527
+ {
528
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
529
+
530
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
531
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
532
+ return false;
533
+
534
+ // call bare mixed type version if not NaI
535
+ return strictly_precedes(x.first, y.first);
536
+ }
537
+
538
+
539
+
540
+ // disjoint ( bare interval, bare interval )
541
+ template<typename T>
542
+ bool
543
+ mpfr_bin_ieee754_flavor<T>::disjoint(mpfr_bin_ieee754_flavor<T>::representation const& x,
544
+ mpfr_bin_ieee754_flavor<T>::representation const& y)
545
+ {
546
+ if (!is_valid(x) || !is_valid(y))
547
+ return false;
548
+
549
+ // call bare mixed type version
550
+ return disjoint<T>(x,y);
551
+ }
552
+
553
+ // disjoint ( decorated interval, decorated interval )
554
+ template<typename T>
555
+ bool
556
+ mpfr_bin_ieee754_flavor<T>::disjoint(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
557
+ mpfr_bin_ieee754_flavor<T>::representation_dec const& y)
558
+ {
559
+ if (!is_valid(x) || !is_valid(y) || is_nai(x) || is_nai(y))
560
+ return false;
561
+
562
+ // call bare mixed type version if not NaI
563
+ return disjoint<T>(x.first, y.first);
564
+ }
565
+
566
+ // disjoint ( bare interval, bare interval ) mixed type
567
+ template<typename T>
568
+ template<typename T_>
569
+ bool
570
+ mpfr_bin_ieee754_flavor<T>::disjoint(mpfr_bin_ieee754_flavor<T>::representation const& x,
571
+ mpfr_bin_ieee754_flavor<T>::representation_type<T_> const& y)
572
+ {
573
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
574
+
575
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y))
576
+ return false;
577
+
578
+ return is_empty(x) || mpfr_bin_ieee754_flavor<T_>::is_empty(y) || x.second < y.first || y.second < x.first;
579
+ }
580
+
581
+ // disjoint ( decorated interval, decorated interval ) mixed type
582
+ template<typename T>
583
+ template<typename T_>
584
+ bool
585
+ mpfr_bin_ieee754_flavor<T>::disjoint(mpfr_bin_ieee754_flavor<T>::representation_dec const& x,
586
+ mpfr_bin_ieee754_flavor<T>::representation_dec_type<T_> const& y)
587
+ {
588
+ static_assert(std::numeric_limits<T_>::is_iec559, "Only IEEE 754 binary compliant types are supported!");
589
+
590
+ if (!is_valid(x) || !mpfr_bin_ieee754_flavor<T_>::is_valid(y)
591
+ || is_nai(x) || mpfr_bin_ieee754_flavor<T_>::is_nai(y))
592
+ return false;
593
+
594
+ // call bare mixed type version if not NaI
595
+ return disjoint(x.first, y.first);
596
+ }
597
+
598
+
599
+ } // namespace setbased
600
+
601
+ } // namespace infsup
602
+
603
+ } // namespace flavor
604
+
605
+ } // namespace p1788
606
+
607
+
608
+ #endif // LIBIEEEP1788_P1788_FLAVOR_INFSUP_SETBASED_MPFR_BIN_IEEE754_FLAVOR_BOOL_FUNC_IMPL_HPP