diff --git a/include/boost/math/big_number.hpp b/include/boost/math/big_number.hpp index 632c7b72..ab3fabe7 100644 --- a/include/boost/math/big_number.hpp +++ b/include/boost/math/big_number.hpp @@ -398,6 +398,14 @@ public: { return m_backend.compare(canonical_value(o)); } + Backend& backend() + { + return m_backend; + } + const Backend& backend()const + { + return m_backend; + } private: template void do_assign(const Exp& e, const proto::tag::unary_plus&) @@ -1160,6 +1168,47 @@ std::istream& operator >> (std::istream& is, big_number& r) return is; } +// +// Non-member functions accepting an expression-template as argument: +// +#undef sqrt +template +typename boost::math::detail::expression_type::type sqrt(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return sqrt(result_type(val)); +} +template +typename detail::expression_type::type abs(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return abs(result_type(val)); +} +template +typename detail::expression_type::type fabs(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return fabs(result_type(val)); +} +template +typename detail::expression_type::type ceil(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return ceil(result_type(val)); +} +template +typename detail::expression_type::type floor(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return floor(result_type(val)); +} +template +typename detail::expression_type::type trunc(const detail::big_number_exp& val) +{ + typedef typename detail::expression_type::type result_type; + return trunc(result_type(val)); +} + }} // namespaces #endif diff --git a/include/boost/math/big_number/gmp.hpp b/include/boost/math/big_number/gmp.hpp index a82674e5..374c7594 100644 --- a/include/boost/math/big_number/gmp.hpp +++ b/include/boost/math/big_number/gmp.hpp @@ -283,6 +283,8 @@ struct gmp_real_imp d = v; return compare(d); } + mpf_t& data() { return m_data; } + const mpf_t& data()const { return m_data; } protected: mpf_t m_data; }; @@ -366,6 +368,52 @@ private: } }; +// +// Native non-member operations: +// +template +big_number > sqrt(const big_number >& val) +{ + big_number > result; + mpf_sqrt(result.backend().data(), val.backend().data()); + return result; +} +template +big_number > abs(const big_number >& val) +{ + big_number > result; + mpf_abs(result.backend().data(), val.backend().data()); + return result; +} +template +big_number > fabs(const big_number >& val) +{ + big_number > result; + mpf_abs(result.backend().data(), val.backend().data()); + return result; +} +template +big_number > ceil(const big_number >& val) +{ + big_number > result; + mpf_ceil(result.backend().data(), val.backend().data()); + return result; +} +template +big_number > floor(const big_number >& val) +{ + big_number > result; + mpf_floor(result.backend().data(), val.backend().data()); + return result; +} +template +big_number > trunc(const big_number >& val) +{ + big_number > result; + mpf_trunc(result.backend().data(), val.backend().data()); + return result; +} + struct gmp_int { typedef mpl::list signed_types; diff --git a/math/Jamroot.jam b/math/Jamroot.jam new file mode 100644 index 00000000..c8019258 --- /dev/null +++ b/math/Jamroot.jam @@ -0,0 +1,9 @@ + +import modules ; + +local boost = [ modules.peek : BOOST ] ; + +project sandbox : requirements $(boost) ; + +# This seems to prevent some Boost.Build errors that otherwise occur :-( +use-project /boost : $(boost) ; diff --git a/math/boost-build.jam b/math/boost-build.jam new file mode 100644 index 00000000..02b750a1 --- /dev/null +++ b/math/boost-build.jam @@ -0,0 +1,72 @@ +# Copyright Rene Rivera 2007. +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# For instructions see Jamfile.v2, or "bjam --help". + +local rule if-has-file ( file + : dir * ) +{ + local result ; + if $(dir) + { + result = [ GLOB $(dir) : $(file) ] ; + } + return $(result[1]:P) ; +} + +#~ Attempts to find the Boost source tree... + +local boost-src = [ if-has-file LICENSE_1_0.txt : + [ MATCH --boost=(.*) : $(ARGV) ] + $(BOOST) + $(BOOST_ROOT) + $(.boost-build-file:D)/../boost + $(.boost-build-file:D)/../Trunk + ] ; + +# error handling: +if ! $(boost-src) +{ + ECHO Unable to find the Boost source tree in the locations searched. ; + ECHO Try setting the environment variable BOOST to point to your ; + ECHO Boost tree, or else invoke bjam with the --boost=path option. ; + ECHO The Boost include path will not be automatically set. ; + ECHO The paths searched were [ MATCH --boost=(.*) : $(ARGV) ] $(BOOST) $(.boost-build-file:D)/../boost $(.boost-build-file:D)/../Trunk ; + ECHO But the file LICENSE_1_0.txt was not found in any of them ; +} + +#~ Attempts to find the Boost.Build files... + +local boost-build-src = [ if-has-file bootstrap.jam : + [ MATCH --boost-build=(.*) : $(ARGV) ] + $(BOOST_BUILD_PATH) + $(BOOST_BUILD) + $(boost-src)/tools/build/v2 + ] ; + +# error handling: +if ! $(boost-build-src) +{ + ECHO Unable to find the Boost.Build source tree in the locations searched. ; + ECHO Try setting the environment variable BOOST_BUILD to point to your ; + ECHO Boost.Build tree, or else invoke bjam with the --boost-build=path option. ; + ECHO The paths searched were [ MATCH --boost-build=(.*) : $(ARGV) ] $(BOOST_BUILD_PATH) $(BOOST_BUILD) $(boost-src)/tools/build/v2 ; + ECHO But bootstrap.jam was not found in any of these ; + ECHO More failures will very likely follow... ; +} + +#~ Set some common vars to refer to the Boost sources... + +BOOST ?= $(boost-src) ; +BOOST_ROOT ?= $(boost-src) ; + +#~ And load up Boost.Build... + +boost-build $(boost-build-src) ; + + + + + diff --git a/math/doc/Jamfile.v2 b/math/doc/Jamfile.v2 new file mode 100644 index 00000000..2f00f026 --- /dev/null +++ b/math/doc/Jamfile.v2 @@ -0,0 +1,67 @@ + +# Copyright John Maddock 2011. Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +using quickbook ; + +path-constant images_location : html ; + +xml big_number : big_number.qbk ; +boostbook standalone + : + big_number + : + # Path for links to Boost: + #boost.root=../../../../.. + + # Some general style settings: + table.footnote.number.format=1 + footnote.number.format=1 + html.stylesheet=boostbook.css + + # HTML options first: + # Use graphics not text for navigation: + navig.graphics=1 + # How far down we chunk nested sections, basically all of them: + chunk.section.depth=10 + # Don't put the first section on the same page as the TOC: + chunk.first.sections=10 + # How far down sections get TOC's + toc.section.depth=10 + # Max depth in each TOC: + toc.max.depth=4 + # How far down we go with TOC's + #generate.section.toc.level=10 + # Index on type: + index.on.type=1 + + # PDF Options: + # TOC Generation: this is needed for FOP-0.9 and later: + fop1.extensions=0 + pdf:xep.extensions=1 + # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9! + pdf:fop.extensions=0 + pdf:fop1.extensions=0 + # No indent on body text: + pdf:body.start.indent=0pt + # Margin size: + pdf:page.margin.inner=0.5in + # Margin size: + pdf:page.margin.outer=0.5in + # Paper type = A4 + pdf:paper.type=A4 + # Yes, we want graphics for admonishments: + admon.graphics=1 + # Set this one for PDF generation *only*: + # default pnd graphics are awful in PDF form, + # better use SVG's instead: + pdf:admon.graphics.extension=".svg" + pdf:use.role.for.mediaobject=1 + pdf:preferred.mediaobject.role=print + pdf:img.src.path=$(images_location)/ + pdf:draft.mode="no" + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/math/doc/sf_and_dist/html + ; + +install pdf-install : standalone : . PDF ; diff --git a/math/doc/big_number.qbk b/math/doc/big_number.qbk new file mode 100644 index 00000000..4ccfb199 --- /dev/null +++ b/math/doc/big_number.qbk @@ -0,0 +1,207 @@ +[/ + Copyright 2011 John Maddock. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[library Boost.BigNumbers + [quickbook 1.5] + [copyright 2011 John Maddock] + [purpose Big Number library] + [license + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + [@http://www.boost.org/LICENSE_1_0.txt]) + ] + [authors [authors, various]] + [last-revision $Date: 2011-07-08 18:51:46 +0100 (Fri, 08 Jul 2011) $] +] + +[section:intro Introduction] + +The Big Number library comes in two distinct parts: an expression template enabled front end `big_number` +that handles all the operator overloading, expression evaluation optimization, and code reduction, and +a selection of backends that implement the actual arithmetic operations, and need conform only to the +reduced interface requirements of the front end. + +[endsect] + +[section:tut Tutorial] + +In order to use this library you need to make two choices: what kind of number do I want, and +which backend do I want to perform the actual arithmetic? + +[section:ints Integer Types] + +The following backends provide integer arithmetic: + +[table +[[Backend Type][Header][Radix][Dependencies][Pros][Cons]] +[[`gmp_int`][boost/math/big_number/gmp.hpp][2][GMP][Very fast and efficient backend.][Dependency on GNU licenced GMP library.]] +] + +[h4 gmp_int] + + namespace boost{ namespace math{ + + class gmp_int; + + typedef big_number mpz_int; + + }} // namespaces + +The `gmp_int` backend is used via the typedef `boost::math::mpz_int`. It acts as a thin wrapper around the GMP `mpz_t` +to provide an integer type that is a drop-in replacement for the native C++ integer types, but with unlimited precision. + +[h5 Example:] + + #include + + boost::math::mpz_int v = 1; + + // Do some arithmetic: + for(unsigned i = 1; i <= 1000; ++i) + v *= i; + + std::cout << i << std::endl; // prints 1000! + +[endsect] + +[section:reals Real Numbers] + +The following backends provide real number arithmetic: + +[table +[[Backend Type][Header][Radix][Dependencies][Pros][Cons]] +[[`gmp_real`][boost/math/big_number/gmp.hpp][2][GMP][Very fast and efficient backend.][Dependency on GNU licenced GMP library.]] +] + +[h4 gmp_real] + + namespace boost{ namespace math{ + + template + class gmp_real; + + typedef big_number > mpf_real_50; + typedef big_number > mpf_real_100; + typedef big_number > mpf_real_500; + typedef big_number > mpf_real_1000; + typedef big_number > mpf_real; + + }} // namespaces + +The `gmp_real` backend is used in conjunction with `big_number`: It acts as a thin wrapper around the GMP `mpf_t` +to provide an real-number type that is a drop-in replacement for the native C++ floating-point types, but with +much greater precision. + +Type `gmp_real` can be used at fixed precision by specifying a non-zero `Digits10` template parameter, or +at variable precision by setting the template argument to zero. The typedefs mpf_real_50, mpf_real_100, +mpf_real_500, mpf_real_1000 provide arithmetic types at 50, 100, 500 and 1000 decimal digits precision +respectively. The typedef mpf_real provides a variable precision type whose precision can be controlled via the +`big_number`'s member functions. + +[h5 example:] + + #include + + boost::math::gmp_real a = 2; + boost::math::gmp_real::default_precision(1000); + std::cout << boost::math::gmp_real::default_precision() << std::endl; + std::cout << sqrt(a) << std::endl; // print root-2 + +[endsect] + +[endsect] + +[section:ref Reference] + +[section:bignum big_number] + +[h4 Synopsis] + + namespace boost{ namespace math{ + + template + class big_number + { + big_number(); + big_number(see-below); + big_number& operator=(see-below); + /* Other number-type operators here */ + // string conversion: + std::string str()const; + // precision control: + static unsigned default_precision(); + static void default_precision(unsigned digits10); + unsigned precision()const; + void precision(unsigned digits10); + // Comparison: + int compare(const big_number& o)const; + template + typename enable_if, int>::type compare(const V& o)const; + }; + + }} // namespaces + +[h4 Description] + + big_number(); + big_number(see-below); + big_number& operator=(see-below); + +Type `big_number` is default constructible, and copy both constructible and assignable from: + +* Itself. +* An expression template which is the result of one of the arithmetic operators. +* Any builtin arithmetic type. +* A `std::string` or any type which is convertible to `const char*`. + + /* Other number-type operators here */ + +The following arithmetic operations are support for real-numbered types: + +* Binary +, -, *, /, +=, -=, *=, /=, ==, !=, <=, >=, <, >. +* Unary +, -. + +For integer types the following operators are also supported: + +Binary %, %=. + +(More to follow!!) + +Note that the result of the binary +, -, *, / and % operations is an expression template of "unmentionable type". + + std::string str()const; + +Returns the number formatted as a string (TODO: enable custom precision). + + static unsigned default_precision(); + static void default_precision(unsigned digits10); + unsigned precision()const; + void precision(unsigned digits10); + +These functions are only available if the Backend template parameter supports runtime changes to precision. They get and set +the default precision and the precision of *this respectively. + + int compare(const big_number& o)const; + template + typename enable_if, int>::type compare(const V& other)const; + +Returns: + +* A value less that 0 for *this < other +* A value greater that 0 for *this > other +* Zero for *this == other + +[endsect] + +[section:backendconc Backend Requirements] + +TODO, big boring job!! + +[endsect] + +[endsect] + diff --git a/math/doc/html/boost_bignumbers/intro.html b/math/doc/html/boost_bignumbers/intro.html new file mode 100644 index 00000000..ee77f4b1 --- /dev/null +++ b/math/doc/html/boost_bignumbers/intro.html @@ -0,0 +1,44 @@ + + + +Introduction + + + + + + + + +
+
+
+PrevUpHomeNext +
+
+ +

