RadNumericTextBox 3.97 = 3.9699999999999997

4 posts, 0 answers
  1. Douglas R.
    Douglas R. avatar
    6 posts
    Member since:
    Sep 2007

    Posted 28 Sep 2009 Link to this post

    Go to the demo page at http://demos.telerik.com/aspnet-ajax/input/examples/radnumerictextbox/firstlook/defaultvb.aspx
    Change decimal digits to 2.
    Enter 3.97 in the text box.
    Value is displayed as 3.9699999999999997

    This is also occuring with control.set_value(3.97)

    Has this been fixed?

    Thanks ... Douglas
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Sep 2009 Link to this post

    Hi Douglas,

    I found the following forum link which discusses on are removing digits after two places from the decimal point using javascript. Probably this can help you out:
    Rounded value after 2 decimal digit

  3. Martin
    Martin avatar
    833 posts

    Posted 01 Oct 2009 Link to this post

    Hello Douglas and  Princy,

    It seems that this issue is caused by the way Javascript engine calculates some decimal numbers. For example you can try this code:

    function pageLoad(sender,atgs) 
                    alert(2 + 0.97); 

    Our devs built a temporary workaround for this erroneous behavior. To implement it you should:

      1.  Add the following code to the markup of your page:

    <script type="text/javascript" src="inputRoundingFix.js"

      2.  Add the needed Javascript file into your project folder. You can find the file attached.

    We will imlpement this functionality in the next internal build which will be available for download from the latest internal build section in the next few days.
    Alternatively you could wait for the official release of RadControls for ASP.NET AJAX - Q3 2009 which is due for the first week of November.

    I hope this helps.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. Douglas R.
    Douglas R. avatar
    6 posts
    Member since:
    Sep 2007

    Posted 11 Nov 2009 Link to this post

    I waited for Q3 2009 and while it does fix this issue, addtional issues have arisen (50% CPU utilization, focus not working, can't scroll pages, etc).  So, I went back to Q2 2009 and tried the included script -- works great (just have to include it near the /form tag).
Back to Top