Chris@16
|
1 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 // Copyright 2011 John Maddock. Distributed under the Boost
|
Chris@16
|
3 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef BOOST_MATH_BIG_NUM_BASE_HPP
|
Chris@16
|
7 #define BOOST_MATH_BIG_NUM_BASE_HPP
|
Chris@16
|
8
|
Chris@16
|
9 #include <limits>
|
Chris@16
|
10 #include <boost/utility/enable_if.hpp>
|
Chris@16
|
11 #include <boost/type_traits/is_convertible.hpp>
|
Chris@16
|
12 #include <boost/type_traits/decay.hpp>
|
Chris@16
|
13 #ifdef BOOST_MSVC
|
Chris@16
|
14 # pragma warning(push)
|
Chris@16
|
15 # pragma warning(disable:4307)
|
Chris@16
|
16 #endif
|
Chris@16
|
17 #include <boost/lexical_cast.hpp>
|
Chris@16
|
18 #ifdef BOOST_MSVC
|
Chris@16
|
19 # pragma warning(pop)
|
Chris@16
|
20 #endif
|
Chris@16
|
21
|
Chris@16
|
22 #if defined(NDEBUG) && !defined(_DEBUG)
|
Chris@16
|
23 # define BOOST_MP_FORCEINLINE BOOST_FORCEINLINE
|
Chris@16
|
24 #else
|
Chris@16
|
25 # define BOOST_MP_FORCEINLINE inline
|
Chris@16
|
26 #endif
|
Chris@16
|
27
|
Chris@16
|
28 namespace boost{ namespace multiprecision{
|
Chris@16
|
29
|
Chris@16
|
30 enum expression_template_option
|
Chris@16
|
31 {
|
Chris@16
|
32 et_off = 0,
|
Chris@16
|
33 et_on = 1
|
Chris@16
|
34 };
|
Chris@16
|
35
|
Chris@16
|
36 template <class Backend>
|
Chris@16
|
37 struct expression_template_default
|
Chris@16
|
38 {
|
Chris@16
|
39 static const expression_template_option value = et_on;
|
Chris@16
|
40 };
|
Chris@16
|
41
|
Chris@16
|
42 template <class Backend, expression_template_option ExpressionTemplates = expression_template_default<Backend>::value>
|
Chris@16
|
43 class number;
|
Chris@16
|
44
|
Chris@16
|
45 template <class T>
|
Chris@16
|
46 struct is_number : public mpl::false_ {};
|
Chris@16
|
47
|
Chris@16
|
48 template <class Backend, expression_template_option ExpressionTemplates>
|
Chris@16
|
49 struct is_number<number<Backend, ExpressionTemplates> > : public mpl::true_ {};
|
Chris@16
|
50
|
Chris@16
|
51 namespace detail{
|
Chris@16
|
52
|
Chris@16
|
53 // Forward-declare an expression wrapper
|
Chris@16
|
54 template<class tag, class Arg1 = void, class Arg2 = void, class Arg3 = void, class Arg4 = void>
|
Chris@16
|
55 struct expression;
|
Chris@16
|
56
|
Chris@16
|
57 } // namespace detail
|
Chris@16
|
58
|
Chris@16
|
59 template <class T>
|
Chris@16
|
60 struct is_number_expression : public mpl::false_ {};
|
Chris@16
|
61
|
Chris@16
|
62 template<class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
Chris@16
|
63 struct is_number_expression<detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > : public mpl::true_ {};
|
Chris@16
|
64
|
Chris@16
|
65 template <class T, class Num>
|
Chris@16
|
66 struct is_compatible_arithmetic_type
|
Chris@16
|
67 : public mpl::bool_<
|
Chris@16
|
68 is_convertible<T, Num>::value
|
Chris@16
|
69 && !is_same<T, Num>::value
|
Chris@16
|
70 && !is_number_expression<T>::value>
|
Chris@16
|
71 {};
|
Chris@16
|
72
|
Chris@16
|
73 namespace detail{
|
Chris@16
|
74 //
|
Chris@16
|
75 // Workaround for missing abs(long long) and abs(__int128) on some compilers:
|
Chris@16
|
76 //
|
Chris@16
|
77 template <class T>
|
Chris@101
|
78 BOOST_CONSTEXPR typename enable_if_c<(is_signed<T>::value || is_floating_point<T>::value), T>::type abs(T t) BOOST_NOEXCEPT
|
Chris@16
|
79 {
|
Chris@101
|
80 // This strange expression avoids a hardware trap in the corner case
|
Chris@101
|
81 // that val is the most negative value permitted in long long.
|
Chris@101
|
82 // See https://svn.boost.org/trac/boost/ticket/9740.
|
Chris@101
|
83 return t < 0 ? T(1u) + T(-(t + 1)) : t;
|
Chris@16
|
84 }
|
Chris@16
|
85 template <class T>
|
Chris@101
|
86 BOOST_CONSTEXPR typename enable_if_c<(is_unsigned<T>::value), T>::type abs(T t) BOOST_NOEXCEPT
|
Chris@16
|
87 {
|
Chris@16
|
88 return t;
|
Chris@16
|
89 }
|
Chris@16
|
90
|
Chris@16
|
91 #define BOOST_MP_USING_ABS using boost::multiprecision::detail::abs;
|
Chris@16
|
92
|
Chris@101
|
93 template <class T>
|
Chris@101
|
94 BOOST_CONSTEXPR typename enable_if_c<(is_signed<T>::value || is_floating_point<T>::value), typename make_unsigned<T>::type>::type unsigned_abs(T t) BOOST_NOEXCEPT
|
Chris@101
|
95 {
|
Chris@101
|
96 // This strange expression avoids a hardware trap in the corner case
|
Chris@101
|
97 // that val is the most negative value permitted in long long.
|
Chris@101
|
98 // See https://svn.boost.org/trac/boost/ticket/9740.
|
Chris@101
|
99 return t < 0 ? static_cast<typename make_unsigned<T>::type>(1u) + static_cast<typename make_unsigned<T>::type>(-(t + 1)) : static_cast<typename make_unsigned<T>::type>(t);
|
Chris@101
|
100 }
|
Chris@101
|
101 template <class T>
|
Chris@101
|
102 BOOST_CONSTEXPR typename enable_if_c<(is_unsigned<T>::value), T>::type unsigned_abs(T t) BOOST_NOEXCEPT
|
Chris@101
|
103 {
|
Chris@101
|
104 return t;
|
Chris@101
|
105 }
|
Chris@101
|
106
|
Chris@16
|
107 //
|
Chris@16
|
108 // Move support:
|
Chris@16
|
109 //
|
Chris@16
|
110 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
Chris@16
|
111 # define BOOST_MP_MOVE(x) std::move(x)
|
Chris@16
|
112 #else
|
Chris@16
|
113 # define BOOST_MP_MOVE(x) x
|
Chris@16
|
114 #endif
|
Chris@16
|
115
|
Chris@16
|
116 template <class T>
|
Chris@16
|
117 struct bits_of
|
Chris@16
|
118 {
|
Chris@16
|
119 BOOST_STATIC_ASSERT(is_integral<T>::value || is_enum<T>::value || std::numeric_limits<T>::is_specialized);
|
Chris@16
|
120 static const unsigned value =
|
Chris@16
|
121 std::numeric_limits<T>::is_specialized ?
|
Chris@16
|
122 std::numeric_limits<T>::digits
|
Chris@16
|
123 : sizeof(T) * CHAR_BIT - (is_signed<T>::value ? 1 : 0);
|
Chris@16
|
124 };
|
Chris@16
|
125
|
Chris@16
|
126 template <int b>
|
Chris@16
|
127 struct has_enough_bits
|
Chris@16
|
128 {
|
Chris@16
|
129 template <class T>
|
Chris@16
|
130 struct type : public mpl::bool_<bits_of<T>::value>= b>{};
|
Chris@16
|
131 };
|
Chris@16
|
132
|
Chris@16
|
133 template <class Val, class Backend, class Tag>
|
Chris@16
|
134 struct canonical_imp
|
Chris@16
|
135 {
|
Chris@16
|
136 typedef typename remove_cv<typename decay<const Val>::type>::type type;
|
Chris@16
|
137 };
|
Chris@16
|
138 template <class B, class Backend, class Tag>
|
Chris@16
|
139 struct canonical_imp<number<B, et_on>, Backend, Tag>
|
Chris@16
|
140 {
|
Chris@16
|
141 typedef B type;
|
Chris@16
|
142 };
|
Chris@16
|
143 template <class B, class Backend, class Tag>
|
Chris@16
|
144 struct canonical_imp<number<B, et_off>, Backend, Tag>
|
Chris@16
|
145 {
|
Chris@16
|
146 typedef B type;
|
Chris@16
|
147 };
|
Chris@101
|
148 #ifdef __SUNPRO_CC
|
Chris@101
|
149 template <class B, class Backend>
|
Chris@101
|
150 struct canonical_imp<number<B, et_on>, Backend, mpl::int_<3> >
|
Chris@101
|
151 {
|
Chris@101
|
152 typedef B type;
|
Chris@101
|
153 };
|
Chris@101
|
154 template <class B, class Backend>
|
Chris@101
|
155 struct canonical_imp<number<B, et_off>, Backend, mpl::int_<3> >
|
Chris@101
|
156 {
|
Chris@101
|
157 typedef B type;
|
Chris@101
|
158 };
|
Chris@101
|
159 #endif
|
Chris@16
|
160 template <class Val, class Backend>
|
Chris@16
|
161 struct canonical_imp<Val, Backend, mpl::int_<0> >
|
Chris@16
|
162 {
|
Chris@16
|
163 typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
Chris@16
|
164 typedef typename mpl::find_if<
|
Chris@16
|
165 typename Backend::signed_types,
|
Chris@16
|
166 pred_type
|
Chris@16
|
167 >::type iter_type;
|
Chris@16
|
168 typedef typename mpl::deref<iter_type>::type type;
|
Chris@16
|
169 };
|
Chris@16
|
170 template <class Val, class Backend>
|
Chris@16
|
171 struct canonical_imp<Val, Backend, mpl::int_<1> >
|
Chris@16
|
172 {
|
Chris@16
|
173 typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
Chris@16
|
174 typedef typename mpl::find_if<
|
Chris@16
|
175 typename Backend::unsigned_types,
|
Chris@16
|
176 pred_type
|
Chris@16
|
177 >::type iter_type;
|
Chris@16
|
178 typedef typename mpl::deref<iter_type>::type type;
|
Chris@16
|
179 };
|
Chris@16
|
180 template <class Val, class Backend>
|
Chris@16
|
181 struct canonical_imp<Val, Backend, mpl::int_<2> >
|
Chris@16
|
182 {
|
Chris@16
|
183 typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
Chris@16
|
184 typedef typename mpl::find_if<
|
Chris@16
|
185 typename Backend::float_types,
|
Chris@16
|
186 pred_type
|
Chris@16
|
187 >::type iter_type;
|
Chris@16
|
188 typedef typename mpl::deref<iter_type>::type type;
|
Chris@16
|
189 };
|
Chris@16
|
190 template <class Val, class Backend>
|
Chris@16
|
191 struct canonical_imp<Val, Backend, mpl::int_<3> >
|
Chris@16
|
192 {
|
Chris@16
|
193 typedef const char* type;
|
Chris@16
|
194 };
|
Chris@16
|
195
|
Chris@16
|
196 template <class Val, class Backend>
|
Chris@16
|
197 struct canonical
|
Chris@16
|
198 {
|
Chris@16
|
199 typedef typename mpl::if_<
|
Chris@16
|
200 is_signed<Val>,
|
Chris@16
|
201 mpl::int_<0>,
|
Chris@16
|
202 typename mpl::if_<
|
Chris@16
|
203 is_unsigned<Val>,
|
Chris@16
|
204 mpl::int_<1>,
|
Chris@16
|
205 typename mpl::if_<
|
Chris@16
|
206 is_floating_point<Val>,
|
Chris@16
|
207 mpl::int_<2>,
|
Chris@16
|
208 typename mpl::if_<
|
Chris@16
|
209 mpl::or_<
|
Chris@16
|
210 is_convertible<Val, const char*>,
|
Chris@16
|
211 is_same<Val, std::string>
|
Chris@16
|
212 >,
|
Chris@16
|
213 mpl::int_<3>,
|
Chris@16
|
214 mpl::int_<4>
|
Chris@16
|
215 >::type
|
Chris@16
|
216 >::type
|
Chris@16
|
217 >::type
|
Chris@16
|
218 >::type tag_type;
|
Chris@16
|
219
|
Chris@16
|
220 typedef typename canonical_imp<Val, Backend, tag_type>::type type;
|
Chris@16
|
221 };
|
Chris@16
|
222
|
Chris@16
|
223 struct terminal{};
|
Chris@16
|
224 struct negate{};
|
Chris@16
|
225 struct plus{};
|
Chris@16
|
226 struct minus{};
|
Chris@16
|
227 struct multiplies{};
|
Chris@16
|
228 struct divides{};
|
Chris@16
|
229 struct modulus{};
|
Chris@16
|
230 struct shift_left{};
|
Chris@16
|
231 struct shift_right{};
|
Chris@16
|
232 struct bitwise_and{};
|
Chris@16
|
233 struct bitwise_or{};
|
Chris@16
|
234 struct bitwise_xor{};
|
Chris@16
|
235 struct bitwise_complement{};
|
Chris@16
|
236 struct add_immediates{};
|
Chris@16
|
237 struct subtract_immediates{};
|
Chris@16
|
238 struct multiply_immediates{};
|
Chris@16
|
239 struct divide_immediates{};
|
Chris@16
|
240 struct modulus_immediates{};
|
Chris@16
|
241 struct bitwise_and_immediates{};
|
Chris@16
|
242 struct bitwise_or_immediates{};
|
Chris@16
|
243 struct bitwise_xor_immediates{};
|
Chris@16
|
244 struct complement_immediates{};
|
Chris@16
|
245 struct function{};
|
Chris@16
|
246 struct multiply_add{};
|
Chris@16
|
247 struct multiply_subtract{};
|
Chris@16
|
248
|
Chris@16
|
249 template <class T>
|
Chris@16
|
250 struct backend_type;
|
Chris@16
|
251
|
Chris@16
|
252 template <class T, expression_template_option ExpressionTemplates>
|
Chris@16
|
253 struct backend_type<number<T, ExpressionTemplates> >
|
Chris@16
|
254 {
|
Chris@16
|
255 typedef T type;
|
Chris@16
|
256 };
|
Chris@16
|
257
|
Chris@16
|
258 template <class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
259 struct backend_type<expression<tag, A1, A2, A3, A4> >
|
Chris@16
|
260 {
|
Chris@16
|
261 typedef typename backend_type<typename expression<tag, A1, A2, A3, A4>::result_type>::type type;
|
Chris@16
|
262 };
|
Chris@16
|
263
|
Chris@16
|
264
|
Chris@16
|
265 template <class T1, class T2>
|
Chris@16
|
266 struct combine_expression
|
Chris@16
|
267 {
|
Chris@16
|
268 #ifdef BOOST_NO_CXX11_DECLTYPE
|
Chris@16
|
269 typedef typename mpl::if_c<(sizeof(T1() + T2()) == sizeof(T1)), T1, T2>::type type;
|
Chris@16
|
270 #else
|
Chris@16
|
271 typedef decltype(T1() + T2()) type;
|
Chris@16
|
272 #endif
|
Chris@16
|
273 };
|
Chris@16
|
274
|
Chris@16
|
275 template <class T1, expression_template_option ExpressionTemplates, class T2>
|
Chris@16
|
276 struct combine_expression<number<T1, ExpressionTemplates>, T2>
|
Chris@16
|
277 {
|
Chris@16
|
278 typedef number<T1, ExpressionTemplates> type;
|
Chris@16
|
279 };
|
Chris@16
|
280
|
Chris@16
|
281 template <class T1, class T2, expression_template_option ExpressionTemplates>
|
Chris@16
|
282 struct combine_expression<T1, number<T2, ExpressionTemplates> >
|
Chris@16
|
283 {
|
Chris@16
|
284 typedef number<T2, ExpressionTemplates> type;
|
Chris@16
|
285 };
|
Chris@16
|
286
|
Chris@16
|
287 template <class T, expression_template_option ExpressionTemplates>
|
Chris@16
|
288 struct combine_expression<number<T, ExpressionTemplates>, number<T, ExpressionTemplates> >
|
Chris@16
|
289 {
|
Chris@16
|
290 typedef number<T, ExpressionTemplates> type;
|
Chris@16
|
291 };
|
Chris@16
|
292
|
Chris@16
|
293 template <class T1, expression_template_option ExpressionTemplates1, class T2, expression_template_option ExpressionTemplates2>
|
Chris@16
|
294 struct combine_expression<number<T1, ExpressionTemplates1>, number<T2, ExpressionTemplates2> >
|
Chris@16
|
295 {
|
Chris@16
|
296 typedef typename mpl::if_c<
|
Chris@16
|
297 is_convertible<number<T2, ExpressionTemplates2>, number<T1, ExpressionTemplates2> >::value,
|
Chris@16
|
298 number<T1, ExpressionTemplates1>,
|
Chris@16
|
299 number<T2, ExpressionTemplates2>
|
Chris@16
|
300 >::type type;
|
Chris@16
|
301 };
|
Chris@16
|
302
|
Chris@16
|
303 template <class T>
|
Chris@16
|
304 struct arg_type
|
Chris@16
|
305 {
|
Chris@16
|
306 typedef expression<terminal, T> type;
|
Chris@16
|
307 };
|
Chris@16
|
308
|
Chris@16
|
309 template <class Tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
Chris@16
|
310 struct arg_type<expression<Tag, Arg1, Arg2, Arg3, Arg4> >
|
Chris@16
|
311 {
|
Chris@16
|
312 typedef expression<Tag, Arg1, Arg2, Arg3, Arg4> type;
|
Chris@16
|
313 };
|
Chris@16
|
314
|
Chris@16
|
315 struct unmentionable
|
Chris@16
|
316 {
|
Chris@16
|
317 unmentionable* proc(){ return 0; }
|
Chris@16
|
318 };
|
Chris@16
|
319
|
Chris@16
|
320 typedef unmentionable* (unmentionable::*unmentionable_type)();
|
Chris@16
|
321
|
Chris@16
|
322 template <class T>
|
Chris@16
|
323 struct expression_storage
|
Chris@16
|
324 {
|
Chris@16
|
325 typedef const T& type;
|
Chris@16
|
326 };
|
Chris@16
|
327
|
Chris@16
|
328 template <class T>
|
Chris@16
|
329 struct expression_storage<T*>
|
Chris@16
|
330 {
|
Chris@16
|
331 typedef T* type;
|
Chris@16
|
332 };
|
Chris@16
|
333
|
Chris@16
|
334 template <class T>
|
Chris@16
|
335 struct expression_storage<const T*>
|
Chris@16
|
336 {
|
Chris@16
|
337 typedef const T* type;
|
Chris@16
|
338 };
|
Chris@16
|
339
|
Chris@16
|
340 template <class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
341 struct expression_storage<expression<tag, A1, A2, A3, A4> >
|
Chris@16
|
342 {
|
Chris@16
|
343 typedef expression<tag, A1, A2, A3, A4> type;
|
Chris@16
|
344 };
|
Chris@16
|
345
|
Chris@16
|
346 template<class tag, class Arg1>
|
Chris@16
|
347 struct expression<tag, Arg1, void, void, void>
|
Chris@16
|
348 {
|
Chris@16
|
349 typedef mpl::int_<1> arity;
|
Chris@16
|
350 typedef typename arg_type<Arg1>::type left_type;
|
Chris@16
|
351 typedef typename left_type::result_type left_result_type;
|
Chris@16
|
352 typedef typename left_type::result_type result_type;
|
Chris@16
|
353 typedef tag tag_type;
|
Chris@16
|
354
|
Chris@16
|
355 explicit expression(const Arg1& a) : arg(a) {}
|
Chris@16
|
356
|
Chris@16
|
357 left_type left()const { return left_type(arg); }
|
Chris@16
|
358
|
Chris@16
|
359 const Arg1& left_ref()const BOOST_NOEXCEPT { return arg; }
|
Chris@16
|
360
|
Chris@16
|
361 static const unsigned depth = left_type::depth + 1;
|
Chris@16
|
362 #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
Chris@16
|
363 explicit operator bool()const
|
Chris@16
|
364 {
|
Chris@16
|
365 result_type r(*this);
|
Chris@16
|
366 return static_cast<bool>(r);
|
Chris@16
|
367 }
|
Chris@16
|
368 #else
|
Chris@16
|
369 operator unmentionable_type()const
|
Chris@16
|
370 {
|
Chris@16
|
371 result_type r(*this);
|
Chris@16
|
372 return r ? &unmentionable::proc : 0;
|
Chris@16
|
373 }
|
Chris@16
|
374 #endif
|
Chris@16
|
375
|
Chris@16
|
376 private:
|
Chris@16
|
377 typename expression_storage<Arg1>::type arg;
|
Chris@16
|
378 expression& operator=(const expression&);
|
Chris@16
|
379 };
|
Chris@16
|
380
|
Chris@16
|
381 template<class Arg1>
|
Chris@16
|
382 struct expression<terminal, Arg1, void, void, void>
|
Chris@16
|
383 {
|
Chris@16
|
384 typedef mpl::int_<0> arity;
|
Chris@16
|
385 typedef Arg1 result_type;
|
Chris@16
|
386 typedef terminal tag_type;
|
Chris@16
|
387
|
Chris@16
|
388 explicit expression(const Arg1& a) : arg(a) {}
|
Chris@16
|
389
|
Chris@16
|
390 const Arg1& value()const BOOST_NOEXCEPT { return arg; }
|
Chris@16
|
391
|
Chris@16
|
392 static const unsigned depth = 0;
|
Chris@16
|
393
|
Chris@16
|
394 #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
Chris@16
|
395 explicit operator bool()const
|
Chris@16
|
396 {
|
Chris@16
|
397 return static_cast<bool>(arg);
|
Chris@16
|
398 }
|
Chris@16
|
399 #else
|
Chris@16
|
400 operator unmentionable_type()const
|
Chris@16
|
401 {
|
Chris@16
|
402 return arg ? &unmentionable::proc : 0;
|
Chris@16
|
403 }
|
Chris@16
|
404 #endif
|
Chris@16
|
405
|
Chris@16
|
406 private:
|
Chris@16
|
407 typename expression_storage<Arg1>::type arg;
|
Chris@16
|
408 expression& operator=(const expression&);
|
Chris@16
|
409 };
|
Chris@16
|
410
|
Chris@16
|
411 template <class tag, class Arg1, class Arg2>
|
Chris@16
|
412 struct expression<tag, Arg1, Arg2, void, void>
|
Chris@16
|
413 {
|
Chris@16
|
414 typedef mpl::int_<2> arity;
|
Chris@16
|
415 typedef typename arg_type<Arg1>::type left_type;
|
Chris@16
|
416 typedef typename arg_type<Arg2>::type right_type;
|
Chris@16
|
417 typedef typename left_type::result_type left_result_type;
|
Chris@16
|
418 typedef typename right_type::result_type right_result_type;
|
Chris@16
|
419 typedef typename combine_expression<left_result_type, right_result_type>::type result_type;
|
Chris@16
|
420 typedef tag tag_type;
|
Chris@16
|
421
|
Chris@16
|
422 expression(const Arg1& a1, const Arg2& a2) : arg1(a1), arg2(a2) {}
|
Chris@16
|
423
|
Chris@16
|
424 left_type left()const { return left_type(arg1); }
|
Chris@16
|
425 right_type right()const { return right_type(arg2); }
|
Chris@16
|
426 const Arg1& left_ref()const BOOST_NOEXCEPT { return arg1; }
|
Chris@16
|
427 const Arg2& right_ref()const BOOST_NOEXCEPT { return arg2; }
|
Chris@16
|
428
|
Chris@16
|
429 #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
Chris@16
|
430 explicit operator bool()const
|
Chris@16
|
431 {
|
Chris@16
|
432 result_type r(*this);
|
Chris@16
|
433 return static_cast<bool>(r);
|
Chris@16
|
434 }
|
Chris@16
|
435 #else
|
Chris@16
|
436 operator unmentionable_type()const
|
Chris@16
|
437 {
|
Chris@16
|
438 result_type r(*this);
|
Chris@16
|
439 return r ? &unmentionable::proc : 0;
|
Chris@16
|
440 }
|
Chris@16
|
441 #endif
|
Chris@16
|
442 static const unsigned left_depth = left_type::depth + 1;
|
Chris@16
|
443 static const unsigned right_depth = right_type::depth + 1;
|
Chris@16
|
444 static const unsigned depth = left_depth > right_depth ? left_depth : right_depth;
|
Chris@16
|
445 private:
|
Chris@16
|
446 typename expression_storage<Arg1>::type arg1;
|
Chris@16
|
447 typename expression_storage<Arg2>::type arg2;
|
Chris@16
|
448 expression& operator=(const expression&);
|
Chris@16
|
449 };
|
Chris@16
|
450
|
Chris@16
|
451 template <class tag, class Arg1, class Arg2, class Arg3>
|
Chris@16
|
452 struct expression<tag, Arg1, Arg2, Arg3, void>
|
Chris@16
|
453 {
|
Chris@16
|
454 typedef mpl::int_<3> arity;
|
Chris@16
|
455 typedef typename arg_type<Arg1>::type left_type;
|
Chris@16
|
456 typedef typename arg_type<Arg2>::type middle_type;
|
Chris@16
|
457 typedef typename arg_type<Arg3>::type right_type;
|
Chris@16
|
458 typedef typename left_type::result_type left_result_type;
|
Chris@16
|
459 typedef typename middle_type::result_type middle_result_type;
|
Chris@16
|
460 typedef typename right_type::result_type right_result_type;
|
Chris@16
|
461 typedef typename combine_expression<
|
Chris@16
|
462 left_result_type,
|
Chris@16
|
463 typename combine_expression<right_result_type, middle_result_type>::type
|
Chris@16
|
464 >::type result_type;
|
Chris@16
|
465 typedef tag tag_type;
|
Chris@16
|
466
|
Chris@16
|
467 expression(const Arg1& a1, const Arg2& a2, const Arg3& a3) : arg1(a1), arg2(a2), arg3(a3) {}
|
Chris@16
|
468
|
Chris@16
|
469 left_type left()const { return left_type(arg1); }
|
Chris@16
|
470 middle_type middle()const { return middle_type(arg2); }
|
Chris@16
|
471 right_type right()const { return right_type(arg3); }
|
Chris@16
|
472 const Arg1& left_ref()const BOOST_NOEXCEPT { return arg1; }
|
Chris@16
|
473 const Arg2& middle_ref()const BOOST_NOEXCEPT { return arg2; }
|
Chris@16
|
474 const Arg3& right_ref()const BOOST_NOEXCEPT { return arg3; }
|
Chris@16
|
475
|
Chris@16
|
476 #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
Chris@16
|
477 explicit operator bool()const
|
Chris@16
|
478 {
|
Chris@16
|
479 result_type r(*this);
|
Chris@16
|
480 return static_cast<bool>(r);
|
Chris@16
|
481 }
|
Chris@16
|
482 #else
|
Chris@16
|
483 operator unmentionable_type()const
|
Chris@16
|
484 {
|
Chris@16
|
485 result_type r(*this);
|
Chris@16
|
486 return r ? &unmentionable::proc : 0;
|
Chris@16
|
487 }
|
Chris@16
|
488 #endif
|
Chris@16
|
489 static const unsigned left_depth = left_type::depth + 1;
|
Chris@16
|
490 static const unsigned middle_depth = middle_type::depth + 1;
|
Chris@16
|
491 static const unsigned right_depth = right_type::depth + 1;
|
Chris@16
|
492 static const unsigned depth = left_depth > right_depth ? (left_depth > middle_depth ? left_depth : middle_depth) : (right_depth > middle_depth ? right_depth : middle_depth);
|
Chris@16
|
493 private:
|
Chris@16
|
494 typename expression_storage<Arg1>::type arg1;
|
Chris@16
|
495 typename expression_storage<Arg2>::type arg2;
|
Chris@16
|
496 typename expression_storage<Arg3>::type arg3;
|
Chris@16
|
497 expression& operator=(const expression&);
|
Chris@16
|
498 };
|
Chris@16
|
499
|
Chris@16
|
500 template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
Chris@16
|
501 struct expression
|
Chris@16
|
502 {
|
Chris@16
|
503 typedef mpl::int_<4> arity;
|
Chris@16
|
504 typedef typename arg_type<Arg1>::type left_type;
|
Chris@16
|
505 typedef typename arg_type<Arg2>::type left_middle_type;
|
Chris@16
|
506 typedef typename arg_type<Arg3>::type right_middle_type;
|
Chris@16
|
507 typedef typename arg_type<Arg4>::type right_type;
|
Chris@16
|
508 typedef typename left_type::result_type left_result_type;
|
Chris@16
|
509 typedef typename left_middle_type::result_type left_middle_result_type;
|
Chris@16
|
510 typedef typename right_middle_type::result_type right_middle_result_type;
|
Chris@16
|
511 typedef typename right_type::result_type right_result_type;
|
Chris@16
|
512 typedef typename combine_expression<
|
Chris@16
|
513 typename combine_expression<
|
Chris@16
|
514 typename combine_expression<left_result_type, left_middle_result_type>::type,
|
Chris@16
|
515 right_middle_result_type
|
Chris@16
|
516 >::type,
|
Chris@16
|
517 right_result_type
|
Chris@16
|
518 >::type result_type;
|
Chris@16
|
519 typedef tag tag_type;
|
Chris@16
|
520
|
Chris@16
|
521 expression(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) : arg1(a1), arg2(a2), arg3(a3), arg4(a4) {}
|
Chris@16
|
522
|
Chris@16
|
523 left_type left()const { return left_type(arg1); }
|
Chris@16
|
524 left_middle_type left_middle()const { return left_middle_type(arg2); }
|
Chris@16
|
525 right_middle_type right_middle()const { return right_middle_type(arg3); }
|
Chris@16
|
526 right_type right()const { return right_type(arg4); }
|
Chris@16
|
527 const Arg1& left_ref()const BOOST_NOEXCEPT { return arg1; }
|
Chris@16
|
528 const Arg2& left_middle_ref()const BOOST_NOEXCEPT { return arg2; }
|
Chris@16
|
529 const Arg3& right_middle_ref()const BOOST_NOEXCEPT { return arg3; }
|
Chris@16
|
530 const Arg4& right_ref()const BOOST_NOEXCEPT { return arg4; }
|
Chris@16
|
531
|
Chris@16
|
532 #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
Chris@16
|
533 explicit operator bool()const
|
Chris@16
|
534 {
|
Chris@16
|
535 result_type r(*this);
|
Chris@16
|
536 return static_cast<bool>(r);
|
Chris@16
|
537 }
|
Chris@16
|
538 #else
|
Chris@16
|
539 operator unmentionable_type()const
|
Chris@16
|
540 {
|
Chris@16
|
541 result_type r(*this);
|
Chris@16
|
542 return r ? &unmentionable::proc : 0;
|
Chris@16
|
543 }
|
Chris@16
|
544 #endif
|
Chris@16
|
545 static const unsigned left_depth = left_type::depth + 1;
|
Chris@16
|
546 static const unsigned left_middle_depth = left_middle_type::depth + 1;
|
Chris@16
|
547 static const unsigned right_middle_depth = right_middle_type::depth + 1;
|
Chris@16
|
548 static const unsigned right_depth = right_type::depth + 1;
|
Chris@16
|
549
|
Chris@16
|
550 static const unsigned left_max_depth = left_depth > left_middle_depth ? left_depth : left_middle_depth;
|
Chris@16
|
551 static const unsigned right_max_depth = right_depth > right_middle_depth ? right_depth : right_middle_depth;
|
Chris@16
|
552
|
Chris@16
|
553 static const unsigned depth = left_max_depth > right_max_depth ? left_max_depth : right_max_depth;
|
Chris@16
|
554 private:
|
Chris@16
|
555 typename expression_storage<Arg1>::type arg1;
|
Chris@16
|
556 typename expression_storage<Arg2>::type arg2;
|
Chris@16
|
557 typename expression_storage<Arg3>::type arg3;
|
Chris@16
|
558 typename expression_storage<Arg4>::type arg4;
|
Chris@16
|
559 expression& operator=(const expression&);
|
Chris@16
|
560 };
|
Chris@16
|
561
|
Chris@16
|
562 template <class T>
|
Chris@16
|
563 struct digits2
|
Chris@16
|
564 {
|
Chris@16
|
565 BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_specialized);
|
Chris@16
|
566 BOOST_STATIC_ASSERT((std::numeric_limits<T>::radix == 2) || (std::numeric_limits<T>::radix == 10));
|
Chris@16
|
567 // If we really have so many digits that this fails, then we're probably going to hit other problems anyway:
|
Chris@16
|
568 BOOST_STATIC_ASSERT(LONG_MAX / 1000 > (std::numeric_limits<T>::digits + 1));
|
Chris@16
|
569 static const long value = std::numeric_limits<T>::radix == 10 ? (((std::numeric_limits<T>::digits + 1) * 1000L) / 301L) : std::numeric_limits<T>::digits;
|
Chris@16
|
570 };
|
Chris@16
|
571
|
Chris@16
|
572 #ifndef BOOST_MP_MIN_EXPONENT_DIGITS
|
Chris@16
|
573 #ifdef _MSC_VER
|
Chris@16
|
574 # define BOOST_MP_MIN_EXPONENT_DIGITS 2
|
Chris@16
|
575 #else
|
Chris@16
|
576 # define BOOST_MP_MIN_EXPONENT_DIGITS 2
|
Chris@16
|
577 #endif
|
Chris@16
|
578 #endif
|
Chris@16
|
579
|
Chris@16
|
580 template <class S>
|
Chris@16
|
581 void format_float_string(S& str, boost::intmax_t my_exp, boost::intmax_t digits, std::ios_base::fmtflags f, bool iszero)
|
Chris@16
|
582 {
|
Chris@16
|
583 typedef typename S::size_type size_type;
|
Chris@16
|
584 bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
|
Chris@16
|
585 bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
|
Chris@16
|
586 bool showpoint = (f & std::ios_base::showpoint) == std::ios_base::showpoint;
|
Chris@16
|
587 bool showpos = (f & std::ios_base::showpos) == std::ios_base::showpos;
|
Chris@16
|
588
|
Chris@16
|
589 bool neg = str.size() && (str[0] == '-');
|
Chris@16
|
590
|
Chris@16
|
591 if(neg)
|
Chris@16
|
592 str.erase(0, 1);
|
Chris@16
|
593
|
Chris@16
|
594 if(digits == 0)
|
Chris@16
|
595 {
|
Chris@16
|
596 digits = (std::max)(str.size(), size_type(16));
|
Chris@16
|
597 }
|
Chris@16
|
598
|
Chris@16
|
599 if(iszero || str.empty() || (str.find_first_not_of('0') == S::npos))
|
Chris@16
|
600 {
|
Chris@16
|
601 // We will be printing zero, even though the value might not
|
Chris@16
|
602 // actually be zero (it just may have been rounded to zero).
|
Chris@16
|
603 str = "0";
|
Chris@16
|
604 if(scientific || fixed)
|
Chris@16
|
605 {
|
Chris@16
|
606 str.append(1, '.');
|
Chris@16
|
607 str.append(size_type(digits), '0');
|
Chris@16
|
608 if(scientific)
|
Chris@16
|
609 str.append("e+00");
|
Chris@16
|
610 }
|
Chris@16
|
611 else
|
Chris@16
|
612 {
|
Chris@16
|
613 if(showpoint)
|
Chris@16
|
614 {
|
Chris@16
|
615 str.append(1, '.');
|
Chris@16
|
616 if(digits > 1)
|
Chris@16
|
617 str.append(size_type(digits - 1), '0');
|
Chris@16
|
618 }
|
Chris@16
|
619 }
|
Chris@16
|
620 if(neg)
|
Chris@101
|
621 str.insert(static_cast<std::string::size_type>(0), 1, '-');
|
Chris@16
|
622 else if(showpos)
|
Chris@101
|
623 str.insert(static_cast<std::string::size_type>(0), 1, '+');
|
Chris@16
|
624 return;
|
Chris@16
|
625 }
|
Chris@16
|
626
|
Chris@16
|
627 if(!fixed && !scientific && !showpoint)
|
Chris@16
|
628 {
|
Chris@16
|
629 //
|
Chris@16
|
630 // Suppress trailing zeros:
|
Chris@16
|
631 //
|
Chris@16
|
632 std::string::iterator pos = str.end();
|
Chris@16
|
633 while(pos != str.begin() && *--pos == '0'){}
|
Chris@16
|
634 if(pos != str.end())
|
Chris@16
|
635 ++pos;
|
Chris@16
|
636 str.erase(pos, str.end());
|
Chris@16
|
637 if(str.empty())
|
Chris@16
|
638 str = '0';
|
Chris@16
|
639 }
|
Chris@16
|
640 else if(!fixed || (my_exp >= 0))
|
Chris@16
|
641 {
|
Chris@16
|
642 //
|
Chris@16
|
643 // Pad out the end with zero's if we need to:
|
Chris@16
|
644 //
|
Chris@16
|
645 boost::intmax_t chars = str.size();
|
Chris@16
|
646 chars = digits - chars;
|
Chris@16
|
647 if(scientific)
|
Chris@16
|
648 ++chars;
|
Chris@16
|
649 if(chars > 0)
|
Chris@16
|
650 {
|
Chris@16
|
651 str.append(static_cast<std::string::size_type>(chars), '0');
|
Chris@16
|
652 }
|
Chris@16
|
653 }
|
Chris@16
|
654
|
Chris@16
|
655 if(fixed || (!scientific && (my_exp >= -4) && (my_exp < digits)))
|
Chris@16
|
656 {
|
Chris@16
|
657 if(1 + my_exp > static_cast<boost::intmax_t>(str.size()))
|
Chris@16
|
658 {
|
Chris@16
|
659 // Just pad out the end with zeros:
|
Chris@16
|
660 str.append(static_cast<std::string::size_type>(1 + my_exp - str.size()), '0');
|
Chris@16
|
661 if(showpoint || fixed)
|
Chris@16
|
662 str.append(".");
|
Chris@16
|
663 }
|
Chris@16
|
664 else if(my_exp + 1 < static_cast<boost::intmax_t>(str.size()))
|
Chris@16
|
665 {
|
Chris@16
|
666 if(my_exp < 0)
|
Chris@16
|
667 {
|
Chris@101
|
668 str.insert(static_cast<std::string::size_type>(0), static_cast<std::string::size_type>(-1 - my_exp), '0');
|
Chris@101
|
669 str.insert(static_cast<std::string::size_type>(0), "0.");
|
Chris@16
|
670 }
|
Chris@16
|
671 else
|
Chris@16
|
672 {
|
Chris@16
|
673 // Insert the decimal point:
|
Chris@16
|
674 str.insert(static_cast<std::string::size_type>(my_exp + 1), 1, '.');
|
Chris@16
|
675 }
|
Chris@16
|
676 }
|
Chris@16
|
677 else if(showpoint || fixed) // we have exactly the digits we require to left of the point
|
Chris@16
|
678 str += ".";
|
Chris@16
|
679
|
Chris@16
|
680 if(fixed)
|
Chris@16
|
681 {
|
Chris@16
|
682 // We may need to add trailing zeros:
|
Chris@16
|
683 boost::intmax_t l = str.find('.') + 1;
|
Chris@16
|
684 l = digits - (str.size() - l);
|
Chris@16
|
685 if(l > 0)
|
Chris@16
|
686 str.append(size_type(l), '0');
|
Chris@16
|
687 }
|
Chris@16
|
688 }
|
Chris@16
|
689 else
|
Chris@16
|
690 {
|
Chris@16
|
691 BOOST_MP_USING_ABS
|
Chris@16
|
692 // Scientific format:
|
Chris@16
|
693 if(showpoint || (str.size() > 1))
|
Chris@101
|
694 str.insert(static_cast<std::string::size_type>(1u), 1, '.');
|
Chris@101
|
695 str.append(static_cast<std::string::size_type>(1u), 'e');
|
Chris@16
|
696 S e = boost::lexical_cast<S>(abs(my_exp));
|
Chris@16
|
697 if(e.size() < BOOST_MP_MIN_EXPONENT_DIGITS)
|
Chris@101
|
698 e.insert(static_cast<std::string::size_type>(0), BOOST_MP_MIN_EXPONENT_DIGITS - e.size(), '0');
|
Chris@16
|
699 if(my_exp < 0)
|
Chris@101
|
700 e.insert(static_cast<std::string::size_type>(0), 1, '-');
|
Chris@16
|
701 else
|
Chris@101
|
702 e.insert(static_cast<std::string::size_type>(0), 1, '+');
|
Chris@16
|
703 str.append(e);
|
Chris@16
|
704 }
|
Chris@16
|
705 if(neg)
|
Chris@101
|
706 str.insert(static_cast<std::string::size_type>(0), 1, '-');
|
Chris@16
|
707 else if(showpos)
|
Chris@101
|
708 str.insert(static_cast<std::string::size_type>(0), 1, '+');
|
Chris@16
|
709 }
|
Chris@16
|
710
|
Chris@16
|
711 template <class V>
|
Chris@16
|
712 void check_shift_range(V val, const mpl::true_&, const mpl::true_&)
|
Chris@16
|
713 {
|
Chris@16
|
714 if(val > (std::numeric_limits<std::size_t>::max)())
|
Chris@16
|
715 BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
|
Chris@16
|
716 if(val < 0)
|
Chris@16
|
717 BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
|
Chris@16
|
718 }
|
Chris@16
|
719 template <class V>
|
Chris@16
|
720 void check_shift_range(V val, const mpl::false_&, const mpl::true_&)
|
Chris@16
|
721 {
|
Chris@16
|
722 if(val < 0)
|
Chris@16
|
723 BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
|
Chris@16
|
724 }
|
Chris@16
|
725 template <class V>
|
Chris@16
|
726 void check_shift_range(V val, const mpl::true_&, const mpl::false_&)
|
Chris@16
|
727 {
|
Chris@16
|
728 if(val > (std::numeric_limits<std::size_t>::max)())
|
Chris@16
|
729 BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
|
Chris@16
|
730 }
|
Chris@16
|
731 template <class V>
|
Chris@16
|
732 void check_shift_range(V, const mpl::false_&, const mpl::false_&) BOOST_NOEXCEPT{}
|
Chris@16
|
733
|
Chris@16
|
734 } // namespace detail
|
Chris@16
|
735
|
Chris@16
|
736 //
|
Chris@16
|
737 // Traits class, lets us know what kind of number we have, defaults to a floating point type:
|
Chris@16
|
738 //
|
Chris@16
|
739 enum number_category_type
|
Chris@16
|
740 {
|
Chris@16
|
741 number_kind_unknown = -1,
|
Chris@16
|
742 number_kind_integer = 0,
|
Chris@16
|
743 number_kind_floating_point = 1,
|
Chris@16
|
744 number_kind_rational = 2,
|
Chris@16
|
745 number_kind_fixed_point = 3
|
Chris@16
|
746 };
|
Chris@16
|
747
|
Chris@16
|
748 template <class Num>
|
Chris@16
|
749 struct number_category : public mpl::int_<std::numeric_limits<Num>::is_integer ? number_kind_integer : (std::numeric_limits<Num>::max_exponent ? number_kind_floating_point : number_kind_unknown)> {};
|
Chris@16
|
750 template <class Backend, expression_template_option ExpressionTemplates>
|
Chris@16
|
751 struct number_category<number<Backend, ExpressionTemplates> > : public number_category<Backend>{};
|
Chris@16
|
752 template <class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
753 struct number_category<detail::expression<tag, A1, A2, A3, A4> > : public number_category<typename detail::expression<tag, A1, A2, A3, A4>::result_type>{};
|
Chris@16
|
754
|
Chris@16
|
755 template <class T>
|
Chris@16
|
756 struct component_type;
|
Chris@16
|
757 template <class T, expression_template_option ExpressionTemplates>
|
Chris@16
|
758 struct component_type<number<T, ExpressionTemplates> > : public component_type<T>{};
|
Chris@16
|
759 template <class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
760 struct component_type<detail::expression<tag, A1, A2, A3, A4> > : public component_type<typename detail::expression<tag, A1, A2, A3, A4>::result_type>{};
|
Chris@16
|
761
|
Chris@16
|
762 template <class T>
|
Chris@16
|
763 struct is_unsigned_number : public mpl::false_{};
|
Chris@16
|
764 template <class Backend, expression_template_option ExpressionTemplates>
|
Chris@16
|
765 struct is_unsigned_number<number<Backend, ExpressionTemplates> > : public is_unsigned_number<Backend> {};
|
Chris@16
|
766 template <class T>
|
Chris@16
|
767 struct is_signed_number : public mpl::bool_<!is_unsigned_number<T>::value> {};
|
Chris@16
|
768 template <class T>
|
Chris@16
|
769 struct is_interval_number : public mpl::false_ {};
|
Chris@16
|
770 template <class Backend, expression_template_option ExpressionTemplates>
|
Chris@16
|
771 struct is_interval_number<number<Backend, ExpressionTemplates> > : public is_interval_number<Backend>{};
|
Chris@16
|
772
|
Chris@16
|
773 }} // namespaces
|
Chris@16
|
774
|
Chris@16
|
775 namespace boost{ namespace math{ namespace tools{
|
Chris@16
|
776
|
Chris@16
|
777 template <class T>
|
Chris@16
|
778 struct promote_arg;
|
Chris@16
|
779
|
Chris@16
|
780 template <class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
781 struct promote_arg<boost::multiprecision::detail::expression<tag, A1, A2, A3, A4> >
|
Chris@16
|
782 {
|
Chris@16
|
783 typedef typename boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>::result_type type;
|
Chris@16
|
784 };
|
Chris@16
|
785
|
Chris@16
|
786 template <class R, class B, boost::multiprecision::expression_template_option ET>
|
Chris@16
|
787 inline R real_cast(const boost::multiprecision::number<B, ET>& val)
|
Chris@16
|
788 {
|
Chris@16
|
789 return val.template convert_to<R>();
|
Chris@16
|
790 }
|
Chris@16
|
791
|
Chris@16
|
792 template <class R, class tag, class A1, class A2, class A3, class A4>
|
Chris@16
|
793 inline R real_cast(const boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>& val)
|
Chris@16
|
794 {
|
Chris@16
|
795 typedef typename boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>::result_type val_type;
|
Chris@16
|
796 return val_type(val).template convert_to<R>();
|
Chris@16
|
797 }
|
Chris@16
|
798
|
Chris@16
|
799
|
Chris@101
|
800 }
|
Chris@101
|
801
|
Chris@101
|
802 namespace constants{
|
Chris@101
|
803
|
Chris@101
|
804 template <class T>
|
Chris@101
|
805 struct is_explicitly_convertible_from_string;
|
Chris@101
|
806
|
Chris@101
|
807 template <class B, boost::multiprecision::expression_template_option ET>
|
Chris@101
|
808 struct is_explicitly_convertible_from_string<boost::multiprecision::number<B, ET> >
|
Chris@101
|
809 {
|
Chris@101
|
810 static const bool value = true;
|
Chris@101
|
811 };
|
Chris@101
|
812
|
Chris@101
|
813 }
|
Chris@101
|
814
|
Chris@101
|
815 }}
|
Chris@16
|
816
|
Chris@16
|
817 #endif // BOOST_MATH_BIG_NUM_BASE_HPP
|
Chris@16
|
818
|
Chris@16
|
819
|