Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

Add the golden ratio φ #29

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Breaking changes:

New features:
- Added `imul` (#18)
- Added the golden ratio `phi` (#29)

Bugfixes:

Expand Down
2 changes: 2 additions & 0 deletions src/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 4 additions & 0 deletions src/Math.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down