Questions tagged [rounding]

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

Rounding a numerical value means replacing it by another value that is approximately equal but has a shorter, simpler, or more explicit representation; for example, replacing £23.4476 with £23.45, or the fraction 312/937 with 1/3, or the expression √2 with 1.414.

5484 questions
2
votes
0 answers

Why the variance-covariance matrix of `glmer` in R is not symmetric?

I don't understand how a variance-covariance matrix may not be symmetric. Is it due to the way the numbers are rounded? If we take the example presented on the merDeriv package to get the full variance-covariance matrix (fixed and random…
Flora Grappelli
  • 659
  • 9
  • 26
2
votes
3 answers

Round to the next whole number javascript

I want to achieve something like this in JavaScript: input = 2455.55 f(input) = 2456 f(input) = 2460 f(input) = 2500 f(input) = 3000 f(input) = 2455.55 I am using the Math.round() method for now but only get to 2,546 with it. Wondering if there is…
Manon
  • 23
  • 3
2
votes
2 answers

When I use Math.Round() it always returns the lower bound

I am making a maths project where the user answers questions based on the difficulty level they select! But every time the question is a division question It returns the lower-bound. For example, if the code asked what is "5/3" the answer should be…
qqqqqkks
  • 62
  • 16
2
votes
1 answer

Converting string to double keeps rounding to the whole number

I am trying to convert a string decimal number into a double, however when I use the atof() function, my number ends up rounding to the whole number. #include #include using namespace std; int main() { string num =…
ndiaz252
  • 23
  • 3
2
votes
1 answer

Round df values but exclude given row if named "x"

Is there an easy way to round df values but exclude a given row based on name? This is how I am rounding the values in my df: #multiply value by 100 then round df = df.applymap(lambda x: int(round(x*100))) However, I want to exclude "Mean" from…
Boosted_d16
  • 13,340
  • 35
  • 98
  • 158
2
votes
0 answers

Rounding in R and IEEE 754

Context R's help() function indicates that round() adheres to a standard that is identical to IEEE 754: round halves to even. Wikipedia describes this standard with the following example: 23.5 becomes 24 and 24.5 becomes 24. help() also states,…
Tantillo
  • 367
  • 1
  • 5
2
votes
0 answers

Does the decimal scale value replace rounding in SQL Server?

Considering this code: DECLARE @Price AS DECIMAL(25,10) = 1231234.9898989142 DECLARE @TABLE AS TABLE ( Number DECIMAL(19,4) ) INSERT INTO @TABLE VALUES (@Price) SELECT * FROM…
2
votes
1 answer

How to correctly count allocated memory

I have that task: Assume that in addition to the scaling factor, there is a factor responsible for deallocating unnecessary memory after removing elements from the list. You will be given two factors: one for increasing and one for reducing the…
Konstantin
  • 35
  • 5
2
votes
2 answers

Try to round 17.775

I tried almost all the solutions to round to decimals none of them working (round(100 * 17.775)/100) results I am getting is 17.77 I need 17.78 as a result of round Please provide me the solution. *NOTE : This question is only to round 17.775…
2
votes
1 answer

round() does not trucate float

I don't understand why this happens, value l/m does not get truncated to two decimals after the dot... root@OpenWrt:~# python3 Python 3.7.4 (default, Sep 15 2019, 18:13:03) [GCC 7.4.0] on linux Type "help", "copyright", "credits" or "license" for…
novski
  • 196
  • 1
  • 11
2
votes
4 answers

How to correct for inaccurate Javascript math with math.round()?

I posted this code a couple days back, but the discussion seemed to wax philosophical about the weaknesses of Javascript (not to mention my own obvious weaknesses as a "programmer") and then died out without ever clarifying a solution. I'm hoping…
user719431
  • 55
  • 2
  • 6
2
votes
1 answer

Rounding alternate edges in Kivy

I did saw other solutions where they use up and down images. Which I found very complex for making alternate rounded edges. Like this one below:
Ritveak
  • 2,930
  • 2
  • 13
  • 28
2
votes
1 answer

Is it possible to round to an integer AND remove the decimal point in an array in python

After rounding to an integer the result of operations between lists that produce an array is there a way to remove the decimal point? I am using python in Jupyter notebooks. Should I use something other than 'np.round'? 'FoodSpent and 'Income' and…
chenderson
  • 35
  • 1
  • 5
2
votes
1 answer

How to round dates and times to dates and times in 45-minute intervals

I have a dataframe which contains a variable called DateTime with data about date and time. Below I show an example: df<- data.frame(DateTime=c("2016-08-23 00:22:23","2016-08-23 00:26:38","2016-08-23 01:04:12","2016-08-23 02:27:58","2016-08-23…
Dekike
  • 1,264
  • 6
  • 17
2
votes
0 answers

Converting uint64_t to double both up and down

I seek to convert a uint64_t to double. The problem is that uint64_t is not neccessarily exactly representable as a double for large uint64_t. So instead I want a range containing lowest and highest doubles surrounding the uint64_t. So if a cast…
Bomaz
  • 1,871
  • 1
  • 17
  • 22
1 2 3
99
100