Page 1 of 1

Negative number

Posted: Sun Nov 14, 2004 4:04 am
by kettle_drum
Dont know if im just not seeing it, but is there a function to turn a possitive number into a negative? E.g. 12 will become -12 or do we just have to subtract the value from itself twice?

Posted: Sun Nov 14, 2004 4:44 am
by djot
-
Hi,

I don't know any. But your idea to substract the value twice from itself was funny to me :) Why not just multiply with -1 ?

djot
-

Posted: Sun Nov 14, 2004 4:46 am
by kettle_drum
Hmm interesting...lol. That might be a better idea :P

Code: Select all

$value *= -1;

not 

$value -= ($value*2);

Posted: Sun Nov 14, 2004 8:57 am
by John Cartwright
kettle_drum wrote:Hmm interesting...lol. That might be a better idea :P

Code: Select all

$value *= -1;

not 

$value -= ($value*2);
Sometimes the obvious is the unobvious.. if that makes sense :P

Posted: Sun Nov 14, 2004 9:19 am
by patrikG
Phenom wrote:Sometimes the obvious is the unobvious.. if that makes sense :P
Like known knowns and known unkonwns and unknown knowns and unknown unknowns. ;)

Posted: Sun Nov 14, 2004 9:29 am
by John Cartwright
But the unknown is known unless the known is known and unknown not known while the unknown is unknown

Posted: Sun Nov 14, 2004 9:33 am
by patrikG
The unkown will remain unknown unless known.

(that's it from me - don't want to derail this thread further ;) )