+ The Big Number library comes in two distinct parts: an expression template + enabled front end big_number + that handles all the operator overloading, expression evaluation optimization, + and code reduction, and a selection of backends that implement the actual arithmetic + operations, and need conform only to the reduced interface requirements of + the front end. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boost_bignumbers/ref.html b/math/doc/html/boost_bignumbers/ref.html new file mode 100644 index 00000000..c6a81e2f --- /dev/null +++ b/math/doc/html/boost_bignumbers/ref.html @@ -0,0 +1,40 @@ + + + +Reference + + + + + + + + +
+
+
+PrevUpHomeNext +
+ + + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boost_bignumbers/ref/backendconc.html b/math/doc/html/boost_bignumbers/ref/backendconc.html new file mode 100644 index 00000000..44dd13af --- /dev/null +++ b/math/doc/html/boost_bignumbers/ref/backendconc.html @@ -0,0 +1,38 @@ + + + +Backend Requirements + + + + + + + +
+
+
+PrevUpHome +
+
+ +

+ TODO, big boring job!! +

+
+ + + +
+
+
+PrevUpHome +
+ + diff --git a/math/doc/html/boost_bignumbers/ref/bignum.html b/math/doc/html/boost_bignumbers/ref/bignum.html new file mode 100644 index 00000000..bcf3ef57 --- /dev/null +++ b/math/doc/html/boost_bignumbers/ref/bignum.html @@ -0,0 +1,151 @@ + + + +big_number + + + + + + + + +
+
+
+PrevUpHomeNext +
+
+ +
+ + Synopsis +
+
namespace boost{ namespace math{
+
+template <class Backend>
+class big_number
+{
+   big_number();
+   big_number(see-below);
+   big_number& operator=(see-below);
+   /* Other number-type operators here */
+   // string conversion:
+   std::string str()const;
+   // precision control:
+   static unsigned default_precision();
+   static void default_precision(unsigned digits10);
+   unsigned precision()const;
+   void precision(unsigned digits10);
+   // Comparison:
+   int compare(const big_number<Backend>& o)const;
+   template <class V>
+   typename enable_if<is_arithmetic<V>, int>::type compare(const V& o)const;
+};
+
+}} // namespaces
+
+
+ + Description +
+
big_number();
+big_number(see-below);
+big_number& operator=(see-below);
+
+

