[futurebasic] Re: Stuff

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: Peter Cone <brinc@...>
Date: Sun, 23 Nov 1997 08:30:36 -0500
<< Is there a quick, one command way of changing the sign of a number... say
from 102.092 to -102.092? >>

>Al Staffieri Jr. suggested:
>X = X - (X * 2)
>
>If X is a negative number, it will become positive. If it's positive it will
>become a negative.

True but not -X in either case!     {:-[

Perhaps Al meant X = X - (X * 2)/X, which does work for negating X.

Note:
X = X * (-1) is simpler,
But I suspect the original questioner sought a bit twiddling solution?

Cheers,

Peter