While trying performing calculations to loop through only certain values of an array, I ran into an issue where the calculation would return results outside of the array's range. To fix this I came up with these two equations to make sure the numbers are not outside the specified range.
https://www.desmos.com/calculator/gogvt7dqjq
Now I'm unsure if this would actually be more efficient than a simple if statement. And I did a lot of researching before figuring out the formulas on my own, and couldn't find anything on it. Is there a name for this type of formula? Would a simple if statement be more efficient than the equation?
Aucun commentaire:
Enregistrer un commentaire