+ Type big_number is default + constructible, and copy both constructible and assignable from: +

+
    +
  • + Itself. +
  • +
  • + An expression template which is the result of one of the arithmetic operators. +
  • +
  • + Any builtin arithmetic type. +
  • +
  • + A std::string or any type which is convertible + to const char*. +
  • +
+
/* Other number-type operators here */
+
+

+ The following arithmetic operations are support for real-numbered types: +

+
    +
  • + Binary +, -, *, /, +, -, *, /, + ==, !, <, >=, <, >. +
  • +
  • + Unary +, -. +
  • +
+

+ For integer types the following operators are also supported: +

+

+ Binary %, %=. +

+

+ (More to follow!!) +

+

+ Note that the result of the binary +, -, *, / and % operations is an expression + template of "unmentionable type". +

+
std::string str()const;
+
+

+ Returns the number formatted as a string (TODO: enable custom precision). +

+
static unsigned default_precision();
+static void default_precision(unsigned digits10);
+unsigned precision()const;
+void precision(unsigned digits10);
+
+

+ These functions are only available if the Backend template parameter supports + runtime changes to precision. They get and set the default precision and + the precision of *this respectively. +

+
int compare(const big_number<Backend>& o)const;
+template <class V>
+typename enable_if<is_arithmetic<V>, int>::type compare(const V& other)const;
+
+

