Top "Rounding" questions

Rounding a numerical value means replacing it by another value that is approximately equal but has a shorter, simpler, or more explicit representation.

In Python, what is a good way to round towards zero in integer division?

1/2 gives 0 as it should. However, -1/2 gives -1 , but I want it to round towards 0 (i.e. I want -1/2 …

python rounding division negative-number integer-division
Rounding Standards - Financial Calculations

I am curious about the existence of any "rounding" standards" when it comes to the calculation of financial data. My …

rounding financial rounding-error bankers-rounding
java integer rounding (division related)

I have run into a surprise with integer division not rounding down as expected. Simple code: public class HelloMath { public …

java integer rounding division truncation
How can I make sure a float will always be rounded up with PHP?

I want to make sure a float in PHP is rounded up if any decimal is present, without worrying about …

php floating-point rounding precision ceil
ERROR: function round(double precision, integer) does not exist

I am in the middle of migration some queries which have been running for ages with MySQL database which is …

sql postgresql rounding postgres-10
Round minutes to ceiling using Java 8

So I'm lucky enough to use Java 8 and the new time APi but I don't see any rounding functions... Basically …

datetime java-8 rounding java-time ceil
How to properly display a price up to two decimals (cents) including trailing zeros in Java?

There is a good question on rounding decimals in Java here. But I was wondering how can I include the …

java double rounding decimal-point
round BigDecimal to nearest 5 cents

I'm trying to figure out how to round a monetary amount upwards to the nearest 5 cents. The following shows my …

java rounding bigdecimal
Rounding a double to 5 decimal places in Java ME

How do I round a double to 5 decimal places, without using DecimalFormat?

java java-me rounding
How to Java String.format with a variable precision?

I'd like to vary the precision of a double representation in a string I'm formatting based on user input. Right …

java string rounding precision floating-accuracy