Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Change the sign of a function

Author
Message
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 14th Apr 2013 13:09
Hi all,

Is there a command that allows a user to instantly change the sign of an integer to it's positive or negative counterpart? I.e. a command that changes a number like -10 to 10?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 14th Apr 2013 13:13
x = x * -1

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 14th Apr 2013 13:34 Edited at: 14th Apr 2013 13:38
Thanks Jim,

that is how I'm calculating the sign at the moment. I was just wondering, since there is a RandomSign() function, if there was a command-equivalent of the calculation.

edit: a bit off-topic, but since it was you that answered: thank you very much for making AppGameKit for Pascal. I'm currently programming in Tier 1, but I loved programming in Turbo Pascal during my early twenties. I should pick it up once more.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Apr 2013 15:43
x=-x
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 14th Apr 2013 17:03
Zerotown - I didn't do the Pascal. The brilliant Erik van Bilsen did!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 16th Apr 2013 02:45
x=0-x
(same as Markus, but is more likely to work with other programming languages)

Login to post a reply

Server time is: 2024-05-01 09:48:37
Your offset time is: 2024-05-01 09:48:37