+ Returns: +

+
    +
  • + A value less that 0 for *this < other +
  • +
  • + A value greater that 0 for *this > other +
  • +
  • + Zero for *this == other +
  • +
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boost_bignumbers/tut.html b/math/doc/html/boost_bignumbers/tut.html new file mode 100644 index 00000000..92e58b08 --- /dev/null +++ b/math/doc/html/boost_bignumbers/tut.html @@ -0,0 +1,44 @@ + + + +Tutorial + + + + + + + + +
+
+
+PrevUpHomeNext +
+
+ + +

+ In order to use this library you need to make two choices: what kind of number + do I want, and which backend do I want to perform the actual arithmetic? +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boost_bignumbers/tut/ints.html b/math/doc/html/boost_bignumbers/tut/ints.html new file mode 100644 index 00000000..b2dbce57 --- /dev/null +++ b/math/doc/html/boost_bignumbers/tut/ints.html @@ -0,0 +1,146 @@ + + + +Integer Types + + + + + + + + +
+
+
+PrevUpHomeNext +
+
+ +

+ The following backends provide integer arithmetic: +

+
++++++++ + + + + + + + + + + + + + + + + +
+

+ Backend Type +

+
+

+ Header +

+
+

+ Radix +

+
+

+ Dependencies +

+
+

+ Pros +

+
+

+ Cons +

+
+

+ gmp_int +

+
+

+ boost/math/big_number/gmp.hpp +

+
+

+ 2 +

+
+

+ GMP +

+
+

+ Very fast and efficient backend. +

+
+

+ Dependency on GNU licenced GMP library. +

+
+
+ + gmp_int +
+
namespace boost{ namespace math{
+
+class gmp_int;
+
+typedef big_number<gmp_int >         mpz_int;
+
+}} // namespaces
+
+

+ The gmp_int backend is used + via the typedef boost::math::mpz_int. It acts as a thin wrapper around + the GMP mpz_t to provide + an integer type that is a drop-in replacement for the native C++ integer + types, but with unlimited precision. +

