|
Boost : |
Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2017-10-09 09:58:21
> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of degski via Boost
> Sent: 08 October 2017 13:14
> To: boost
> Cc: degski
> Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
>
> On 28 September 2017 at 14:31, Paul A. Bristow via Boost <
> boost_at_[hidden]> wrote:
>
> > Boost has the floating-point constant phi
> >
> > http://www.boost.org/doc/libs/1_65_1/libs/math/doc/html/
> > math_toolkit/constants.html
> >
>
> Expressed as a ratio:
>
> // The Golden Ratio, the ratio of the 2 largest consecutive Fibonacci
> numbers
> // representable in std::intmax_t...
>
> #ifdef _WIN64
> using golden_ratio = std::ratio<7540113804746346429, 4660046610375530309>;
> #else
> using golden_ratio = std::ratio<1836311903, 1134903170>;
> #endif
>
> Which makes the definition of the Golden Ratio independent of the
> underlying (system defined) representation of reals, but the best possible.
Boost.Math constants also all provide the best possible representation of reals,
but do it
* portably over all platforms known to Boost,
* at compile time,
* constexpr,
* and for all Boost.Multiprecision Real types from float up to thousands or decimal digits.
But all this is massive overkill when people are uncertain whether 1.5 or 2 is best?
When computing a change in capacity I would have thought something integral-ish like 2 or 3/2 would be an advantage?
Paul
--- Paul A. Bristow Prizet Farmhouse Kendal UK LA8 8AB +44 (0) 1539 561830
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk