About 9,760,000 results
Open links in new tab
  1. JavaScript math, round to two decimal places - Stack Overflow

    I have the following JavaScript syntax: var discount = Math.round(100 - (price / listprice) * 100); This rounds up to the whole number. How can I return the result with two decimal places?

  2. javascript - How to round to at most 2 decimal places, if necessary ...

    I'd like to round at most two decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript?

  3. How do I round a number in JavaScript? - Stack Overflow

    The actual one-liner is 'Math.round (number)'. The whole type casting business is unnecessary. In JavaScript strings are automatically coerced to numbers when needed.

  4. How to round float numbers in javascript? - Stack Overflow

    possible duplicate of round number in JavaScript to N decimal places -- please use the search before you ask a new question.

  5. javascript - How to use Math.round to round numbers to the …

    However, I don't need the input 'underBust' to round to the nearest whole number. I need it to round to the nearest EVEN whole number, since bra band sizes only come in even whole …

  6. Avoiding problems with JavaScript's weird decimal calculations

    Avoiding problems with JavaScript's weird decimal calculations Asked 14 years, 8 months ago Modified 2 years, 9 months ago Viewed 66k times

  7. Javascript: formatting a rounded number to N decimals

    It returns a string, not a number. So it doesn't round a number to N decimals, it creates a string that humans can read as a number with decimals. But ony if they, by accident, use the same …

  8. Javascript: Round up to the next multiple of 5 - Stack Overflow

    How about: divide x by 5, round up to the nearest integer (using the Math.ceil function) and then multiply by 5?

  9. Rounding the result of division in Javascript - Stack Overflow

    Sep 5, 2009 · I'm performing the following operation in Javascript: 0.0030 / 0.031 How can I round the result to an arbitrary number of places? What's the maximum number that a var will hold?

  10. How do you round to one decimal place in JavaScript?

    Can you round a number in JavaScript to one character after the decimal point (properly rounded)? I tried the *10, round, /10, but it leaves two decimals at the end of the int.