8000 numpy.remainder not working as defined. · Issue #7272 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

numpy.remainder not working as defined. #7272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jakehanson opened this issue Feb 18, 2016 · 4 comments
Closed

numpy.remainder not working as defined. #7272

jakehanson opened this issue Feb 18, 2016 · 4 comments

Comments

@jakehanson
Copy link

For some reason, numpy.remainder function is not working as defined for the following specific case:

np.remainder(.60,.04) = 0.04

0.60-np.floor(0.60/0.04)*0.04 = 0.00 (Function as defined)

This seems to be the only case for which the definition does not match the function output.

@njsmith
Copy link
Member
njsmith commented Feb 18, 2016

What version of numpy?

On Wed, Feb 17, 2016 at 9:32 PM, jakehanson notifications@github.com
wrote:

For some reason, numpy.remainder function is not working as defined for
the following specific case:

np.remainder(.60,.04) = 0.04

0.60-np.floor(0.60/0.04)*0.04 = 0.00 (Function as defined)

This seems to be the only case for which the definition does not match the
function output.


Reply to this email directly or view it on GitHub
#7272.

Nathaniel J. Smith -- https://vorpus.org http://vorpus.org

@omegahm
Copy link
Contributor
omegahm commented Feb 18, 2016

I'm not sure what it is, that isn't working:

>>> np.__version__
'1.10.4'
>>> 0.60 % 0.04
0.039999999999999966
>>> np.remainder(0.60, 0.04)
0.039999999999999966

@pv
Copy link
Member
pv commented Feb 18, 2016

Probably duplicate of gh-7224

@jakehanson
Copy link
Author

Hi Pauli, I beleive you're correct. Ideally i would like the remainder to
return something close to 0 rather than x2 if x1 is divisible by x2, but I
understand how floating point error can cause this. Thank you all for the
responses.
On Feb 18, 2016 7:02 AM, "Pauli Virtanen" notifications@github.com wrote:

Probably duplicate of gh-7224 #7224


Reply to this email directly or view it on GitHub
#7272 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0