Signed integers are asymmetrical
When I have built true absolute value operations--which has actually been pretty rare as I don&#x27;t think you usually want &quot;integers&quot; for most computer work and are better off thinking in terms of finite fields instead of numbers whenever possible--I add a check that the result is actually non-negative (which is the kind of sanity check one would also want to write to verify you don&#x27;t lose precision, saturate, or overflow in other &quot;I am using these as numbers instead of a finite field&quot; cases); or, if I am working with a number I know to be negative, sometimes I go with &quot;the additive inverse wasn&#x27;t the number itself&quot;, as in this code:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;OrchidTechnologies&#x2F;orchid&#x2F;blob&#x2F;be5cc32a1649e699509bdd0514067d36cadc6dcd&#x2F;lot-ethereum&#x2F;lottery1.sol#L137" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;OrchidTechnologies&#x2F;orchid&#x2F;blob&#x2F;be5cc32a16...</a>