-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
python rounding errors fix #2306
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason for you not to patch pyport.h
directly (add #undef PY_NO_SHORT_FLOAT_REPR
after the two lines where it could be defined)?
From your PR I assume only the first one is of our concern:
https://github.com/python/cpython/blob/3.6/Include/pyport.h#L476
For that there are three possible cases that could avoid the case, what makes you think the little endian one is appropriate for all possible platforms (especially for arm and arm64)?
There's a reason that none of the three is defined for cross-compiling, because tests are performed in configure
when built on site, which can't be done for the target platform when cross-compile.
You should patch configure.ac
instead even if this is necessary and appropriate:
https://github.com/python/cpython/blob/3.6/configure.ac#L4272
Or |
Also python2? |
1 python2 doesn't even attempt it. seriously 1/10 is 0. Even on normal linux pc. luckly this has nothing to do with the actual calculations going on. |
https://github.com/python/cpython/blob/2.7/Include/pyport.h#L611 Also:
You need to make at least one of the numbers a float if you want to perform a float calculation in python2. For the record:
It has nothing to do with the OS but CPU I think.
|
Would it differ vs gcc? |
I don't think the compiler has anything to do with it. And I don't know. The thing is the question stands anyway: we don't we just undefine And if that's the case, we will go for defining |
So, it seems that |
it should since java uses ieee754 and from jni.h |
IEEE 754 does not specify endianness, that's why there are three I think the question is more like, whether assuming support of any of the variants has effect other than preventing That's why if we want to avoid unexpected side effect, patching pyport.h should be our first approach, and only if that doesn't work, we assume little endian double, which should work fine on most platforms. But whatever the patch is up and it's probably the easiest way anyway, so who cares, right? |
ieee754 doesn;t specify endianess but android does. its always little endian. |
If you say so. |
This comment was marked as spam.
This comment was marked as spam.
No i like tomty89 being around even if disagreements occur as long as they are about the what is best technically its all good. Disagreement is fine if the end point is better. So far that has been the case. |
This comment was marked as spam.
This comment was marked as spam.
Should I feel lucky that I didn't also delete my reply to your quoted reply: I don't have broad knowledge but yes I am picky even in that case, and I do think that that pickiness can be a form of contribution. And since when I do personal attacks? (Does attacking someone's grammar count? Either way that's not what I did) I mean, can I even do that? Like I pretty much know nothing about any of you guys other than your code.
Yes I can. Because GitHub provides a delete button to whoever made specific comments, so yes, it's technically (and logically) correct that they could vanish at any point. Now would you just stop harassing others just because you think I have an "attitude"? File an issue to my parents or primary school teachers, if you can. |
This comment was marked as spam.
This comment was marked as spam.
@SDRausty enough already. This pull request is about rounding errors in python and I'm not really not sure what you are trying to achieve here. I'll delete additional aggressive posts (from any source). |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
@SDRausty No one is happy there when you posting aggressive offtopic comments, especially if they are posted in pull request closed 2 weeks ago.
Github has a special button that allows to block user. More info about this: Github Help. |
fixes #2236