You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
The text was updated successfully, but these errors were encountered:
This relates to #73.
The constrain() macro in Arduino is counter-intuitive and unsafe IMHO because when calling because eg.
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...The text was updated successfully, but these errors were encountered: