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.

Newcomers AppGameKit Corner / Rounding down a real number

Author
Message
Doveyy04
11
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 29th Jan 2019 19:23 Edited at: 29th Jan 2019 19:48
I’m using a real number as a variable but also wish to convert the decimal point amount to another variable so for example I have gametime#=1.75 and I want the 0.75 to another variable. The thing is when I say for instance gametime2=gametime# then gametime2=2 because it’s rounded up so is there a way to return a value ‘rounded down’ to 1?
Doveyy04
11
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 29th Jan 2019 19:48
Actually what I’ve done is

If gametime2>gametime# then gametime2=gametime2-1
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Jan 2019 20:35
you could try
fmod(gametime#, 1)
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 29th Jan 2019 21:26
gametime2# = gametime1# - trunc(gametime1#)

Login to post a reply

Server time is: 2024-03-29 05:32:19
Your offset time is: 2024-03-29 05:32:19