Pages: 1
Topic closed
laser100 wrote:
Or use abs(absolute value).
Correct.
|-5|=5 makes sense to me
-5*-1 doesn't
Offline
ThePCKid wrote:
laser100 wrote:
Or use abs(absolute value).
Correct.
|-5|=5 makes sense to me
-5*-1 doesn't
Both work (although, I'm sure you know that) depending on the situation.
If you want to change the sign of a number, multiply by -1. But, if you just want to make a number positive (whether it's negative or positive to begin with), take the absolute value.
Offline
coolstuff wrote:
Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.
Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.
Offline
demosthenes wrote:
coolstuff wrote:
Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.
Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.
Me too, but because he/she asked to turn negative to positive, it works with abs.
Offline
laser100 wrote:
demosthenes wrote:
coolstuff wrote:
Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.
Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.
Me too, but because he/she asked to turn negative to positive, it works with abs.
Yeah, I'm not sure whether iCode wanted only negative to positive or to flip the sign, so both answers are valid.
Offline
Topic closed
Pages: 1