About 136,000 results
Open links in new tab
  1. python - How do you round UP a number? - Stack Overflow

    May 5, 2017 · How does one round a number UP in Python? I tried round (number) but it rounds the number down. Here is an example: round (2.3) = 2.0 and not 3, as I would like. Then I tried int …

  2. python - Round number to nearest integer - Stack Overflow

    As @plowman said in the comments, Python's round() doesn't work as one would normally expect, and that's because the way the number is stored as a variable is usually not the way you see it on …

  3. Why does Python 3 round half to even? - Stack Overflow

    The Python 3 approach eliminates this issue. There is more than one method of rounding in common use. IEEE 754, the international standard for floating-point math, defines five different rounding …

  4. python - How to round a floating point number up to a certain decimal ...

    Jan 22, 2015 · Here, num is the decimal number. x is the decimal up to where you want to round a floating number. The advantage over other implementation is that it can fill zeros at the right end of …

  5. Rounding decimals with new Python format function

    Nov 9, 2011 · How do I round a decimal to a particular number of decimal places using the Python 3.0 format function?

  6. How to round to 2 decimals with Python? [duplicate]

    Dec 9, 2013 · If you just want to print the rounded result out, you can use the f-strings introduced since Python 3.6. The syntax is the same as str.format() 's format string syntax, except you put a f in front …

  7. python - Limiting floats to two decimal points - Stack Overflow

    Jan 19, 2009 · From Python 3 documentation page: Note The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68.

  8. round() doesn't seem to be rounding properly - Stack Overflow

    The documentation for the round() function states that you pass it a number, and the positions past the decimal to round. Thus it should do this: n = 5.59 round(n, 1) # 5.6 But, in actuality, good...

  9. python - Simple way to round floats when printing - Stack Overflow

    Apr 23, 2015 · Simple way to round floats when printing Asked 10 years, 7 months ago Modified 9 years ago Viewed 16k times

  10. python - Rounding floats with f-string - Stack Overflow

    But either way, this title "Rounding floats with f-string" and tagging python-3.6 is much better, clearer, wording, legible and better search keyword coverage or duplicate than "Convert floating point …