On Mon, Jan 28, 2013 at 12:18:20AM -0800, Adam Talsma wrote:
> This patch adds tau as a macro in math.h. This should allow for efficiency
> improvements as higher level math functions will inevitably be refactored away
> from using 2pi.
What exact improvements it has over using 2 * M_PI ? Multiplication by two
just changes the exponent of the constant, not the mantissa (as M_PI is not
subnormal nor too large), so it is exactly as precise as this.
M_TAU isn't standardized (and, btw, you got your patch wrong, there was no l
suffix in the second snippet), you are free to define it in whatever project
you prefer to use a constant like that.
The M_* constants are conditional on [__USE_BSD || __USE_XOPEN], plus
[__USE_GNU] long double versions; nothing should be added that's not in
those standards. If a future version of POSIX adds a new M_* constant
(whether XSI-conditional or otherwise), then glibc would add it under
appropriate conditions for that version of POSIX (and, as needed, a long
double version under __USE_GNU), not in the existing block of values. I
don't believe it's appropriate to add new constants otherwise, especially
not when, as noted, they are trivially derived from other constants
already present with no loss of accuracy.