# tagged [rounding]

#### Round float to x decimals?

Round float to x decimals? Is there a way to round a python float to x decimals? For example: I've found ways to trim/truncate them (66.666666666 --> 66.6666), but not round (66.666666666 --> 66.6667)...

#### How to round float numbers in javascript?

How to round float numbers in javascript? I need to round for example `6.688689` to `6.7`, but it always shows me `7`. My method: But result always is the same `7`... What am I doing wrong?

- Modified
- 5 Jun at 01:13

#### Round double in two decimal places in C#?

Round double in two decimal places in C#? I want to round up double value in two decimal places in c# how can i do that? after round up ### Related: c# - How do I round a decimal value to 2 decimal pl...

#### Rounding integer division (instead of truncating)

Rounding integer division (instead of truncating) I was curious to know how I can round a number to the nearest whole number. For instance, if I had: which would be 14.75 if calculated in floating poi...

- Modified
- 19 Mar at 02:12

#### How to round up value C# to the nearest integer?

How to round up value C# to the nearest integer? I want to round up double to int. Eg, I want to change them both to integer. so that `aa` is from `a` and `bb` is from `b`. Any formula to do that?

#### Limiting floats to two decimal points

Limiting floats to two decimal points I want `a` to be rounded to . I tried using [round](https://docs.python.org/2/library/functions.html#round), but I get: --- [How can I format a decimal to always ...

- Modified
- 23 Sep at 14:4

#### Round a decimal to the nearest quarter in C#

Round a decimal to the nearest quarter in C# Is there a simple way in c# to round a decimal to the nearest quarter i.e. x.0, x.25, x.50 x.75 for example 0.21 would round to 0.25, 5.03 would round to 5...

#### C# Rounding MidpointRounding.ToEven vs MidpointRounding.AwayFromZero

C# Rounding MidpointRounding.ToEven vs MidpointRounding.AwayFromZero In C# Is there any difference in the accuracy of the two decimal rounding strategies `MidpointRounding.ToEven` and `MidpointRoundin...

- Modified
- 9 Sep at 10:41

#### Show a number to two decimal places

Show a number to two decimal places What's the correct way to round a PHP string to two decimal places? The output should be `520.00`; How should the `round_to_2dp()` function definition be?

- Modified
- 7 Sep at 20:16

#### Rounding a variable to two decimal places C#

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 a number with four decimal places. Is there any...

#### round() for float in C++

round() for float in C++ I need a simple floating point rounding function, thus: I can find `ceil()` and `floor()` in the math.h - but not `round()`. Is it present in the standard C++ library under an...

- Modified
- 16 Mar at 01:55

#### Round to nearest five

Round to nearest five I need to round a double to nearest five. I can't find a way to do it with the Math.Round function. How can I do this? What I want: and so on.. Is there an easy way to do this?

#### Round a floating-point number down to the nearest integer?

Round a floating-point number down to the nearest integer? I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I want to round down the varia...

- Modified
- 25 Feb at 14:44

#### How can I round down a number in Javascript?

How can I round down a number in Javascript? How can I round down a number in JavaScript? `math.round()` doesn't work because it rounds it to the nearest decimal. I'm not sure if there is a better way...

- Modified
- 26 Apr at 10:36

#### round value to 2 decimals javascript

round value to 2 decimals javascript I have a small issue with the final value, i need to round to 2 decimals. Any help is appreciated. Solution: `$(pri).val(Mat

#### How can I round up the time to the nearest X minutes?

How can I round up the time to the nearest X minutes? Is there a simple function for rounding a `DateTime` to the nearest 15 minutes? E.g. `2011-08-11 16:59` becomes `2011-08-11 17:00` `2011-08-11 17:...

#### How to round down to nearest integer in MySQL?

How to round down to nearest integer in MySQL? How would I round down to the nearest integer in MySQL? Example: `12345.7344 rounds to 12345` mysql's `round()` function rounds up. I don't know how long...

#### In jQuery, what's the best way of formatting a number to 2 decimal places?

In jQuery, what's the best way of formatting a number to 2 decimal places? This is what I have right now: It looks messy to me. I don't think I'm chaining the functions correctly. Do I have to call it...

- Modified
- 21 Apr at 05:22

#### Round up to Second Decimal Place in Python

Round up to Second Decimal Place in Python How can I round up a number to the second decimal place in python? For example: Should round up to `0.03` Should round up to `0.12` If there is any value in ...

#### C++: How to round a double to an int?

C++: How to round a double to an int? I have a double (call it x), meant to be 55 but in actuality stored as 54.999999999999943157 which I just realised. So when I do y = 54 instead of 55! This puzzle...

- Modified
- 2 Feb at 13:30

#### Rounding values up or down in C#

Rounding values up or down in C# I've created a game which gives a score at the end of the game, but the problem is that this score is sometimes a number with a lot of digits after the decimal point (...

#### Decimal.Round default setting for MidpointRounding

Decimal.Round default setting for MidpointRounding The following applies: This, to me, is wrong and unexpected behavior. I would assume the value of to be . To achieve this, I can do: How can this be ...

#### Using Math.round to round to one decimal place?

Using Math.round to round to one decimal place? I have these two variables Then I did this expression but I end up with 27.0. In fact I have many other variables and when I use them in the expression ...

#### How do I format a double to currency rounded to the nearest dollar?

How do I format a double to currency rounded to the nearest dollar? Right now I have This will give me but I don't want the ".00". I know I can just drop the last three characters of the string every...

- Modified
- 15 Nov at 09:19

#### C# - Math.Round

C# - Math.Round I am trying to understand how to round to the nearest tenths position with C#. For instance, I have a value that is of type double. This double is currently set to 10.75. However, I ne...