From f1f9ffd83129e0fdfd779b03b22f55c2419bce4f Mon Sep 17 00:00:00 2001 From: Brian Rodriguez Date: Thu, 28 Jan 2021 21:06:28 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Add=20the=20golden=20ratio=20=CF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Math.js | 2 ++ src/Math.purs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/Math.js b/src/Math.js index b8a35e9..7c904c2 100644 --- a/src/Math.js +++ b/src/Math.js @@ -98,6 +98,8 @@ exports.pi = Math.PI; exports.tau = 2 * Math.PI; +exports.phi = (1 + Math.sqrt(5)) / 2; + exports.sqrt1_2 = Math.SQRT1_2; exports.sqrt2 = Math.SQRT2; diff --git a/src/Math.purs b/src/Math.purs index 00b36f3..19c8781 100644 --- a/src/Math.purs +++ b/src/Math.purs @@ -93,6 +93,10 @@ foreign import pi :: Number -- | The ratio of the circumference of a circle to its radius, around 6.283185. foreign import tau :: Number +-- | The golden ratio, *φ*, around 1.61803. Two quantities `a` and `b` are said +-- | to be in the *golden ratio φ* if `(a + b) / a = a / b = φ`. +foreign import phi :: Number + -- | The Square root of one half, around 0.707107. foreign import sqrt1_2 :: Number From d252c6c80b706d84f7d1043a18c6747fe01d7e5a Mon Sep 17 00:00:00 2001 From: Brian Rodriguez Date: Thu, 28 Jan 2021 21:12:10 -0500 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d9ae41..286a092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Breaking changes: New features: - Added `imul` (#18) +- Added the golden ratio `phi` (#29) Bugfixes: