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 / Arrays and real numbers, a few questions...

Author
Message
Allie
16
Years of Service
User Offline
Joined: 5th Jan 2008
Location: Melbourne, Aus
Posted: 5th Jan 2008 22:19 Edited at: 6th Jan 2008 06:09
Hi ive a few questions if anyone can help. I have some code which displays real numbers but they have about 8 numbers after the decimal point, anybody know how to round these off?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Jan 2008 00:21 Edited at: 6th Jan 2008 00:22
Quote: "anybody know how to round these off?"


CEIL() rounds up and FLOOR() rounds down.

If you want to reduce to a smaller number of decimals, convert to a string and back again, specifying the total number of digits

myVal$ = str$(myVal#, 5)
myVal# = val(myVal$)

...or divide and then multiply by the same value...

myVal# = myVal# / 1000
myVal# = myVal# * 1000

Login to post a reply

Server time is: 2024-11-25 10:43:03
Your offset time is: 2024-11-25 10:43:03