|
-
Aug 31st, 2000, 06:50 PM
#1
Thread Starter
Member
Well not quite, it is more like 92.6 rounded off = 92?????
When i did maths i learnt that any decimal that was 5 or over you round up, else you round down. Has Microsoft re-invented maths to its requirements and no one elses?
Please someone help with this, a screen shot of the code and what happens it at this site:
http://webxd.hypermart.net/MSCrap.gif
Please help, it should be simple.
Grant French
-----------------------------------------------
E-Mail: [email protected]
ICQ: 33122184
-
Aug 31st, 2000, 06:55 PM
#2
Junior Member
You need to use Round() instead of Int(). Int *truncates* the number, so anything past the decimal point is removed. Round actually rounds the number. Sytax is:
Round(expression [,numdecimalplaces])
(¯`·.¸¸.·´¯`·->Cromas<-·´¯`·.¸¸.·´¯)
Teenage Programmer
Formerly known as ShadowCrawler
E-Mail: [email protected]
ICQ: 9872708
AIM: VotchOut
-
Aug 31st, 2000, 07:11 PM
#3
Or you can use the CInt function.
Code:
Debug.Print CInt(5.6) ' = 6
Debug.Print CInt(5.4) ' = 5
Debug.Print CInt(5.5) ' = 6
Debug.Print CInt(4.5) ' = 4 ( n.5 is always rounded to an even number
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|