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 numbers

Author
Message
sprites r us
20
Years of Service
User Offline
Joined: 4th Mar 2004
Location:
Posted: 16th Mar 2004 19:18
is there a round function for rounding say 5.768 to 5.77?

i could write one myself but it's just boring...

Also i saw a rumour somwehere that there was a sql plug in for dbp, is there and if so where can i find it?
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 16th Mar 2004 19:25 Edited at: 16th Mar 2004 19:27
Im not sure if it will work (im not at my DB pc)



For 5.678 -> 5.68 you should use round(5.678,2)

This will happen:
5.678 * (10^2) = 567.8
int(567.8) = 568
568 / (10^2) = 5.68

done

Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"
sprites r us
20
Years of Service
User Offline
Joined: 4th Mar 2004
Location:
Posted: 16th Mar 2004 19:43
I rewrote it slightly to suit my needs (as i always want 2 decimals)
But the roblem is (as i suspected) that inting a number returns the int part of the number as it is, it doesnt round, i.e int(567.8) returns 567 not 568.

Only thing i can think of now is to typecast to string get the last digit right$(string,1) check if it is a 5,6,7,8 or 9 and if it is inc number and then int... guess i should have written that in my code instead and i had been finished by now.. of to try it

Login to post a reply

Server time is: 2024-09-22 02:30:41
Your offset time is: 2024-09-22 02:30:41