Web Analytics Made Easy -
StatCounter How do I round a number? - CodingForum

Announcement

Collapse
No announcement yet.

How do I round a number?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I round a number?

    Hi,

    I have to calculate a amount field based on the below formula,


    installamountto=netamountto/term.

    The output sometimes can come like


    3.3333333,or 45.777777,etc.It can be any value but i want to round the decimal to only 2 digits or suppose for example if the value is 45.45,round it to 45.5.


    How do i achieve this using javascript.

    Thanks

    Rama

  • #2
    Check out the following tutorial on JavaScriptKit: http://www.javascriptkit.com/javatutors/round.shtml

    Hope it helps,
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

    Comment


    • #3
      rounding ofnumbers

      Hi,

      Tutorial was useful .thank u.


      Rama

      Comment

      Working...
      X