Skip to content

Fix random number generator for f16 and short on the CPU backend #2587

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

Merged
merged 2 commits into from
Jul 18, 2019

Conversation

umar456
Copy link
Member

@umar456 umar456 commented Jul 18, 2019

The CPU random number generator was incorrectly calculating the shifts
for the transform function. This logic seemed to be copied from the
uchar transform function. The incorrect behavior only appeared on
Windows and for arrays larger than 256 elements. In this commit I
mask the shifted value before the float factor is calculated.

umar456 added 2 commits July 17, 2019 23:11
The CPU random number generator was incorrectly calculating the shifts
for the transform function. This logic seemed to be copied from the
uchar transform function. The incorrect behavior only appeared on
Windows and for arrays larger than 256 elements. In this commit I
mask the shifted value before the float factor is calculated.
Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good but we should have a unit test for this case you have mentioned - windows arrays with larger than 256 elements.

@9prady9
Copy link
Member

9prady9 commented Jul 18, 2019

This PR addressed the math_cpu failures on windows for #2585

@9prady9 9prady9 merged commit eb89160 into arrayfire:master Jul 18, 2019
@9prady9 9prady9 deleted the random_fix branch July 18, 2019 11:35
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.

2 participants