1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright 2012 John Maddock. Distributed under the Boost
3 // Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_MP_NO_ET_OPS_HPP
7 #define BOOST_MP_NO_ET_OPS_HPP
11 #pragma warning(disable : 4714)
15 namespace multiprecision {
18 // Operators for non-expression template enabled number.
19 // NOTE: this is not a complete header - really just a suffix to default_ops.hpp.
20 // NOTE: these operators have to be defined after the methods in default_ops.hpp.
23 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(const number<B, et_off>& v)
25 BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
26 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(v);
27 number<B, et_off> result(v);
28 result.backend().negate();
32 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator~(const number<B, et_off>& v)
34 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(v);
35 number<B, et_off> result;
36 eval_complement(result.backend(), v.backend());
43 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(const number<B, et_off>& a, const number<B, et_off>& b)
45 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
46 number<B, et_off> result;
47 using default_ops::eval_add;
48 eval_add(result.backend(), a.backend(), b.backend());
51 template <class B, class V>
52 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
53 operator+(const number<B, et_off>& a, const V& b)
55 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
56 number<B, et_off> result;
57 using default_ops::eval_add;
58 eval_add(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
61 template <class V, class B>
62 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
63 operator+(const V& a, const number<B, et_off>& b)
65 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
66 number<B, et_off> result;
67 using default_ops::eval_add;
68 eval_add(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
75 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(const number<B, et_off>& a, const number<B, et_off>& b)
77 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
78 number<B, et_off> result;
79 using default_ops::eval_subtract;
80 eval_subtract(result.backend(), a.backend(), b.backend());
83 template <class B, class V>
84 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
85 operator-(const number<B, et_off>& a, const V& b)
87 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
88 number<B, et_off> result;
89 using default_ops::eval_subtract;
90 eval_subtract(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
93 template <class V, class B>
94 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
95 operator-(const V& a, const number<B, et_off>& b)
97 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
98 number<B, et_off> result;
99 using default_ops::eval_subtract;
100 eval_subtract(result.backend(), number<B, et_off>::canonical_value(a), b.backend());
107 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(const number<B, et_off>& a, const number<B, et_off>& b)
109 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
110 number<B, et_off> result;
111 using default_ops::eval_multiply;
112 eval_multiply(result.backend(), a.backend(), b.backend());
115 template <class B, class V>
116 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
117 operator*(const number<B, et_off>& a, const V& b)
119 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
120 number<B, et_off> result;
121 using default_ops::eval_multiply;
122 eval_multiply(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
125 template <class V, class B>
126 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
127 operator*(const V& a, const number<B, et_off>& b)
129 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
130 number<B, et_off> result;
131 using default_ops::eval_multiply;
132 eval_multiply(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
139 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator/(const number<B, et_off>& a, const number<B, et_off>& b)
141 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
142 number<B, et_off> result;
143 using default_ops::eval_divide;
144 eval_divide(result.backend(), a.backend(), b.backend());
147 template <class B, class V>
148 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
149 operator/(const number<B, et_off>& a, const V& b)
151 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
152 number<B, et_off> result;
153 using default_ops::eval_divide;
154 eval_divide(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
157 template <class V, class B>
158 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
159 operator/(const V& a, const number<B, et_off>& b)
161 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
162 number<B, et_off> result;
163 using default_ops::eval_divide;
164 eval_divide(result.backend(), number<B, et_off>::canonical_value(a), b.backend());
171 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(const number<B, et_off>& a, const number<B, et_off>& b)
173 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
174 number<B, et_off> result;
175 using default_ops::eval_modulus;
176 eval_modulus(result.backend(), a.backend(), b.backend());
179 template <class B, class V>
180 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
181 operator%(const number<B, et_off>& a, const V& b)
183 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
184 number<B, et_off> result;
185 using default_ops::eval_modulus;
186 eval_modulus(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
189 template <class V, class B>
190 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
191 operator%(const V& a, const number<B, et_off>& b)
193 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
194 number<B, et_off> result;
195 using default_ops::eval_modulus;
196 eval_modulus(result.backend(), number<B, et_off>::canonical_value(a), b.backend());
203 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, const number<B, et_off>& b)
205 number<B, et_off> result;
206 using default_ops::eval_bitwise_or;
207 eval_bitwise_or(result.backend(), a.backend(), b.backend());
210 template <class B, class V>
211 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
212 operator|(const number<B, et_off>& a, const V& b)
214 number<B, et_off> result;
215 using default_ops::eval_bitwise_or;
216 eval_bitwise_or(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
219 template <class V, class B>
220 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
221 operator|(const V& a, const number<B, et_off>& b)
223 number<B, et_off> result;
224 using default_ops::eval_bitwise_or;
225 eval_bitwise_or(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
232 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, const number<B, et_off>& b)
234 number<B, et_off> result;
235 using default_ops::eval_bitwise_xor;
236 eval_bitwise_xor(result.backend(), a.backend(), b.backend());
239 template <class B, class V>
240 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
241 operator^(const number<B, et_off>& a, const V& b)
243 number<B, et_off> result;
244 using default_ops::eval_bitwise_xor;
245 eval_bitwise_xor(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
248 template <class V, class B>
249 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
250 operator^(const V& a, const number<B, et_off>& b)
252 number<B, et_off> result;
253 using default_ops::eval_bitwise_xor;
254 eval_bitwise_xor(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
261 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, const number<B, et_off>& b)
263 number<B, et_off> result;
264 using default_ops::eval_bitwise_and;
265 eval_bitwise_and(result.backend(), a.backend(), b.backend());
268 template <class B, class V>
269 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
270 operator&(const number<B, et_off>& a, const V& b)
272 number<B, et_off> result;
273 using default_ops::eval_bitwise_and;
274 eval_bitwise_and(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
277 template <class V, class B>
278 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
279 operator&(const V& a, const number<B, et_off>& b)
281 number<B, et_off> result;
282 using default_ops::eval_bitwise_and;
283 eval_bitwise_and(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
289 template <class B, class I>
290 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
291 operator<<(const number<B, et_off>& a, const I& b)
293 number<B, et_off> result(a);
294 using default_ops::eval_left_shift;
295 detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<is_signed<I>::value>());
296 eval_left_shift(result.backend(), b);
299 template <class B, class I>
300 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
301 operator>>(const number<B, et_off>& a, const I& b)
303 number<B, et_off> result(a);
304 using default_ops::eval_right_shift;
305 detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<is_signed<I>::value>());
306 eval_right_shift(result.backend(), b);
310 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ < 5)))
312 // If we have rvalue references go all over again with rvalue ref overloads and move semantics.
313 // Note that while it would be tempting to implement these so they return an rvalue reference
314 // (and indeed this would be optimally efficient), this is unsafe due to users propensity to
317 // const T& t = a * b;
319 // which would lead to a dangling reference if we didn't return by value. Of course move
320 // semantics help a great deal in return by value, so performance is still pretty good...
323 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(number<B, et_off>&& v)
325 BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
326 v.backend().negate();
327 return static_cast<number<B, et_off>&&>(v);
330 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator~(number<B, et_off>&& v)
332 eval_complement(v.backend(), v.backend());
333 return static_cast<number<B, et_off>&&>(v);
339 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(number<B, et_off>&& a, const number<B, et_off>& b)
341 using default_ops::eval_add;
342 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
343 eval_add(a.backend(), b.backend());
344 return static_cast<number<B, et_off>&&>(a);
347 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(const number<B, et_off>& a, number<B, et_off>&& b)
349 using default_ops::eval_add;
350 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
351 eval_add(b.backend(), a.backend());
352 return static_cast<number<B, et_off>&&>(b);
355 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(number<B, et_off>&& a, number<B, et_off>&& b)
357 using default_ops::eval_add;
358 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
359 eval_add(a.backend(), b.backend());
360 return static_cast<number<B, et_off>&&>(a);
362 template <class B, class V>
363 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
364 operator+(number<B, et_off>&& a, const V& b)
366 using default_ops::eval_add;
367 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
368 eval_add(a.backend(), number<B, et_off>::canonical_value(b));
369 return static_cast<number<B, et_off>&&>(a);
371 template <class V, class B>
372 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
373 operator+(const V& a, number<B, et_off>&& b)
375 using default_ops::eval_add;
376 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
377 eval_add(b.backend(), number<B, et_off>::canonical_value(a));
378 return static_cast<number<B, et_off>&&>(b);
384 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(number<B, et_off>&& a, const number<B, et_off>& b)
386 using default_ops::eval_subtract;
387 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
388 eval_subtract(a.backend(), b.backend());
389 return static_cast<number<B, et_off>&&>(a);
392 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_signed_number<B>, number<B, et_off> >::type operator-(const number<B, et_off>& a, number<B, et_off>&& b)
394 using default_ops::eval_subtract;
395 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
396 eval_subtract(b.backend(), a.backend());
397 b.backend().negate();
398 return static_cast<number<B, et_off>&&>(b);
401 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(number<B, et_off>&& a, number<B, et_off>&& b)
403 using default_ops::eval_subtract;
404 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
405 eval_subtract(a.backend(), b.backend());
406 return static_cast<number<B, et_off>&&>(a);
408 template <class B, class V>
409 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
410 operator-(number<B, et_off>&& a, const V& b)
412 using default_ops::eval_subtract;
413 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
414 eval_subtract(a.backend(), number<B, et_off>::canonical_value(b));
415 return static_cast<number<B, et_off>&&>(a);
417 template <class V, class B>
418 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<(is_compatible_arithmetic_type<V, number<B, et_off> >::value && is_signed_number<B>::value), number<B, et_off> >::type
419 operator-(const V& a, number<B, et_off>&& b)
421 using default_ops::eval_subtract;
422 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
423 eval_subtract(b.backend(), number<B, et_off>::canonical_value(a));
424 b.backend().negate();
425 return static_cast<number<B, et_off>&&>(b);
431 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(number<B, et_off>&& a, const number<B, et_off>& b)
433 using default_ops::eval_multiply;
434 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
435 eval_multiply(a.backend(), b.backend());
436 return static_cast<number<B, et_off>&&>(a);
439 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(const number<B, et_off>& a, number<B, et_off>&& b)
441 using default_ops::eval_multiply;
442 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
443 eval_multiply(b.backend(), a.backend());
444 return static_cast<number<B, et_off>&&>(b);
447 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(number<B, et_off>&& a, number<B, et_off>&& b)
449 using default_ops::eval_multiply;
450 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
451 eval_multiply(a.backend(), b.backend());
452 return static_cast<number<B, et_off>&&>(a);
454 template <class B, class V>
455 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
456 operator*(number<B, et_off>&& a, const V& b)
458 using default_ops::eval_multiply;
459 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
460 eval_multiply(a.backend(), number<B, et_off>::canonical_value(b));
461 return static_cast<number<B, et_off>&&>(a);
463 template <class V, class B>
464 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
465 operator*(const V& a, number<B, et_off>&& b)
467 using default_ops::eval_multiply;
468 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
469 eval_multiply(b.backend(), number<B, et_off>::canonical_value(a));
470 return static_cast<number<B, et_off>&&>(b);
476 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator/(number<B, et_off>&& a, const number<B, et_off>& b)
478 using default_ops::eval_divide;
479 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
480 eval_divide(a.backend(), b.backend());
481 return static_cast<number<B, et_off>&&>(a);
483 template <class B, class V>
484 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
485 operator/(number<B, et_off>&& a, const V& b)
487 using default_ops::eval_divide;
488 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
489 eval_divide(a.backend(), number<B, et_off>::canonical_value(b));
490 return static_cast<number<B, et_off>&&>(a);
496 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(number<B, et_off>&& a, const number<B, et_off>& b)
498 using default_ops::eval_modulus;
499 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
500 eval_modulus(a.backend(), b.backend());
501 return static_cast<number<B, et_off>&&>(a);
503 template <class B, class V>
504 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
505 operator%(number<B, et_off>&& a, const V& b)
507 using default_ops::eval_modulus;
508 detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
509 eval_modulus(a.backend(), number<B, et_off>::canonical_value(b));
510 return static_cast<number<B, et_off>&&>(a);
516 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, const number<B, et_off>& b)
518 using default_ops::eval_bitwise_or;
519 eval_bitwise_or(a.backend(), b.backend());
520 return static_cast<number<B, et_off>&&>(a);
523 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, number<B, et_off>&& b)
525 using default_ops::eval_bitwise_or;
526 eval_bitwise_or(b.backend(), a.backend());
527 return static_cast<number<B, et_off>&&>(b);
530 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, number<B, et_off>&& b)
532 using default_ops::eval_bitwise_or;
533 eval_bitwise_or(a.backend(), b.backend());
534 return static_cast<number<B, et_off>&&>(a);
536 template <class B, class V>
537 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
538 operator|(number<B, et_off>&& a, const V& b)
540 using default_ops::eval_bitwise_or;
541 eval_bitwise_or(a.backend(), number<B, et_off>::canonical_value(b));
542 return static_cast<number<B, et_off>&&>(a);
544 template <class V, class B>
545 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
546 operator|(const V& a, number<B, et_off>&& b)
548 using default_ops::eval_bitwise_or;
549 eval_bitwise_or(b.backend(), number<B, et_off>::canonical_value(a));
550 return static_cast<number<B, et_off>&&>(b);
556 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, const number<B, et_off>& b)
558 using default_ops::eval_bitwise_xor;
559 eval_bitwise_xor(a.backend(), b.backend());
560 return static_cast<number<B, et_off>&&>(a);
563 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, number<B, et_off>&& b)
565 using default_ops::eval_bitwise_xor;
566 eval_bitwise_xor(b.backend(), a.backend());
567 return static_cast<number<B, et_off>&&>(b);
570 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, number<B, et_off>&& b)
572 using default_ops::eval_bitwise_xor;
573 eval_bitwise_xor(a.backend(), b.backend());
574 return static_cast<number<B, et_off>&&>(a);
576 template <class B, class V>
577 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
578 operator^(number<B, et_off>&& a, const V& b)
580 using default_ops::eval_bitwise_xor;
581 eval_bitwise_xor(a.backend(), number<B, et_off>::canonical_value(b));
582 return static_cast<number<B, et_off>&&>(a);
584 template <class V, class B>
585 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
586 operator^(const V& a, number<B, et_off>&& b)
588 using default_ops::eval_bitwise_xor;
589 eval_bitwise_xor(b.backend(), number<B, et_off>::canonical_value(a));
590 return static_cast<number<B, et_off>&&>(b);
596 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, const number<B, et_off>& b)
598 using default_ops::eval_bitwise_and;
599 eval_bitwise_and(a.backend(), b.backend());
600 return static_cast<number<B, et_off>&&>(a);
603 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, number<B, et_off>&& b)
605 using default_ops::eval_bitwise_and;
606 eval_bitwise_and(b.backend(), a.backend());
607 return static_cast<number<B, et_off>&&>(b);
610 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, number<B, et_off>&& b)
612 using default_ops::eval_bitwise_and;
613 eval_bitwise_and(a.backend(), b.backend());
614 return static_cast<number<B, et_off>&&>(a);
616 template <class B, class V>
617 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
618 operator&(number<B, et_off>&& a, const V& b)
620 using default_ops::eval_bitwise_and;
621 eval_bitwise_and(a.backend(), number<B, et_off>::canonical_value(b));
622 return static_cast<number<B, et_off>&&>(a);
624 template <class V, class B>
625 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
626 operator&(const V& a, number<B, et_off>&& b)
628 using default_ops::eval_bitwise_and;
629 eval_bitwise_and(b.backend(), number<B, et_off>::canonical_value(a));
630 return static_cast<number<B, et_off>&&>(b);
635 template <class B, class I>
636 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
637 operator<<(number<B, et_off>&& a, const I& b)
639 using default_ops::eval_left_shift;
640 eval_left_shift(a.backend(), b);
641 return static_cast<number<B, et_off>&&>(a);
643 template <class B, class I>
644 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
645 operator>>(number<B, et_off>&& a, const I& b)
647 using default_ops::eval_right_shift;
648 eval_right_shift(a.backend(), b);
649 return static_cast<number<B, et_off>&&>(a);
654 }} // namespace boost::multiprecision
660 #endif // BOOST_MP_NO_ET_OPS_HPP