Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:19:21+00:00 2026-05-31T07:19:21+00:00

such code in VBScript will return wrong result: MsgBox Round(4.99985,4) It will return 4.9998

  • 0

such code in VBScript will return wrong result:

MsgBox Round(4.99985,4)

It will return 4.9998 but correct result is 4.9999. I know that it is related to how VBScript works with numbers with floating points, that some numbers can’t be represented in binary system, but please tell me:

  1. What exactly happening here?
  2. What is the possible workaround for that?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:19:22+00:00Added an answer on May 31, 2026 at 7:19 am

    This is expected result, so called bankers’ rounding. Check out the description of the Round function (bold added by me):

    The Round function performs round to even, which is different from round to larger.
    …
    If expression is exactly halfway between two possible rounded values, the function returns the possible rounded value whose rightmost digit is an even number.

    To round to larger, you can use the following function (taken from here):

    Function RoundToLarger(ByVal Number, ByVal NumDigitsAfterDecimal)
      RoundToLarger = CDbl(FormatNumber(Number, NumDigitsAfterDecimal))
    End Function
    

    (Note: Negative numbers are rounded down.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what is wrong with such code public List<SearchItem> Search(string find) { return (from i
I have such code: function allValid() { $('input').each(function(index) { if(something) { return false; }
i use such code, but it renders with error <li class=dd0><div id=dt1<a href=http://localhost:1675/Category/29-books.aspx>Books</a></div></li> there
I have such code example val request: Defered[Int] = client.getSomeIntAsynFromSocket(); request.addCallBack(result => result.success[String]) request.addErrback(error
I have such code... File fileDir = new File(/mnt/sdcard/dd); if(!fileDir.exists() || !fileDir.isDirectory()){ return; }
I want to use such code: $arr=array('a'=>$a); but $a is not defined, so I
I have such code reg = /(.+)_path/ if reg.match('home_path') puts reg.match('home_path')[0] end This will
I have such code: <h:inputText id=input value=#{bean.input}> <f:convertNumber /> <rich:ajaxValidator event=onblur /> </h:inputText> I
I have such code in my JSF template: <h:form> <table id=users cellspacing=0> <a4j:repeat var=person
i have such code var prj = _dataContext.Project.FirstOrDefault(p => p.isPopular == true); if (prj

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.