This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] tau support in math.h


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.

http://tauday.com/ for more details and examples on how to replace pi, and why
using pi is in the wrong paradigm.

Thanks,

-Adam Talsma

--- math.h 2013-01-27 23:35:53.377637077 -0800
+++ math.h.tau 2013-01-28 00:02:40.721703715 -0800
@@ -364,6 +364,7 @@
 # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
 # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
 # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+# define M_TAU 6.28318530717958647692 /* tau */
 #endif

 /* The above constants are not adequate for computation using `long double's.
@@ -383,6 +384,7 @@
 # define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
 # define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */
 # define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
+# define M_TAU 6.283185307179586476925286766559005768L /* tau */
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]