rounding Questions

2

Solved

I want to calculate memory sizes and need rounding functionality - but my ansible does not behave as documentation claims it should. This is my playbook: - debug: msg: "need to configure swa...
Eulogia asked 25/3, 2021 at 15:41

14

Solved

I have a Double variable that is 0.0449999 and I would like to round it to 1 decimal place 0.1 . I am using Kotlin but the Java solution is also helpful. val number:Double = 0.0449999 I tried ge...
Mozzetta asked 27/2, 2018 at 15:9

27

Solved

I was curious to know how I can round a number to the nearest whole number. For instance, if I had: int a = 59 / 4; which would be 14.75 if calculated in floating point; how can I store the resu...
Zettazeugma asked 11/3, 2010 at 5:20

25

Solved

Consider the four percentages below, represented as float numbers: 13.626332% 47.989636% 9.596008% 28.788024% ----------- 100.000000% I need to represent these percentages as whole numbers...
Shea asked 20/11, 2012 at 22:38

4

Solved

I have a dataframe of floats and I need make a function that will take a column and round all the values to N number of significant figures So the column might look something like: 123.949 23.87...
Erratic asked 21/8, 2019 at 10:54

20

Solved

I need to round for example 6.688689 to 6.7, but it always shows me 7. My method: Math.round(6.688689); //or Math.round(6.688689, 1); //or Math.round(6.688689, 2); But result always is the sam...
Immunogenetics asked 26/2, 2012 at 13:21

10

Solved

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 the values nor the decimal places will be, c...
Jarboe asked 11/9, 2012 at 0:30

9

I am having trouble rounding a GPA double to 2 decimal places. (ex of a GPA needed to be rounded: 3.67924) I am currently using ceil to round up, but it currently outputs it as a whole number (368)...
Vulgus asked 19/9, 2014 at 2:9

4

I am sinking output from a linear model, and trying to tidy it up as it is sinked by rounding the parameters I am interested in to 2 decimal places. This is fine for most parameters like beta or Z-...
Peg asked 14/7, 2017 at 14:54

3

I wish to only round values in the DataFrame for display purposes, when I use head() or tail() but I want the DataFrame to retain the original values. I tried using the round method but it changes ...
Slung asked 7/7, 2017 at 6:17

24

Solved

I am facing a strange behavior of the round() function: for i in range(1, 15, 2): n = i / 2 print(n, "=>", round(n)) This code prints: 0.5 => 0 1.5 => 2 2.5 => 2 3.5 => 4 4.5 =...
Interlanguage asked 8/10, 2015 at 15:11

9

Solved

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 to be 0), regardless of whether it's positive or negative. What is the best way to d...

5

Solved

I am in the middle of migrating some queries which have been running for ages with MySQL database which is now in Postgres having the same structure. I got stuck with a simple round function which ...
Sulfamerazine asked 6/11, 2019 at 14:3

4

Solved

I want to round off my decimal values as below: 7,715.625 becomes 7,716 How do I achieve this?
Amido asked 11/9, 2009 at 8:53

17

Solved

How can I round values to nearest integer? For example: 1.1 => 1 1.5 => 2 1.9 => 2 "Math.Ceiling()" is not helping me. Any ideas?
Macrospore asked 13/1, 2012 at 1:11

5

What would be the simplest formula to implement int divround(int a, int b) {...}, in C, where output is a/b with banker's rounding (round half to even)? For example, divround(3,2) and divround(5,2)...
Giffard asked 3/9, 2023 at 2:28

7

Solved

How can I do math involving significant figures in C++? I want this to work correct with measured data from chemistry and physics experiments. An example: 65 / 5 = 10. I would need to get rid of un...
Apothegm asked 5/1, 2011 at 17:58

32

Solved

I have float numbers like 3.2 and 1.6. I need to separate the number into the integer and decimal part. For example, a value of 3.2 would be split into two numbers, i.e. 3 and 0.2 Getting the integ...
Callean asked 22/12, 2010 at 18:20

25

Solved

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.
Jampan asked 8/9, 2011 at 3:55

18

Solved

I need to convert minutes to hours, rounded off to two decimal places. I also need to display only up to two numbers after the decimal point. So if I have minutes as 650, then hours should be 10.83...
Redding asked 30/4, 2012 at 7:48

3

Solved

So, I was searching for ways to round off all the numbers in a numpy array. I found 2 similar functions, numpy.round and numpy.around. Both take seemingly same arguments for a beginner like me. S...
Serviceberry asked 12/3, 2018 at 6:55

25

Solved

Lets say I have a value of 3.4679 and want 3.46, how can I truncate that to two decimal places without rounding up? I have tried the following but all three give me 3.47: void Main() { Console.Wri...
Isaak asked 29/6, 2010 at 18:32

16

I want to do this using the Math.Round function
Summation asked 2/11, 2008 at 16:7

4

Solved

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.0 Thanks in advance for any help.
Nudibranch asked 13/5, 2010 at 11:11

9

Solved

How can I multiply two decimals and round the result down to 2 decimal places? For example if the equation is 41.75 x 0.1 the result will be 4.175. If I do this in c# with decimals it will automat...
Lawmaker asked 23/11, 2012 at 1:26

© 2022 - 2025 — McMap. All rights reserved.