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

fix: random sign when +ve is false(re) #1954

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

viraj-s15
Copy link
Contributor

What does this change

When using print(f.pyfloat(positive=False)) , the number could be positive or negative.
Now when positive is false, only negative numbers would be returned.

What was wrong

Both negative and positive being returned.

How this fixes it

Removed randomly picking a sign if positive is false

Fixes: #1928

Now this could be intended, if it was, maintainers, please let me know, I would love to implement the random sign functionality but that would require changing the function arguments and tests.

I did not want to ruin the commit history by making changes to the messed up pr.
Apologies to the maintainers. heres the actual pr.

@fcurella
Copy link
Collaborator

I think the correct behavior should be:

positive=True always return a positive number
positive=False always return a negative
positive=None (or not specified at all) return random sign

@viraj-s15
Copy link
Contributor Author

positive=True always return a positive number positive=False always return a negative positive=None (or not specified at all) return random sign

Agreed, will add that.

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

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

Thank you!

@fcurella fcurella merged commit 1ff3186 into joke2k:master Dec 13, 2023
28 checks passed
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.

pyfloat ignores the positive kwarg
2 participants