Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.
Merged
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
11 changes: 11 additions & 0 deletions docs/Math.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ tan :: Radians -> Number

Returns the tangent of the argument.

#### `(%)`

``` purescript
(%) :: Number -> Number -> Number
```

_left-associative / precedence 7_

Computes the remainder after division, wrapping Javascript's `%` operator.

#### `e`

``` purescript
Expand Down Expand Up @@ -216,3 +226,4 @@ sqrt2 :: Number
The square root of two, around 1.41421.



6 changes: 6 additions & 0 deletions src/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ exports.pow = function (n) {
};
};

exports["%"] = function(n) {
return function(m) {
return n % m;
};
};

exports.round = Math.round;

exports.sin = Math.sin;
Expand Down
5 changes: 5 additions & 0 deletions src/Math.purs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ foreign import sqrt :: Number -> Number
-- | Returns the tangent of the argument.
foreign import tan :: Radians -> Number

infixl 7 %

-- | Computes the remainder after division, wrapping Javascript's `%` operator.
foreign import (%) :: Number -> Number -> Number

-- | The base of natural logarithms, *e*, around 2.71828.
foreign import e :: Number

Expand Down