+
+ + Example: +
+
#include <boost/math/big_number/gmp.hpp>
+
+boost::math::mpz_int v = 1;
+
+// Do some arithmetic:
+for(unsigned i = 1; i <= 1000; ++i)
+   v *= i;
+
+std::cout << i << std::endl; // prints 1000!
+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boost_bignumbers/tut/reals.html b/math/doc/html/boost_bignumbers/tut/reals.html new file mode 100644 index 00000000..cd08e445 --- /dev/null +++ b/math/doc/html/boost_bignumbers/tut/reals.html @@ -0,0 +1,158 @@ + + + +Real Numbers + + + + + + + + +
+
+
+PrevUpHomeNext +
+
+ +

+ The following backends provide real number arithmetic: +

+
++++++++ + + + + + + + + + + + + + + + + +
+

+ Backend Type +

+
+

+ Header +

+
+

+ Radix +

+
+

+ Dependencies +

+
+

+ Pros +

+
+

+ Cons +

+
+

+ gmp_real<N> +

+
+

+ boost/math/big_number/gmp.hpp +

+
+

+ 2 +

+
+

+ GMP +

+
+

+ Very fast and efficient backend. +

+
+

+ Dependency on GNU licenced GMP library. +

+
+
+ + gmp_real +
+
namespace boost{ namespace math{
+
+template <unsigned Digits10>
+class gmp_real;
+
+typedef big_number<gmp_real<50> >    mpf_real_50;
+typedef big_number<gmp_real<100> >   mpf_real_100;
+typedef big_number<gmp_real<500> >   mpf_real_500;
+typedef big_number<gmp_real<1000> >  mpf_real_1000;
+typedef big_number<gmp_real<0> >     mpf_real;
+
+}} // namespaces
+
+

+ The gmp_real backend is used + in conjunction with big_number: + It acts as a thin wrapper around the GMP mpf_t + to provide an real-number type that is a drop-in replacement for the native + C++ floating-point types, but with much greater precision. +

+

+ Type gmp_real can be used + at fixed precision by specifying a non-zero Digits10 + template parameter, or at variable precision by setting the template argument + to zero. The typedefs mpf_real_50, mpf_real_100, mpf_real_500, mpf_real_1000 + provide arithmetic types at 50, 100, 500 and 1000 decimal digits precision + respectively. The typedef mpf_real provides a variable precision type whose + precision can be controlled via the big_number's + member functions. +

