3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Conceptual Requirements for Real Number Types
</title>
5 <link rel=
"stylesheet" href=
"../math.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../index.html" title=
"Math Toolkit 2.5.1">
8 <link rel=
"up" href=
"../using_udt.html" title=
"Chapter 14. Use with User-Defined Floating-Point Types - Boost.Multiprecision and others">
9 <link rel=
"prev" href=
"high_precision/using_test.html" title=
"Using without expression templates for Boost.Test and others">
10 <link rel=
"next" href=
"dist_concept.html" title=
"Conceptual Requirements for Distribution Types">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"high_precision/using_test.html"><img src=
"../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../using_udt.html"><img src=
"../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../index.html"><img src=
"../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"dist_concept.html"><img src=
"../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
27 <a name=
"math_toolkit.real_concepts"></a><a class=
"link" href=
"real_concepts.html" title=
"Conceptual Requirements for Real Number Types">Conceptual Requirements for
29 </h2></div></div></div>
31 The functions and statistical distributions in this library can be used with
32 any type
<span class=
"emphasis"><em>RealType
</em></span> that meets the conceptual requirements
33 given below. All the built-in floating-point types like
<code class=
"computeroutput"><span class=
"keyword">double
</span></code>
34 will meet these requirements. (Built-in types are also called
<a href=
"http://en.cppreference.com/w/cpp/language/types" target=
"_top">fundamental
38 User-defined types that meet the conceptual requirements can also be used.
39 For example, with
<a class=
"link" href=
"high_precision/use_ntl.html" title=
"Using NTL Library">a thin
40 wrapper class
</a> one of the types provided with
<a href=
"http://shoup.net/ntl/" target=
"_top">NTL
41 (RR)
</a> can be used. But now that
<a href=
"../../../../../libs/multiprecision/doc/html/index.html" target=
"_top">Boost.Multiprecision
</a>
42 library is available, this has become the preferred real-number type, typically
43 <a href=
"../../../../../libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html" target=
"_top">cpp_dec_float
</a>
44 or
<a href=
"../../../../../libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html" target=
"_top">cpp_bin_float
</a>.
47 Submissions of binding to other extended precision types would also still be
51 The guiding principal behind these requirements is that a
<span class=
"emphasis"><em>RealType
</em></span>
52 behaves just like a built-in floating-point type.
55 <a name=
"math_toolkit.real_concepts.h0"></a>
56 <span class=
"phrase"><a name=
"math_toolkit.real_concepts.basic_arithmetic_requirements"></a></span><a class=
"link" href=
"real_concepts.html#math_toolkit.real_concepts.basic_arithmetic_requirements">Basic Arithmetic
60 These requirements are common to all of the functions in this library.
63 In the following table
<span class=
"emphasis"><em>r
</em></span> is an object of type
<code class=
"computeroutput"><span class=
"identifier">RealType
</span></code>,
<span class=
"emphasis"><em>cr
</em></span> and
<span class=
"emphasis"><em>cr2
</em></span>
64 are objects of type
<code class=
"computeroutput"><span class=
"keyword">const
</span> <span class=
"identifier">RealType
</span></code>,
65 and
<span class=
"emphasis"><em>ca
</em></span> is an object of type
<code class=
"computeroutput"><span class=
"keyword">const
</span>
66 <span class=
"identifier">arithmetic
</span><span class=
"special">-
</span><span class=
"identifier">type
</span></code> (arithmetic types include all the built
67 in integers and floating point types).
69 <div class=
"informaltable"><table class=
"table">
96 <code class=
"computeroutput"><span class=
"identifier">RealType
</span><span class=
"special">(
</span><span class=
"identifier">cr
</span><span class=
"special">)
</span></code>
106 RealType is copy constructible.
113 <code class=
"computeroutput"><span class=
"identifier">RealType
</span><span class=
"special">(
</span><span class=
"identifier">ca
</span><span class=
"special">)
</span></code>
123 RealType is copy constructible from the arithmetic types.
130 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">=
</span>
131 <span class=
"identifier">cr
</span></code>
148 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">=
</span>
149 <span class=
"identifier">ca
</span></code>
159 Assignment operator from the arithmetic types.
166 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">+=
</span>
167 <span class=
"identifier">cr
</span></code>
184 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">+=
</span>
185 <span class=
"identifier">ca
</span></code>
202 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">-=
</span>
203 <span class=
"identifier">cr
</span></code>
220 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">-=
</span>
221 <span class=
"identifier">ca
</span></code>
238 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">*=
</span>
239 <span class=
"identifier">cr
</span></code>
256 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">*=
</span>
257 <span class=
"identifier">ca
</span></code>
274 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">/=
</span>
275 <span class=
"identifier">cr
</span></code>
292 <code class=
"computeroutput"><span class=
"identifier">r
</span> <span class=
"special">/=
</span>
293 <span class=
"identifier">ca
</span></code>
310 <code class=
"computeroutput"><span class=
"special">-
</span><span class=
"identifier">r
</span></code>
327 <code class=
"computeroutput"><span class=
"special">+
</span><span class=
"identifier">r
</span></code>
344 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">+
</span>
345 <span class=
"identifier">cr2
</span></code>
362 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">+
</span>
363 <span class=
"identifier">ca
</span></code>
380 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">+
</span>
381 <span class=
"identifier">cr
</span></code>
398 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">-
</span>
399 <span class=
"identifier">cr2
</span></code>
416 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">-
</span>
417 <span class=
"identifier">ca
</span></code>
434 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">-
</span>
435 <span class=
"identifier">cr
</span></code>
452 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">*
</span>
453 <span class=
"identifier">cr2
</span></code>
463 Binary Multiplication
470 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">*
</span>
471 <span class=
"identifier">ca
</span></code>
481 Binary Multiplication
488 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">*
</span>
489 <span class=
"identifier">cr
</span></code>
499 Binary Multiplication
506 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">/
</span>
507 <span class=
"identifier">cr2
</span></code>
524 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">/
</span>
525 <span class=
"identifier">ca
</span></code>
542 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">/
</span>
543 <span class=
"identifier">cr
</span></code>
560 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">==
</span>
561 <span class=
"identifier">cr2
</span></code>
578 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">==
</span>
579 <span class=
"identifier">ca
</span></code>
596 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">==
</span>
597 <span class=
"identifier">cr
</span></code>
614 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">!=
</span>
615 <span class=
"identifier">cr2
</span></code>
625 Inequality Comparison
632 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">!=
</span>
633 <span class=
"identifier">ca
</span></code>
643 Inequality Comparison
650 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">!=
</span>
651 <span class=
"identifier">cr
</span></code>
661 Inequality Comparison
668 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special"><=
</span>
669 <span class=
"identifier">cr2
</span></code>
686 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special"><=
</span>
687 <span class=
"identifier">ca
</span></code>
704 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special"><=
</span>
705 <span class=
"identifier">cr
</span></code>
722 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">>=
</span>
723 <span class=
"identifier">cr2
</span></code>
733 Greater than equal to.
740 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">>=
</span>
741 <span class=
"identifier">ca
</span></code>
751 Greater than equal to.
758 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">>=
</span>
759 <span class=
"identifier">cr
</span></code>
769 Greater than equal to.
776 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special"><</span>
777 <span class=
"identifier">cr2
</span></code>
787 Less than comparison.
794 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special"><</span>
795 <span class=
"identifier">ca
</span></code>
805 Less than comparison.
812 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special"><</span>
813 <span class=
"identifier">cr
</span></code>
823 Less than comparison.
830 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">></span>
831 <span class=
"identifier">cr2
</span></code>
841 Greater than comparison.
848 <code class=
"computeroutput"><span class=
"identifier">cr
</span> <span class=
"special">></span>
849 <span class=
"identifier">ca
</span></code>
859 Greater than comparison.
866 <code class=
"computeroutput"><span class=
"identifier">ca
</span> <span class=
"special">></span>
867 <span class=
"identifier">cr
</span></code>
877 Greater than comparison.
884 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">digits
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
894 The number of digits in the significand of RealType.
901 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">max_value
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
911 The largest representable number by type RealType.
918 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">min_value
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
928 The smallest representable number by type RealType.
935 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">log_max_value
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
945 The natural logarithm of the largest representable number by type
953 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">log_min_value
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
963 The natural logarithm of the smallest representable number by type
971 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">tools
</span><span class=
"special">::
</span><span class=
"identifier">epsilon
</span><span class=
"special"><</span><span class=
"identifier">RealType
</span><span class=
"special">>()
</span></code>
981 The machine epsilon of RealType.
990 <div class=
"orderedlist"><ol class=
"orderedlist" type=
"1">
991 <li class=
"listitem">
992 The functions
<code class=
"computeroutput"><span class=
"identifier">log_max_value
</span></code>
993 and
<code class=
"computeroutput"><span class=
"identifier">log_min_value
</span></code> can be
994 synthesised from the others, and so no explicit specialisation is required.
996 <li class=
"listitem">
997 The function
<code class=
"computeroutput"><span class=
"identifier">epsilon
</span></code> can
998 be synthesised from the others, so no explicit specialisation is required
999 provided the precision of RealType does not vary at runtime (see the header
1000 <a href=
"../../../../../boost/math/bindings/rr.hpp" target=
"_top">boost/math/bindings/rr.hpp
</a>
1001 for an example where the precision does vary at runtime).
1003 <li class=
"listitem">
1004 The functions
<code class=
"computeroutput"><span class=
"identifier">digits
</span></code>,
1005 <code class=
"computeroutput"><span class=
"identifier">max_value
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">min_value
</span></code>, all get synthesised automatically
1006 from
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">numeric_limits
</span></code>. However, if
<code class=
"computeroutput"><span class=
"identifier">numeric_limits
</span></code> is not specialised for
1007 type RealType, then you will get a compiler error when code tries to use
1008 these functions,
<span class=
"emphasis"><em>unless
</em></span> you explicitly specialise
1009 them. For example if the precision of RealType varies at runtime, then
1010 <code class=
"computeroutput"><span class=
"identifier">numeric_limits
</span></code> support
1011 may not be appropriate, see
<a href=
"../../../../../boost/math/bindings/rr.hpp" target=
"_top">boost/math/bindings/rr.hpp
</a>
1015 <div class=
"warning"><table border=
"0" summary=
"Warning">
1017 <td rowspan=
"2" align=
"center" valign=
"top" width=
"25"><img alt=
"[Warning]" src=
"../../../../../doc/src/images/warning.png"></td>
1018 <th align=
"left">Warning
</th>
1020 <tr><td align=
"left" valign=
"top">
1022 If
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">numeric_limits
</span><span class=
"special"><></span></code>
1023 is
<span class=
"bold"><strong>not specialized
</strong></span> for type
<span class=
"emphasis"><em>RealType
</em></span>
1024 then the default float precision of
6 decimal digits will be used by other
1025 Boost programs including:
1028 Boost.Test: giving misleading error messages like
1031 <span class=
"emphasis"><em>"difference between {9.79796} and {9.79796} exceeds 5.42101e-19%".
</em></span>
1034 Boost.LexicalCast and Boost.Serialization when converting the number to a
1035 string, causing potentially serious loss of accuracy on output.
1038 Although it might seem obvious that RealType should require
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">numeric_limits
</span></code>
1039 to be specialized, this is not sensible for
<code class=
"computeroutput"><span class=
"identifier">NTL
</span><span class=
"special">::
</span><span class=
"identifier">RR
</span></code> and
1040 similar classes where the
<span class=
"bold"><strong>number of digits is a runtime
1041 parameter
</strong></span> (whereas for
<code class=
"computeroutput"><span class=
"identifier">numeric_limits
</span></code>
1042 everything has to be fixed at compile time).
1047 <a name=
"math_toolkit.real_concepts.h1"></a>
1048 <span class=
"phrase"><a name=
"math_toolkit.real_concepts.standard_library_support_require"></a></span><a class=
"link" href=
"real_concepts.html#math_toolkit.real_concepts.standard_library_support_require">Standard
1049 Library Support Requirements
</a>
1052 Many (though not all) of the functions in this library make calls to standard
1053 library functions, the following table summarises the requirements. Note that
1054 most of the functions in this library will only call a small subset of the
1055 functions listed here, so if in doubt whether a user-defined type has enough
1056 standard library support to be useable the best advise is to try it and see!
1059 In the following table
<span class=
"emphasis"><em>r
</em></span> is an object of type
<code class=
"computeroutput"><span class=
"identifier">RealType
</span></code>,
<span class=
"emphasis"><em>cr1
</em></span> and
<span class=
"emphasis"><em>cr2
</em></span>
1060 are objects of type
<code class=
"computeroutput"><span class=
"keyword">const
</span> <span class=
"identifier">RealType
</span></code>,
1061 and
<span class=
"emphasis"><em>i
</em></span> is an object of type
<code class=
"computeroutput"><span class=
"keyword">int
</span></code>.
1063 <div class=
"informaltable"><table class=
"table">
1084 <code class=
"computeroutput"><span class=
"identifier">fabs
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1096 <code class=
"computeroutput"><span class=
"identifier">abs
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1108 <code class=
"computeroutput"><span class=
"identifier">ceil
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1120 <code class=
"computeroutput"><span class=
"identifier">floor
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1132 <code class=
"computeroutput"><span class=
"identifier">exp
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1144 <code class=
"computeroutput"><span class=
"identifier">pow
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">,
</span>
1145 <span class=
"identifier">cr2
</span><span class=
"special">)
</span></code>
1157 <code class=
"computeroutput"><span class=
"identifier">sqrt
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1169 <code class=
"computeroutput"><span class=
"identifier">log
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1181 <code class=
"computeroutput"><span class=
"identifier">frexp
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">,
</span>
1182 <span class=
"special">&</span><span class=
"identifier">i
</span><span class=
"special">)
</span></code>
1194 <code class=
"computeroutput"><span class=
"identifier">ldexp
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">,
</span>
1195 <span class=
"identifier">i
</span><span class=
"special">)
</span></code>
1207 <code class=
"computeroutput"><span class=
"identifier">cos
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1219 <code class=
"computeroutput"><span class=
"identifier">sin
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1231 <code class=
"computeroutput"><span class=
"identifier">asin
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1243 <code class=
"computeroutput"><span class=
"identifier">tan
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1255 <code class=
"computeroutput"><span class=
"identifier">atan
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1267 <code class=
"computeroutput"><span class=
"identifier">fmod
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1279 <code class=
"computeroutput"><span class=
"identifier">round
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1291 <code class=
"computeroutput"><span class=
"identifier">iround
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1303 <code class=
"computeroutput"><span class=
"identifier">trunc
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1315 <code class=
"computeroutput"><span class=
"identifier">itrunc
</span><span class=
"special">(
</span><span class=
"identifier">cr1
</span><span class=
"special">)
</span></code>
1327 Note that the table above lists only those standard library functions known
1328 to be used (or likely to be used in the near future) by this library. The following
1329 functions:
<code class=
"computeroutput"><span class=
"identifier">acos
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">atan2
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">fmod
</span></code>,
1330 <code class=
"computeroutput"><span class=
"identifier">cosh
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">sinh
</span></code>,
1331 <code class=
"computeroutput"><span class=
"identifier">tanh
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">log10
</span></code>,
1332 <code class=
"computeroutput"><span class=
"identifier">lround
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">llround
</span></code>,
1333 <code class=
"computeroutput"><span class=
"identifier">ltrunc
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">lltrunc
</span></code>
1334 and
<code class=
"computeroutput"><span class=
"identifier">modf
</span></code> are not currently
1335 used, but may be if further special functions are added.
1338 Note that the
<code class=
"computeroutput"><span class=
"identifier">round
</span></code>,
<code class=
"computeroutput"><span class=
"identifier">trunc
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">modf
</span></code>
1339 functions are not part of the current C++ standard: they are part of the additions
1340 added to C99 which will likely be in the next C++ standard. There are Boost
1341 versions of these provided as a backup, and the functions are always called
1342 unqualified so that argument-dependent-lookup can take place.
1345 In addition, for efficient and accurate results, a
<a class=
"link" href=
"lanczos.html" title=
"The Lanczos Approximation">Lanczos
1346 approximation
</a> is highly desirable. You may be able to adapt an existing
1347 approximation from
<a href=
"../../../../../boost/math/special_functions/lanczos.hpp" target=
"_top">boost/math/special_functions/lanczos.hpp
</a>
1348 or
<a href=
"../../../../../boost/math/bindings/detail/big_lanczos.hpp" target=
"_top">boost/math/bindings/detail/big_lanczos.hpp
</a>:
1349 in the former case you will need change
<code class=
"computeroutput"><span class=
"keyword">static_cast
</span></code>'s
1350 to
<code class=
"computeroutput"><span class=
"identifier">lexical_cast
</span></code>'s, and the
1351 constants to
<span class=
"emphasis"><em>strings
</em></span> (in order to ensure the coefficients
1352 aren't truncated to
<code class=
"computeroutput"><span class=
"keyword">long
</span> <span class=
"identifier">doubl
</span></code>e)
1353 and then specialise
<code class=
"computeroutput"><span class=
"identifier">lanczos_traits
</span></code>
1354 for type T. Otherwise you may have to hack
<a href=
"../../../tools/lanczos_generator.cpp" target=
"_top">libs/math/tools/lanczos_generator.cpp
</a>
1355 to find a suitable approximation for your RealType. The code will still compile
1356 if you don't do this, but both accuracy and efficiency will be greatly compromised
1357 in any function that makes use of the gamma/beta/erf family of functions.
1360 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
1361 <td align=
"left"></td>
1362 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
1363 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
1364 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
1365 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
1366 Distributed under the Boost Software License, Version
1.0. (See accompanying
1367 file LICENSE_1_0.txt or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
1372 <div class=
"spirit-nav">
1373 <a accesskey=
"p" href=
"high_precision/using_test.html"><img src=
"../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../using_udt.html"><img src=
"../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../index.html"><img src=
"../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"dist_concept.html"><img src=
"../../../../../doc/src/images/next.png" alt=
"Next"></a>