|
Boost Users : |
Subject: Re: [Boost-users] Questions about Boost multiprecision library.
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-10-10 17:22:11
> *I have heard that there are some strange results that
> can happen if you are quizzing multiprecision for trigonometry
> and try to keep using the double type. Is this true,
> so that I can just kee relying on the std library instead?
>
Sorry don't understand the question.
> -What is the name of the 64 bit windows .dll, or .dll files,
> that are the ones for the multiprecision library?
>
There are none - it's header only.
> -If I wish to go into arbitrary precision and scale numbers,
> what is the type I should use for an *integer*? What is the
> #include statement I should use, and how do I specify
> the number of whole number points and decimal points,
> before starting my operations?
What kind of integer? Fixed precision or arbitrary precision?
Suggest you start with:
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::int1024_t; // fixed precision 1024-bit
integer, or:
using boost::multiprecision::cpp_int; // arbitrary precision integer
See
https://www.boost.org/doc/libs/1_66_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html
for other typedefs and examples.
>and how do I specify the number of whole number points and decimal
points,before starting my operations?
That question makes no sense for integer types.
>
> -If I wish to go into arbitrary precision and scale numbers,
> what is the type I should use for a *rational number*? What
> is the #include statement I should use, and how do I specify
> the number of whole number points and decimal points,
> before starting my operations?
If you want arbitrary precision then try:
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_rational; // arbitrary precision
rational
or:
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
using boost::multiprecision::int1024_t; // fixed precision 1024-bit
integer, or:
typedef boost::rational<int1024> rational_1024_t; // 1024 bit fixed
precision rational
As before your other questions make no sense for these types.
>
> -For these two types, I wish to do sine, cosine, tangent,
> arcsine, arccosine, arctangent, base 10 logarithm,
> base e logarithm, power, nth root. I also want
> to obtain pi, but also Euler's constant, to any number
> of significang figure or decimal places that I would like.
Really??? Eulers constant as an integer? I think you need to re-think
that question.
Best, John.
--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net