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

Drop constrain() in favor of non-broken version? #77

Open
sofian opened this issue Feb 1, 2023 · 0 comments
Open

Drop constrain() in favor of non-broken version? #77

sofian opened this issue Feb 1, 2023 · 0 comments
Labels

Comments

@sofian
Copy link
Collaborator

sofian commented Feb 1, 2023

This relates to #73.

The constrain() macro in Arduino is counter-intuitive and unsafe IMHO because when calling because eg.

constrain(1, 3, 0)

will return 3.

I created a function safeConstrain() that solves that issue but I am wondering whether we could create another function eg. clamp(). However it looks like most functions of the same kind (numpy.clip, clamp, etc.) follow the same rule as constrain() so maybe this is no big deal...

@sofian sofian added the question label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant