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 DBPro Corner / rounding down

Author
Message
treborguy
21
Years of Service
User Offline
Joined: 24th Sep 2003
Location: The trendy club
Posted: 13th Nov 2005 13:14
how do i stop db from rounding the numbers i give it to the nearest integer. eg, i say:

down#=down#+0.3

and it instantly makes it 0

Brains are for idiots
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 13th Nov 2005 13:57 Edited at: 13th Nov 2005 13:57
down#=down#+0.3 gives me 0.300000011921 (due to binary rounding errors..thats normal), are you sure you have the computer turned on? , run this



if you get anything other than 0.30000001192 or whatever then you need a PC with a fpu for a guess, I didn`t know there where any PC`s that old still about



if there is one thing I can NOT tolerate, it`s intolerant people.
treborguy
21
Years of Service
User Offline
Joined: 24th Sep 2003
Location: The trendy club
Posted: 13th Nov 2005 16:17
lol, my comp is quite up to date, it seems to be working now , i just reinstalled db. cheers

Happy time!
treborguy
21
Years of Service
User Offline
Joined: 24th Sep 2003
Location: The trendy club
Posted: 13th Nov 2005 16:26 Edited at: 13th Nov 2005 16:27
nope, actually not working when i try my code, ill post it.



when i try to make the box go right or down by adding to the variables it doesnt like it

Happy time!
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 13th Nov 2005 19:44 Edited at: 13th Nov 2005 19:48
boxy etc should be boxy#, the hash means floating point number, if you don`t put it in then you get integers (rounded to the nearest whole number), any fractional values should be ended #, if you use a fractional value where a integer should go (like a sprites position) then it gets rounded automaticaly when it is used, add # to the end of your variable names and it will work eg.



note I just altered those values that needed to be fractional, the others are ok as integers.



if there is one thing I can NOT tolerate, it`s intolerant people.

Login to post a reply

Server time is: 2024-11-27 12:22:05
Your offset time is: 2024-11-27 12:22:05