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.

Round a divided number in Bash

How would I round the result from two divided numbers, e.g. 3/2 As when I do testOne=$((3/2)) $testOne contains "1" when …

linux bash math shell rounding
Rounding a variable to two decimal places C#

I am interested in how to round variables to two decimal places. In the example below, the bonus is usually …

c# variables decimal rounding
C++: Rounding up to the nearest multiple of a number

OK - I'm almost embarrassed posting this here (and I will delete if anyone votes to close) as it seems …

c++ algorithm rounding
SQL Server Group by Count of DateTime Per Hour?

create table #Events ( EventID int identity primary key, StartDate datetime not null, EndDate datetime not null ) go insert into #Events (…

sql-server datetime rounding
How to round 0.745 to 0.75 using BigDecimal.ROUND_HALF_UP?

I tried the following, double doubleVal = 1.745; double doubleVal1 = 0.745; BigDecimal bdTest = new BigDecimal( doubleVal); BigDecimal bdTest1 = new BigDecimal( doubleVal1 ); bdTest = bdTest.…

java bigdecimal rounding
Check if the number is integer

I was surprised to learn that R doesn't come with a handy function to check if the number is integer. …

r integer rounding
Round to 5 (or other number) in Python

Is there a built-in function that can round like the following? 10 -> 10 12 -> 10 13 -> 15 14 -> 15 16 -&…

python rounding
Scala Doubles, and Precision

Is there a function that can truncate or round a Double? At one point in my code I would like …

scala double truncate rounding
Round up to Second Decimal Place in Python

How can I round up a number to the second decimal place in python? For example: 0.022499999999999999 Should round up to 0.03 0.1111111111111000 …

python rounding
Round float to x decimals?

Is there a way to round a python float to x decimals? For example: >>> x = roundfloat(66.66666666666, 4) 66.6667 >&…

python math rounding