-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename "functions" module to "commons"
- Loading branch information
1 parent
dee46b8
commit 92806e1
Showing
3 changed files
with
52 additions
and
197 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Common numeric functions.""" | ||
|
||
import functools | ||
from numbers import Real | ||
|
||
from monkeys.typing import params, rtype, ignore | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
def add(x, y): | ||
return x + y | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
def sub(x, y): | ||
return x - y | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
@ignore(float('NaN'), ZeroDivisionError) | ||
def mod(x, y): | ||
return x % y | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
def mul(x, y): | ||
return x * y | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
@ignore(float('NaN'), ZeroDivisionError) | ||
def div(x, y): | ||
return x / y | ||
|
||
|
||
@params(Real, Real) | ||
@rtype(Real) | ||
@ignore(float('NaN'), ZeroDivisionError) | ||
def exp(x, y): | ||
return x ** y | ||
|
||
|
||
@params(Real) | ||
@rtype([Real]) | ||
@ignore([], Exception) | ||
def num_range(x): | ||
return list(range(int(x))) |
This file was deleted.
Oops, something went wrong.