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 13:08:30 +0200
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.

On Sun, 25 Aug 2024, 04:52 Thiago Macieira via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> On Saturday 24 August 2024 11:28:06 GMT-7 Aaron Franke via Std-Proposals
> wrote:
> > Note that, specifically, `std::numbers::tau` is not a replacement for `2
> *
> > std::numbers::pi`, it is a replacement for `(2 * std::numbers::pi)` in
> > parenthesis. Strictly speaking, due to the order of operations, `radius
> * 2
> > * std::numbers::pi` results in the same behavior as `(radius * 2) *
> > std::numbers::pi`.
>
> But they are mathematically and computationally the same because, as I
> said.
> multiplications by 2 and other powers of 2 (including negative powers) are
> exact. The order of these operations does not change the precision of the
> result.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-08-25 11:08:47