Skip to content
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

Improve calculation of the scale parameter for the uniform float distribution. #1301

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

WarrenWeckesser
Copy link
Collaborator

The calculation of scale for the uniform float distribution is moved to its own function and updated to avoid the problem that was pointed out in gh-1299. As part of the new implementation, the new utility methods lt_mask(), increase_masked() and utils_next_down() are added to the FloatSIMDUtils traits.

The improved method for computing the scale is explained in the comments in the function compute_scale().

@dhardy
Copy link
Member

dhardy commented Mar 20, 2023

Quick question from a bird's eye perspective: decrease_masked is used in three locations, but this only replaces one. Is it relevant elsewhere? (Also, is it even needed in new_inclusive?)

@WarrenWeckesser
Copy link
Collaborator Author

In the few tests that I did, new_inclusive didn't show the behavior reported in gh-1299, so I focused on fixing the behavior in new, and didn't look much beyond that. I'll take another look, and also I'll get caught up on gh-1289 and the paper linked there.

In the meantime, I'm marking this PR as draft.

@WarrenWeckesser WarrenWeckesser marked this pull request as draft March 21, 2023 10:54
@GUIpsp
Copy link

GUIpsp commented Apr 10, 2023

Hello - sorry for the late comment.

I don't have an example off the top of my head, but I can say that I saw the same behaviour with new_inclusive (but with different constants).

@WarrenWeckesser
Copy link
Collaborator Author

Thanks, @GUIpsp. If you happen to find example of the bad behavior with new_inclusive, be sure to note it here or in #1299.

@dhardy dhardy mentioned this pull request Oct 31, 2023
24 tasks
@dhardy
Copy link
Member

dhardy commented Jan 29, 2024

@WarrenWeckesser is this still on your to-do list?

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

Successfully merging this pull request may close these issues.

None yet

3 participants