The quick way to get the Absolute value (to code it) is to use the ABS()
function.
Sydney
Joined: 13 Feb 2009 Posts: 71
Posted: Mon Mar 02, 2009 2:00 pm
You could do:
Code:
signed int32 value = -1000;
value = -value;
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Mon Mar 02, 2009 2:04 pm
With that method, he has to know ahead of time that the value is negative.
Or, he has to add a test (an if statement) to test if it's negative before
he does your code.
With the ABS() function, it works on either a positive or negative value.
You don't need to test it before you run the function on it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum