[futurebasic] Re: Stuff

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

From: Lazlo Toth <ArtVandals@...>
Date: Mon, 24 Nov 97 23:17:19 +1100
>> << 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?
>
>Maybe I'm missing something here...why not just use the most obvious
>solution? Namely:
>
>  X = -X

Yeah, this seemed to be a good idea at the time but I couldn't get the 
compiler to recognise it. 

Similarly, it wouldn't look at this

LONG IF ArcCheck% = - 2

unless it was written like

LONG IF ArcCheck% = (-2)

So perhapse if I had removed the odd space, X = -X would have worked 
fine. I think I had a hit at something like  Al Staffieri Jr. suggested: 
X = X - (X * 2) , but my conscience got the better of me :-)


JC


==========================================================================
John Clark                    
Aeronaut Automation
30 Kennedy Place Bayview 2104 Australia
Phone:   61 2 99 97 28 42              Fax: 61 2 99 79 56 15
email:   ArtVandals@...
Visit the web site at <http://cygnus.uwa.edu.au/~peterh/>
==========================================================================