C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal to add the circle constant "tau"

From: Mike Reed <mike_at_[hidden]>
Date: Sun, 25 Aug 2024 21:57:48 +0200
C++, I believe, does not mandate IEEE 754, and so, yes, I was specifically
thinking in decimal, hence the precise wording of my post (...if my
architecture...). I fully understand your point though.

On Sun, 25 Aug 2024, 13:10 Andrey Semashev via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> On 8/25/24 14:08, Mike Reed via Std-Proposals wrote:
> > Isn't it possible for a literal constant for tau to be more accurate
> > than 2x a literal constant for pi? E.g if my architecture is only
> > accurate to 1dp then the literal for pi is 3.1, and 2x that is 6.2. But
> > the literal constant for tau would be 6.3, which is more accurate.
>
> You're thinking in decimal. IEEE-754 binary floating point types
> representation, which is used practically by every C++ implementation,
> uses powers of two for its digit places. That is, the significand is
> represented by a binary mantissa, and the point placement within that
> mantissa is described by exponent. Multiplying or dividing the number by
> a power of two leaves the mantissa unchanged and only changes the
> exponent. This means that the precision of the number remains the same.
> At least, that's how an implementation is expected to behave.
>
> https://en.wikipedia.org/wiki/IEEE_754
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-08-25 19:58:00