Missing basic math functions for integers
tracked
error.mdl
We seem to be missing a few really basic math operations for integers. The ones I've noticed so far are modulo and power.
Log In
Momo the Monster
Merged in a post:
Need System.Math, UnityEngine.Mathf is not enough! Especially remainder operators.
ᴋᴀᴡᴀ
- Mathf is designed for floats, some times you might need extra precision so doubles math functions is necessary.
- Mathf doesn't implement all Math functions, for example: IEEERemainder (actually very useful %-operator for floating point), Truncate, DivRem (%-operator for integers, also not available "from the box"), hyperbolic functions that some times used in blending/animation time curves.
Momo the Monster
tracked
naqtn
Note: There's another ticket for modulo https://feedback.vrchat.com/vrchat-udon-closed-alpha-feedback/p/modulus
hakanai
While on the subject of modulo, it would be good if it worked correctly, instead of the way % works on most programming languages. The number of times I find myself implementing my own modulo function. :|
error.mdl
We also need math functions for integers. Right now a lot of simple stuff like power and modulo are missing for integers.
Helpful Helper
error.mdl: Either your post is outdated or you didnt look hard enough ;P Power is Mathf.pow(f, p) and Modulo is Mathf.Repeat(t, length).
And a float is just a fancier integer. You can always do int operations with float operations and conversions/rounding.
E
EvolvedAnt
Helpful Helper: Pretty sure Mathf.pow, etc, was added in an update right after the posts that they were missing.