commit 37fb2f54134ea73af4b3e54edcfc66a1fcc1cd2e
parent 23304dac06dd28ee4a6c277b7839cbb42aaed174
Author: ubq323 <ubq323@ubq323.website>
Date: Thu, 21 Mar 2024 23:59:26 +0000
math: add TAU constant
TAU = 2*PI ≈ 6.28. Tau is more convenient than pi in many situations.
For precedent, tau is present in the standard libraries of
Java, .NET, Python, and Rust, among others.
Signed-off-by: ubq323 <ubq323@ubq323.website>
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/math/math.ha b/math/math.ha
@@ -108,6 +108,8 @@ export fn isclose(x: types::floating, y: types::floating) bool = {
export def E: f64 = 2.71828182845904523536028747135266249775724709369995957496696763;
// pi - https://oeis.org/A000796
export def PI: f64 = 3.14159265358979323846264338327950288419716939937510582097494459;
+// tau - https://oeis.org/A019692
+export def TAU: f64 = 6.2831853071795864769252867665590057683943387987502116419498892;
// phi - https://oeis.org/A001622
export def PHI: f64 = 1.61803398874989484820458683436563811772030917980576286213544862;
// sqrt(2) - https://oeis.org/A002193