07-09-2024 07:35 AM
"-10 MOD 100"
Should return 90
Teststand returns -10 when asked to do "-10 MOD 100"
Can anyone shed any light as to why or if there is anyway around this
Many Thanks
Solved! Go to Solution.
07-10-2024 03:07 AM
Bumping this, I need an answer, I've worked around it calling out to a method in some code but I want to do it within Teststand if it's possible.
07-10-2024 07:20 PM
"If the dividend or divisor is negative, then two possible choices for the remainder occur. In mathematics, the remainder is positive, but implementations in programming languages differ."
So, modulo division can be truncated or floored when implemented in a programming language. Based on the fact that the expression produced a negative remainder would indicate that TestStand has chosen to use truncated modulo division.
Reference: Modulo Operations with Negative Numbers (omnicalculator.com)
07-11-2024 05:30 AM
Thankyou, that's very helpful, everyday is a school day