-
Notifications
You must be signed in to change notification settings - Fork 171
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
float_to_short_test fails on PowerPC running OpenBSD #65
Comments
Yes, I think so.
More likely to be a compiler bug, |
I don't get it: the compiler is not the one rounding floats to ints. |
If it is happening with more than one compiler, then I think it is unlikely to be the compiler. At this point I have no idea what it is. |
Tried to validate this but failed on our ppc system and gcc 4.8.2, gcc 8.2.0. All works fine, tests pass. Are you using configure or CMake? Can you attach your config.h (after configuring)? |
I use
Do you see any difference to your config? |
Yes: Additionally I found another form of undefined behavior which is described here: https://stackoverflow.com/a/4009922/1930508
Similar problem for e.g @janstary Change the define manually to Wait. I've just seen, that it fails on the positive tests. What I got:
Could you debug this code and verify this to see WHERE the values are different? I'd suggest to add an intermediate int for You may also try this (which is how I'd do it):
|
With Anyway, on this machine, this is what
Doesn't that mean that I added some lame
Firstly, why does the test only fail after the Notice that my scaled values are integral (while being double). However, For reference, here is the dmesg of the machine. With the modified
I believe your modification is an improvement at any rate. |
Ok, expected as this path should not be chosen for this error
Can I see your code? Is it like this:
If yes, something is very wrong here.
No it means either your test code or the compiler/libm implementation is buggy or one of assumptions above does not hold.
Not sure where you put those printfs but if they are in the loop of
No that's fine. My values were exact values (not outputs) calculated with higher accuracy.
Not at all. The -512 doesn't make any sense at all. Can you post your code and check above sample for correct use of long and %ld?
Floating point is tricky... Valid floats are |
Ah, I was printing the lrint() results as "%d", not "%ld". With "%ld", it's
which seems right.
OK, I was worried even multiplication is wrong here. However,
with
which makes no sense indeed. |
I started a https://github.com/janstary/libsamplerate/tree/float branch |
Can you please test the following on your PPC machine?
On my
|
My long type is 64 bit so LONG_MAX is 9223372036854775807 and hence output is:
Can you show your LONG_MAX, INT_MAX and check the used declaration for For this project I'd suggest to use my alternative implementation and remove the clipping code. On all systems I configured this no clipping was supported which is probably due to |
Thank you - that seems to be what's broken in my system:
That's |
Amazing bug 👍 Out of curiosity can you try 1073741822 to 1073741824 (2^30 and one above/below) If I'm right then the bug should happen in the range [2^30, 2^31) Proposed fix/workaround for SRC: #65 (comment) @erikd |
The
|
This is current git on OpenBSD 6.5/macppc (meaning powerpc).
Running 'make check' fails with the following:
The text was updated successfully, but these errors were encountered: