For me module in programming has always been what this operator does, so the rest of the description is contradictory, but what you described seems to be that you want to take the value without signal, then it would be the method Abs()
. As he takes the absolute value, that is, no sign, no matter if he is positive or negative his result will be a positive. This method exactly checks whether it is positive or not before changing the signal and makes the signal exchange (does not use nor if
, or multiplication that are inefficient, can see the source code).
Math.Abs(-1) //resulta em 1
I put in the Github for future reference.
Absolute value (abs): https://docs.microsoft.com/pt-br/dotnet/api/system.math.abs?view=netframework-4.8
– anonimo
I hadn’t remembered the abs method.
– Levi