how to round up

3 posts, 1 answers
  1. kako
    kako avatar
    36 posts
    Member since:
    Mar 2015

    Posted 19 Feb Link to this post

    Is there how to round up the value ?

     ex) 16.543 → 16.55

    I can only set rounding or truncation for the "round" option...

  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1994 posts

    Posted 20 Feb Link to this post

    Hi Kako,

    By default a value is rounded up if the next digit is bigger than or equal to 5. For example 1.245 will be rounded to 1.25 and 1.243 will be rounded to 1.24. In order to change that behavior you would need to use custom logic. I can suggest handling the change event and round the entered value manually.

    The dojo example below illustrates the approach:


    Give it a try and let me know how it works for you.

    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. kako
    kako avatar
    36 posts
    Member since:
    Mar 2015

    Posted 05 Mar Link to this post

    It worked as expected. Thanks!
Back to Top