From ab8f915aa0a64e3b53104a830f0a878286c605e3 Mon Sep 17 00:00:00 2001 From: Julien Reichardt Date: Sat, 2 Jan 2021 17:46:00 +0100 Subject: [PATCH 1/2] Add Math::TAU --- src/math/math.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/math/math.cr b/src/math/math.cr index d56de5ce0ac7..a07c93866e24 100644 --- a/src/math/math.cr +++ b/src/math/math.cr @@ -3,7 +3,8 @@ require "./libm" module Math extend self - PI = 3.14159265358979323846 + PI = 3.14159265358979323846 + TAU = 6.283185307179586476925 E = LibM.exp_f64(1.0) LOG2 = LibM.log_f64(2.0) LOG10 = LibM.log_f64(10.0) From eb985bbef7a482beb83c3b75ce5089b949331dbf Mon Sep 17 00:00:00 2001 From: Julien Reichardt Date: Sat, 2 Jan 2021 20:44:33 +0100 Subject: [PATCH 2/2] Add doc comments to Math constants --- src/math/math.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/math/math.cr b/src/math/math.cr index a07c93866e24..49bcd91b353d 100644 --- a/src/math/math.cr +++ b/src/math/math.cr @@ -3,8 +3,11 @@ require "./libm" module Math extend self - PI = 3.14159265358979323846 - TAU = 6.283185307179586476925 + # Archimedes' constant (π). + PI = 3.14159265358979323846 + # The full circle constant (τ), equal to 2π. + TAU = 6.283185307179586476925 + # Euler's number (e). E = LibM.exp_f64(1.0) LOG2 = LibM.log_f64(2.0) LOG10 = LibM.log_f64(10.0)