diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-02-15 12:49:02 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-02-18 21:31:05 -0700 |
commit | 8556c5dcf623efa57d037b0b9685a81a896010d5 (patch) | |
tree | 3c0b683d6826587fc847889993c6510a3745a138 /numpy/doc/byteswapping.py | |
parent | 25c23f1d956104a072a95355ffaa7a38b53710b7 (diff) | |
download | numpy-8556c5dcf623efa57d037b0b9685a81a896010d5.tar.gz |
ENH: Make numpy floating scalars consistent with Python divmod.
The following numpy scalar floating functions are reimplemented
using the npy_divmod function.
- remainder ('%')
- floor_division ('//')
- divmod
Note that numpy scalars warn on zero division rather than raise.
divmod example, Python floats
In [1]: a = 78 * 6e-8
In [2]: b = 6e-8
In [3]: divmod(a, b)
Out[3]: (77.0, 5.999999999999965e-08)
Before this commit numpy float64 gave
In [4]: divmod(float64(a), float64(b))
Out[4]: (78.0, 0.0)
After this commit numpy float64 gives
In [4]: divmod(float64(a), float64(b))
Out[4]: (77.0, 5.9999999999999651e-08)
Diffstat (limited to 'numpy/doc/byteswapping.py')
0 files changed, 0 insertions, 0 deletions