rounding Questions

2

I have this code in VBA that needs to be in Python. I'm new to Python, sorry for that. Sub cdec_test() Dim val1, val2, result1, result2, x1, x2 As Variant val = CDec(5930 / 3000) 'val1 : 1.97666666...
Peacetime asked 23/8 at 17:50

9

What would be an elegant, efficient and Pythonic way to perform a h/m/s rounding operation on time related types in Python with control over the rounding resolution? My guess is that it would requ...
Copula asked 24/7, 2011 at 11:21

7

Solved

I know it's really stupid question, but I don't know how to do this in bash: 20 / 30 * 100 It should be 66.67 but expr is saying 0, because it doesn't support float. What command in Linux can re...
Carmencita asked 10/8, 2009 at 9:48

4

Solved

In Excel, I would like to round to the nearest fibonacci number. I tried something like (sorry with a french Excel): RECHERCHEH(C7;FIBO;1;VRAI) -- HLOOKUP(C7, FIBO, 1, TRUE) where FIBO is a nam...
Lightweight asked 28/6, 2011 at 15:47

8

Solved

round(45.923,-1) gives a result of 50. Why is this? How it is calculated? (sorry guys i was mistaken with earlier version of this question suggesting value was 46)
Shingle asked 10/7, 2009 at 10:6

4

I'm working with floating point numbers. If I do: import numpy as np np.round(100.045, 2) I get: Out[15]: 100.04 Obviously, this should be 100.05. I know about the existence of IEEE 754 and t...
Hierogram asked 16/5, 2018 at 15:25

8

Solved

While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of Name : Value Name2 : Value2 etc. The peoblem is that the values...
Thaw asked 29/10, 2008 at 9:14

3

Solved

I'm using Java with Jasper Reports and would like to format a decimal value using this format mask "#,##0.00". At the first sight all looks fine, but I found that my decimal values are rounded usin...
Bellamy asked 3/6, 2013 at 14:36

2

Series I'm working with: import pandas as pd from decimal import Decimal, BasicContext df = pd.Series([14978.22, 16025.429160000002, 209.97803999999996, 618.20369, 605.607, 1431.0916, 30.53575, 2...
Incombustible asked 10/8, 2018 at 20:7

2

Solved

Is it possible to round up to the nearest whole number in R? I have time-stamped data and I want to round up to the nearest whole minute, to represent activities during this minute. For example, i...
Carberry asked 17/4, 2017 at 3:34

4

Solved

var calcTotalprice = function () { var price1 = parseFloat($('#price1').html()); var price2 = parseFloat($('#price2').html()); overall = (price1+price2); $('#total-amount').html(overall); } va...
Brandon asked 2/12, 2012 at 18:0

4

Solved

I have a numpy array, something like below: data = np.array([ 1.60130719e-01, 9.93827160e-01, 3.63108206e-04]) and I want to round each element to two decimal places. How can I do so?
Dynamiter asked 28/10, 2017 at 20:59

6

Solved

How do I round the result of time() up (towards the future) to the next multiple of 5 minutes?
Myca asked 13/4, 2012 at 23:59

15

Which is the best efficient way to round up a number and then truncate it (remove decimal places after rounding up)? for example if decimal is above 0.5 (that is, 0.6, 0.7, and so on), I want to r...
Proffer asked 19/8, 2013 at 11:54

6

Solved

Ive been looking for a proper rounding mechanism but nothing I find seems to be exactly what I need. I need to round up and round down seperately and I also need to account for the the case when i...
Mojave asked 6/7, 2012 at 14:46

4

Solved

I Want to round 1.006 to two decimals expecting 1.01 as output When i did var num = 1.006; alert(Math.round(num,2)); //Outputs 1 alert(num.toFixed(2)); //Output 1.01 Similarly, var num =1.106...
Intimacy asked 27/2, 2013 at 17:39

11

Solved

I know you can use .cornerRadius() to round all the corners of a SwiftUI view but is there a way to round only specific corners such as the top?
Ancell asked 25/6, 2019 at 18:50

7

Solved

How to round up a decimal number to a whole number. 3.50 => 4 4.5 => 5 3.4 => 3 How do you do this in Java? Thanks!
Sightless asked 9/7, 2012 at 14:5

93

Solved

I'd like to round at most two decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript?
Maybe asked 6/8, 2012 at 17:17

6

Solved

After a series of calculations in my code, I have a BigDecimal with value 0.01954 I then need to multiply this BigDecimal by 100 and I wish the calculated value to be 1.95 I do not wish to perfor...
Blunk asked 17/6, 2014 at 20:36

11

Solved

Seems that should have already been asked hundreds (pun are fun =) of times but i can only find function for rounding floats. How do I round up an integer, for example: 130 -> 200 ?
Selden asked 14/1, 2012 at 22:52

8

Solved

I have a list of numbers which I need to round into integers before I continue using the list. Example source list: [25.0, 193.0, 281.75, 87.5, 80.5, 449.75, 306.25, 281.75, 87.5, 675.5,986.125, 3...
Microfiche asked 26/2, 2016 at 12:14

31

Solved

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(number + .5) but i...
Floriaflorian asked 1/3, 2010 at 14:40

27

Solved

I need to round a float to be displayed in a UI. e.g, to one significant figure: 1234 -> 1000 0.12 -> 0.1 0.012 -> 0.01 0.062 -> 0.06 6253 -> 6000 1999 -> 2000 Is there a ni...
Nesselrode asked 5/8, 2010 at 0:48

7

Solved

I want to round like this 42949672 -> 42949700, 2147483647 -> 2147480000, 4252017622 -> 4252020000 etc. I tried to use following , but only works for the first one. How can I make a more general o...
Deadlight asked 18/7, 2017 at 23:10

© 2022 - 2024 — McMap. All rights reserved.