Results 1 to 3 of 3

Thread: MS 1+1 = 3

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    60

    Unhappy

    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

  2. #2
    Junior Member
    Join Date
    Feb 2000
    Location
    Gig Harbor, WA, USA
    Posts
    25
    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

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    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
  •  



Click Here to Expand Forum to Full Width