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

Commit

Permalink
Merge pull request #6 from purescript/rem
Browse files Browse the repository at this point in the history
Add remainder operator
  • Loading branch information
paf31 committed Jun 16, 2015
2 parents 69e64af + af0cdb4 commit b09b507
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
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

0 comments on commit b09b507

Please sign in to comment.