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 / working rounding numbers function in here

Author
Message
sprites r us
20
Years of Service
User Offline
Joined: 4th Mar 2004
Location:
Posted: 16th Mar 2004 19:59
Ok so i did it the hardway, atleast it works... DBP should really have a round function, still this is a usefull workaround if anyone needs one...

this only works for rounding 3 decimal numbers into 2 decimals but it can be adapted to other rounding needs, but i am to tired and can't be arsed to make it universal right now...

Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 20th Mar 2004 21:03
umm, isnt there a already a function for makinga decimal a whole number (at least i think in classic)
PowerFang
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location: Australia (But currently in the USA)
Posted: 21st Mar 2004 14:56
yeah but thats not rounding

taking a float from 1.345632456345745 to 1.35 is what he means.....
Shadow
21
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 21st Mar 2004 22:20 Edited at: 21st Mar 2004 22:24
function rounding(originalnumber#)
intnumber=int(originalnumber#)
finalnumber#=intnumber + (originalnumber#-intnumber => 0.5)
endfunction finalnumber#

Login to post a reply

Server time is: 2024-09-22 03:06:45
Your offset time is: 2024-09-22 03:06:45