+
+ + example: +
+
#include <boost/math/big_number/gmp.hpp>
+
+boost::math::gmp_real a = 2;
+boost::math::gmp_real::default_precision(1000);
+std::cout << boost::math::gmp_real::default_precision() << std::endl;
+std::cout << sqrt(a) << std::endl; // print root-2
+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/math/doc/html/boostbook.css b/math/doc/html/boostbook.css new file mode 100644 index 00000000..252fa9ec --- /dev/null +++ b/math/doc/html/boostbook.css @@ -0,0 +1,588 @@ +/*============================================================================= + Copyright (c) 2004 Joel de Guzman + http://spirit.sourceforge.net/ + + Distributed under the Boost Software License, Version 1.0. (See accompany- + ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +/*============================================================================= + Body defaults +=============================================================================*/ + + body + { + margin: 1em; + font-family: sans-serif; + } + +/*============================================================================= + Paragraphs +=============================================================================*/ + + p + { + text-align: left; + font-size: 10pt; + line-height: 1.15; + } + +/*============================================================================= + Program listings +=============================================================================*/ + + /* Code on paragraphs */ + p tt.computeroutput + { + font-size: 9pt; + } + + pre.synopsis + { + font-size: 90%; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + .programlisting, + .screen + { + font-size: 9pt; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + /* Program listings in tables don't get borders */ + td .programlisting, + td .screen + { + margin: 0pc 0pc 0pc 0pc; + padding: 0pc 0pc 0pc 0pc; + } + +/*============================================================================= + Headings +=============================================================================*/ + + h1, h2, h3, h4, h5, h6 + { + text-align: left; + margin: 1em 0em 0.5em 0em; + font-weight: bold; + } + + h1 { font: 140% } + h2 { font: bold 140% } + h3 { font: bold 130% } + h4 { font: bold 120% } + h5 { font: italic 110% } + h6 { font: italic 100% } + + /* Top page titles */ + title, + h1.title, + h2.title + h3.title, + h4.title, + h5.title, + h6.title, + .refentrytitle + { + font-weight: bold; + margin-bottom: 1pc; + } + + h1.title { font-size: 140% } + h2.title { font-size: 140% } + h3.title { font-size: 130% } + h4.title { font-size: 120% } + h5.title { font-size: 110% } + h6.title { font-size: 100% } + + .section h1 + { + margin: 0em 0em 0.5em 0em; + font-size: 140%; + } + + .section h2 { font-size: 140% } + .section h3 { font-size: 130% } + .section h4 { font-size: 120% } + .section h5 { font-size: 110% } + .section h6 { font-size: 100% } + + /* Code on titles */ + h1 tt.computeroutput { font-size: 140% } + h2 tt.computeroutput { font-size: 140% } + h3 tt.computeroutput { font-size: 130% } + h4 tt.computeroutput { font-size: 120% } + h5 tt.computeroutput { font-size: 110% } + h6 tt.computeroutput { font-size: 100% } + +/*============================================================================= + Author +=============================================================================*/ + + h3.author + { + font-size: 100% + } + +/*============================================================================= + Lists +=============================================================================*/ + + li + { + font-size: 10pt; + line-height: 1.3; + } + + /* Unordered lists */ + ul + { + text-align: left; + } + + /* Ordered lists */ + ol + { + text-align: left; + } + +/*============================================================================= + Links +=============================================================================*/ + + a + { + text-decoration: none; /* no underline */ + } + + a:hover + { + text-decoration: underline; + } + +/*============================================================================= + Spirit style navigation +=============================================================================*/ + + .spirit-nav + { + text-align: right; + } + + .spirit-nav a + { + color: white; + padding-left: 0.5em; + } + + .spirit-nav img + { + border-width: 0px; + } + +/*============================================================================= + Copyright footer +=============================================================================*/ + .copyright-footer + { + text-align: right; + font-size: 70%; + } + + .copyright-footer p + { + text-align: right; + font-size: 80%; + } + +/*============================================================================= + Table of contents +=============================================================================*/ + + .toc + { + margin: 1pc 4% 0pc 4%; + padding: 0.1pc 1pc 0.1pc 1pc; + font-size: 80%; + line-height: 1.15; + } + + .boost-toc + { + float: right; + padding: 0.5pc; + } + +/*============================================================================= + Tables +=============================================================================*/ + + .table-title, + div.table p.title + { + margin-left: 4%; + padding-right: 0.5em; + padding-left: 0.5em; + } + + .informaltable table, + .table table + { + width: 92%; + margin-left: 4%; + margin-right: 4%; + } + + div.informaltable table, + div.table table + { + padding: 4px; + } + + /* Table Cells */ + div.informaltable table tr td, + div.table table tr td + { + padding: 0.5em; + text-align: left; + font-size: 9pt; + } + + div.informaltable table tr th, + div.table table tr th + { + padding: 0.5em 0.5em 0.5em 0.5em; + border: 1pt solid white; + font-size: 80%; + } + + table.simplelist + { + width: auto !important; + margin: 0em !important; + padding: 0em !important; + border: none !important; + } + table.simplelist td + { + margin: 0em !important; + padding: 0em !important; + text-align: left !important; + font-size: 9pt !important; + border: none !important; + } + +/*============================================================================= + Blurbs +=============================================================================*/ + + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + font-size: 9pt; /* A little bit smaller than the main text */ + line-height: 1.2; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + p.blurb img + { + padding: 1pt; + } + +/*============================================================================= + Variable Lists +=============================================================================*/ + + /* Make the terms in definition lists bold */ + div.variablelist dl dt, + span.term + { + font-weight: bold; + font-size: 10pt; + } + + div.variablelist table tbody tr td + { + text-align: left; + vertical-align: top; + padding: 0em 2em 0em 0em; + font-size: 10pt; + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + + div.variablelist dl dt + { + margin-bottom: 0.2em; + } + + div.variablelist dl dd + { + margin: 0em 0em 0.5em 2em; + font-size: 10pt; + } + + div.variablelist table tbody tr td p, + div.variablelist dl dd p + { + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + +/*============================================================================= + Misc +=============================================================================*/ + + /* Title of books and articles in bibliographies */ + span.title + { + font-style: italic; + } + + span.underline + { + text-decoration: underline; + } + + span.strikethrough + { + text-decoration: line-through; + } + + /* Copyright, Legal Notice */ + div div.legalnotice p + { + text-align: left + } + +/*============================================================================= + Colors +=============================================================================*/ + + @media screen + { + body { + background-color: #FFFFFF; + } + + /* Links */ + a + { + color: #005a9c; + } + + a:visited + { + color: #9c5a9c; + } + + h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, + h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, + h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited + { + text-decoration: none; /* no underline */ + color: #000000; + } + + /* Syntax Highlighting */ + .keyword { color: #0000AA; } + .identifier { color: #000000; } + .special { color: #707070; } + .preprocessor { color: #402080; } + .char { color: teal; } + .comment { color: #800000; } + .string { color: teal; } + .number { color: teal; } + .white_bkd { background-color: #FFFFFF; } + .dk_grey_bkd { background-color: #999999; } + + /* Copyright, Legal Notice */ + .copyright + { + color: #666666; + font-size: small; + } + + div div.legalnotice p + { + color: #666666; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid #DCDCDC; + } + + .programlisting, + .screen + { + border: 1px solid #DCDCDC; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Blurbs */ + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + border: 1px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid #DCDCDC; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid #DCDCDC; + } + + div.informaltable table tr th, + div.table table tr th + { + background-color: #F0F0F0; + border: 1px solid #DCDCDC; + } + + .copyright-footer + { + color: #8F8F8F; + } + + /* Misc */ + span.highlight + { + color: #00A000; + } + } + + @media print + { + /* Links */ + a + { + color: black; + } + + a:visited + { + color: black; + } + + .spirit-nav + { + display: none; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid gray; + } + + .programlisting, + .screen + { + border: 1px solid gray; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid gray; + } + + .informaltable table, + .table table + { + border: 1px solid gray; + border-collapse: collapse; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid gray; + } + + div.informaltable table tr th, + div.table table tr th + { + border: 1px solid gray; + } + + table.simplelist tr td + { + border: none !important; + } + + /* Misc */ + span.highlight + { + font-weight: bold; + } + } + +/*============================================================================= + Images +=============================================================================*/ + + span.inlinemediaobject img + { + vertical-align: middle; + } + +/*============================================================================== + Super and Subscript: style so that line spacing isn't effected, see + http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341 +==============================================================================*/ + +sup, +sub { + height: 0; + line-height: 1; + vertical-align: baseline; + _vertical-align: bottom; + position: relative; + +} + +sup { + bottom: 1ex; +} + +sub { + top: .5ex; +} + diff --git a/math/doc/html/images/blank.png b/math/doc/html/images/blank.png new file mode 100644 index 00000000..764bf4f0 Binary files /dev/null and b/math/doc/html/images/blank.png differ diff --git a/math/doc/html/images/caution.png b/math/doc/html/images/caution.png new file mode 100644 index 00000000..5b7809ca Binary files /dev/null and b/math/doc/html/images/caution.png differ diff --git a/math/doc/html/images/caution.svg b/math/doc/html/images/caution.svg new file mode 100644 index 00000000..4bd586a0 --- /dev/null +++ b/math/doc/html/images/caution.svg @@ -0,0 +1,68 @@ + + + + + + Attenzione + + + + pulsante + + + + + Open Clip Art Library + + + + + Architetto Francesco Rollandin + + + + + Architetto Francesco Rollandin + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/math/doc/html/images/draft.png b/math/doc/html/images/draft.png new file mode 100644 index 00000000..0084708c Binary files /dev/null and b/math/doc/html/images/draft.png differ diff --git a/math/doc/html/images/home.png b/math/doc/html/images/home.png new file mode 100644 index 00000000..5584aacb Binary files /dev/null and b/math/doc/html/images/home.png differ diff --git a/math/doc/html/images/home.svg b/math/doc/html/images/home.svg new file mode 100644 index 00000000..e803a317 --- /dev/null +++ b/math/doc/html/images/home.svg @@ -0,0 +1,26 @@ + + + + + + + + +]> + + + + + + + + + + + + + + diff --git a/math/doc/html/images/important.png b/math/doc/html/images/important.png new file mode 100644 index 00000000..12c90f60 Binary files /dev/null and b/math/doc/html/images/important.png differ diff --git a/math/doc/html/images/important.svg b/math/doc/html/images/important.svg new file mode 100644 index 00000000..dd84f3fe --- /dev/null +++ b/math/doc/html/images/important.svg @@ -0,0 +1,25 @@ + + + + + + + + +]> + + + + + + + + + + + + + + + diff --git a/math/doc/html/images/next.png b/math/doc/html/images/next.png new file mode 100644 index 00000000..59800b4e Binary files /dev/null and b/math/doc/html/images/next.png differ diff --git a/math/doc/html/images/next.svg b/math/doc/html/images/next.svg new file mode 100644 index 00000000..75fa83ed --- /dev/null +++ b/math/doc/html/images/next.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/math/doc/html/images/next_disabled.png b/math/doc/html/images/next_disabled.png new file mode 100644 index 00000000..10a8c59d Binary files /dev/null and b/math/doc/html/images/next_disabled.png differ diff --git a/math/doc/html/images/note.png b/math/doc/html/images/note.png new file mode 100644 index 00000000..d0c3c645 Binary files /dev/null and b/math/doc/html/images/note.png differ diff --git a/math/doc/html/images/note.svg b/math/doc/html/images/note.svg new file mode 100644 index 00000000..648299d2 --- /dev/null +++ b/math/doc/html/images/note.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + diff --git a/math/doc/html/images/prev.png b/math/doc/html/images/prev.png new file mode 100644 index 00000000..d88a40f9 Binary files /dev/null and b/math/doc/html/images/prev.png differ diff --git a/math/doc/html/images/prev.svg b/math/doc/html/images/prev.svg new file mode 100644 index 00000000..6d88ffdd --- /dev/null +++ b/math/doc/html/images/prev.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/math/doc/html/images/prev_disabled.png b/math/doc/html/images/prev_disabled.png new file mode 100644 index 00000000..ab3c17e0 Binary files /dev/null and b/math/doc/html/images/prev_disabled.png differ diff --git a/math/doc/html/images/tip.png b/math/doc/html/images/tip.png new file mode 100644 index 00000000..5c4aab3b Binary files /dev/null and b/math/doc/html/images/tip.png differ diff --git a/math/doc/html/images/tip.svg b/math/doc/html/images/tip.svg new file mode 100644 index 00000000..cd437a5e --- /dev/null +++ b/math/doc/html/images/tip.svg @@ -0,0 +1,84 @@ + + + + + + lamp + + + + office + + lamp + + + + + Open Clip Art Library + + + + + Sergio Luiz Araujo Silva + + + + + Public Domain + + + set 2005 + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/math/doc/html/images/toc-blank.png b/math/doc/html/images/toc-blank.png new file mode 100644 index 00000000..6ffad17a Binary files /dev/null and b/math/doc/html/images/toc-blank.png differ diff --git a/math/doc/html/images/toc-minus.png b/math/doc/html/images/toc-minus.png new file mode 100644 index 00000000..abbb020c Binary files /dev/null and b/math/doc/html/images/toc-minus.png differ diff --git a/math/doc/html/images/toc-plus.png b/math/doc/html/images/toc-plus.png new file mode 100644 index 00000000..941312ce Binary files /dev/null and b/math/doc/html/images/toc-plus.png differ diff --git a/math/doc/html/images/up.png b/math/doc/html/images/up.png new file mode 100644 index 00000000..17d9c3ec Binary files /dev/null and b/math/doc/html/images/up.png differ diff --git a/math/doc/html/images/up.svg b/math/doc/html/images/up.svg new file mode 100644 index 00000000..d31aa9c8 --- /dev/null +++ b/math/doc/html/images/up.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/math/doc/html/images/up_disabled.png b/math/doc/html/images/up_disabled.png new file mode 100644 index 00000000..e22bc871 Binary files /dev/null and b/math/doc/html/images/up_disabled.png differ diff --git a/math/doc/html/images/warning.png b/math/doc/html/images/warning.png new file mode 100644 index 00000000..1c33db8f Binary files /dev/null and b/math/doc/html/images/warning.png differ diff --git a/math/doc/html/images/warning.svg b/math/doc/html/images/warning.svg new file mode 100644 index 00000000..fc8d7484 --- /dev/null +++ b/math/doc/html/images/warning.svg @@ -0,0 +1,23 @@ + + + + + + + + +]> + + + + + + + + + + + + + diff --git a/math/doc/html/index.html b/math/doc/html/index.html new file mode 100644 index 00000000..c9d159d1 --- /dev/null +++ b/math/doc/html/index.html @@ -0,0 +1,53 @@ + + + +Chapter 1. Boost.BigNumbers + + + + + + +
+
+
Next
+
+
+

+Chapter 1. Boost.BigNumbers

+

+various authors +

+
+
+

+ Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +

+
+
+ +
+ + + +

Last revised: July 08, 2011 at 18:51:46 +0100

+
+
Next
+ + diff --git a/math/test/test_arithmetic.cpp b/math/test/test_arithmetic.cpp index 1109c3d3..421df04a 100644 --- a/math/test/test_arithmetic.cpp +++ b/math/test/test_arithmetic.cpp @@ -60,6 +60,25 @@ void test_integer_ops(const boost::mpl::true_&) BOOST_TEST(a == -20 % -7); } +template +void test_real_ops(const boost::mpl::false_&){} + +template +void test_real_ops(const boost::mpl::true_&) +{ + std::cout << "Root2 = " << sqrt(Real(2)) << std::endl; + BOOST_TEST(abs(Real(2)) == 2); + BOOST_TEST(abs(Real(-2)) == 2); + BOOST_TEST(fabs(Real(2)) == 2); + BOOST_TEST(fabs(Real(-2)) == 2); + BOOST_TEST(floor(Real(5) / 2) == 2); + BOOST_TEST(ceil(Real(5) / 2) == 3); + BOOST_TEST(floor(Real(-5) / 2) == -3); + BOOST_TEST(ceil(Real(-5) / 2) == -2); + BOOST_TEST(trunc(Real(5) / 2) == 2); + BOOST_TEST(trunc(Real(-5) / 2) == -2); +} + template void test_negative_mixed(boost::mpl::true_ const&) { @@ -209,6 +228,10 @@ void test() // test_integer_ops(boost::math::is_extended_integer()); // + // Real number only functions: + // + test_real_ops(boost::mpl::bool_::value >()); + // // Test basic arithmetic: // Real a(8);