3 ms·
A Mathematical Way to Check for Number Negativity
This function returns a positive nonzero number if x is negative, and 0 otherwise:
f(x): abs(x) - x
And this one returns a negative number if x is negative, and 0 otherwise:
f(x): x - abs(x)
- montroser 8y agoAnd you could even use these functions to check their own outputs and these functions again to check those outputs in turn, and these functions again to check those outputs in turn, and these functions again to check those outputs in turn, and these functions again to check those outputs in turn, and these functions again to check those outputs in turn, and on, and on...
- unlimiter 8y agoOf course.