diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2006-09-04 17:06:31 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2006-09-04 17:06:31 +0000 |
commit | cd71708a570b7eb770e54ba08ccbf7b414b26201 (patch) | |
tree | 32d3c4899f857f4be3dbd51b5037a16f3dd60dae /numpy/add_newdocs.py | |
parent | 2d72b34fb356c1f5440218123c06efd534555303 (diff) | |
download | numpy-cd71708a570b7eb770e54ba08ccbf7b414b26201.tar.gz |
Add documentation to round and around to clear up confusion from numpy's choice
to round to even.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 86773335b..3b130c63b 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -848,7 +848,28 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('resize', add_newdoc('numpy.core.multiarray', 'ndarray', ('round', - """a.round(decimals=0, out=None) + """a.round(decimals=0, out=None) -> out (a). Rounds to 'decimals' places. + + Keyword arguments: + decimals -- number of decimals to round to (default 0). May be negative. + out -- existing array to use for output (default a). + + Return: + Reference to out, where None specifies the original array a. + + Round to the specified number of decimals. When 'decimals' is negative it + specifies the number of positions to the left of the decimal point. The real + and imaginary parts of complex numbers are rounded separately. Nothing is + done if the array is not of float type. + + The keyword 'out' may be used to specify a different array to hold the + result rather than the default 'a'. If the type of the array specified by + 'out' differs from that of 'a', the result is cast to the new type. + + Numpy rounds to even. Thus 1.5 and 2.5 round to 2, -0.5 and 0.5 round to 0, + etc. Results may also be surprising due to the inexact representation of + decimal fractions in IEEE floating point and the errors introduced in + scaling the numbers when 'decimals' is something other than 0. """)) |