-
Notifications
You must be signed in to change notification settings - Fork 60
Fix cross-platform sort-order issue in PowderN #2272
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
Conversation
* Use direct comparison instead of subtraction (higher precision) * As qsort does not guarantee returned order in case of equal element - sort on F2 - sort on j
|
(We ignore McXtrace / windows since ref-lib uses complex numbers - relevant edits are not in place yet for that case.) |
|
Interestingly, it seems that "some undefined behaviour" remains - but quite rare... Two runs of the test-suite from my branch last night - one of them is off, the other is not. (Seems consistent with current and earlier nightlies on main, see e.g. |
mads-bertelsen
left a comment
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.
Nice that the table sorting is now platform independent. Makes sense that without this, same seed runs could differ even though they should converge to the same value in long enough runs.










Free-form text area
Please describe what your PR is adding in terms of features or bugfixes:
This PR makes PowderN reflection sorting perform alike on all platforms:
Has been tested to perform identically within Test_PowderN but could potentially solve differences seen in more complicated powder instruments such as ILL D1B and D2B.
Fixed for McStas + McXtrace PowderN + McStas Union Powder_process
Background data:
Prior to the fix, two powder lines in Fe.laz / Test_PowderN would for instance be swapped unix vs windows:
Development OS / boundary conditions
Please describe what OS you developed and tested your additions on, and if any special dependencies are required:
PR Checklist for contributing to McStas/McXtrace
For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:
My contribution includes patches to an existing component file
mcdocutility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)mctestutility to test one or more instruments making use of the component (please attachmcviewtestreport as screenshot in comments)mcrun --c-lint"linter" and followed advice to remove most / all warnings that are raisedMy contribution includes patches to an existing instrument file
mcdocutility and rendered a reasonable documentation page for the instrument (please attach as screenshot in comments!)mctestutility to test the instrument (please attachmcviewtestreport as screenshot in comments)mcrun --c-lint"linter" and followed advice to remove most / all warnings that are raised