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

Float Param min_value incorrectly enforced #356

Open
R4chel opened this issue Feb 12, 2023 · 0 comments
Open

Float Param min_value incorrectly enforced #356

R4chel opened this issue Feb 12, 2023 · 0 comments

Comments

@R4chel
Copy link
Contributor

R4chel commented Feb 12, 2023

If I set a param
foo = vsketch.Param(0.3, min_value=0.001)
In the gui, I am able to set foo to 0

I didn't come across it until looking into this but there is a symmetrical problem for max_value

I came across this because I wanted to avoid division by zero errors, so I wanted to prevent some values from being 0. I wanted to do it in a generalized way so that I wouldn't have to change depending on how many the decimals parameter so I set the value to 1e-10 and found I was still able to set the parameters to 0 and run into the division by zero error.

I dug into this a little bit I believe rounding is happening somewhere because for example in the case where decimals=1

foo = vsketch.Param(0.3, decimals=1, min_value=0.05) -> stops foo from being
foo = vsketch.Param(0.3, decimals=1, min_value=0.049) -> allows the foo to be set to 0.

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

No branches or pull requests

1 participant