Boost logo

Boost Users :

Subject: Re: [Boost-users] Questions about Boost.Multiprecision..
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-12-20 17:41:31


On 20/12/2018 02:08, A Z via Boost-users wrote:
> I want to be performing some algebraic functions
> work on
>
> |cpp_rational|
>
>
> which I will be using templates with the following type
> to configure precision (and scale?)
>
> |#include <boost/multiprecision/cpp_int.hpp>|
>
>
> in order to avoid the use of floating point types.
>
> --What is the #include statement for cpp_rational?  I can't manage
> to find it.

It's right at the top of
https://www.boost.org/doc/libs/1_69_0/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/cpp_rational.html

It's all in

#include <boost/multiprecision/cpp_int.hpp>

>
> -When using non-floating point, is there a method to obtain
> a variable precision pi, or do I have to use

We've been through this before - cpp_rational is an *exact* type, it
absolutely does not do irrational numbers, much less transcendental
ones.  The clue is in the name.

If you need pi, then you need floating point.

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