Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
DOC: Correct and extend the documentation of fmod and remainder ufuncs.
Closes #3563.
  • Loading branch information
charris committed Feb 28, 2014
commit 0a3b146cc95e26f00937c6821bb531f7c33185b4
20 changes: 14 additions & 6 deletions numpy/core/code_generators/ufunc_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,10 @@ def add_newdoc(place, name, doc):
"""
Return the element-wise remainder of division.

This is the NumPy implementation of the Python modulo operator `%`.
This is the NumPy implementation of the C library function fmod, the
remainder has the same sign as the dividend `x1`. It is equivalent to
the Matlab(TM) ``rem`` function and should not be confused with the
Python modulus operator ``x1 % x2``.

Parameters
----------
Expand All @@ -1276,15 +1279,16 @@ def add_newdoc(place, name, doc):

See Also
--------
remainder : Modulo operation where the quotient is `floor(x1/x2)`.
remainder : Equivalent to the Python ``%`` operator.
divide

Notes
-----
The result of the modulo operation for negative dividend and divisors
is bound by conventions. In `fmod`, the sign of the remainder is the
sign of the dividend. In `remainder`, the sign of the divisor does not
affect the sign of the result.
is bound by conventions. For `fmod`, the sign of result is the sign of
the dividend, while for `remainder` the sign of the result is the sign
of the divisor. The `fmod` function is equivalent to the Matlab(TM)
``rem`` function.

Examples
--------
Expand Down Expand Up @@ -2685,7 +2689,10 @@ def add_newdoc(place, name, doc):
"""
Return element-wise remainder of division.

Computes ``x1 - floor(x1 / x2) * x2``.
Computes ``x1 - floor(x1 / x2) * x2``, the result has the same sign as
the divisor `x2`. It is equivalent to the Python modulus operator
``x1 % x2`` and should not be confused with the Matlab(TM) ``rem``
function.

Parameters
----------
Expand All @@ -2705,6 +2712,7 @@ def add_newdoc(place, name, doc):

See Also
--------
fmod : Equivalent of the Matlab(TM) ``rem`` function.
divide, floor

Notes
Expand Down