FAQ Database Discussion Community

## Round numbers to next int, hundred and thousand in c# [closed]

c#,math,rounding
I´m triying to round on c# different numbers according to some conditions: if number is between 0 and 100, round it to nearest integer. Ex: 8.4 = 8, 8.6 = 9 if number is between 101 and 10000, round it to nearest hundred. Ex: 1545 = 1500, 1551 = 1600...

## Math rounding up (solved) [closed]

c#,rounding
I need some help with rounding 0,73 to 73 with math.round I am having troubles finding out how. Teacher wants me to make a method that takes in a decimal and return an integer. Yes with Math.Round (); . On C#

## HTML text input rounded when numbers entered

html,input,numbers,rounding
i'm developing a PHP application and i have one problem when i use HTML text inputs, and this is the first time where i deal with this case. When i try to insert a float value as 34.4 in HTML text input to put it in MySQL DB, but when...

## Rounding a number while using string formatting in python

python,string,formatting,rounding
I'm wondering how to round a number in python while using string formatting. In my code, I used %r instead of %d, beacuse %d prints an interger. How do I round the numbers while using %r? I would like to have my numbers rounded to two decimal places. def new_formula(value):...

## Perl5 formline round down the exact value 0.5 not round up

perl,rounding
I have noticed that the formline method in Perl 5 have some strange action. If the decimal value greater than 0.5, it will round up. If the decimal value less than 0.5, it will round down. But when the decimal value is exact 0.5, we normally should round up but...

## How do i rest the variable applied to BigDecimal

java,rounding,bigdecimal
I am writing a test program to test the RoundingMethod for BigDecimal. I am relatively new to Java (I've only been at it for five days!!) . I have written a class in DrJava to test this but having assigned pp as the variable for BigDecimal , how do i...

## Java, MySQL or PHP - rounding down minutes to the next 10 minutes [closed]

java,php,mysql,datetime,rounding
I want to round down current time in 10 minutes block. I can do so either on Java, php or mysql (preferably), whatever is considered better. For example: 08:49:50 -> 08:40:00 14:23:12 -> 14:20:00 09:32:11 -> 09:30:00 12:20:00 -> 12:20:00 I tried to solution from Round date to 10 minutes...

## Nearest multiple of a power of two fraction

java,double,rounding
Is there an optimized, performant way to round a double to the exact value nearest multiple of a given power of two fraction? In other words, round .44 to the nearest 1/16 (in other words, to a value that can be expressed as n/16 where n is an integer) would...

## C++ rounding behavior

c++,linux,g++,rounding
#include <iostream> #include <iomanip> int main() { float f = 0.115; std::cout << f << std::endl; std::cout << std::fixed << std::setprecision(2) << f << std::endl; return 0; } The output of the above code is: 0.115 0.12 It makes sense that 0.115 is rounded to 0.12. However, when we change...

## Can someone please explain this JavaScript decimal rounding function in detail?

javascript,function,rounding,deciphering
function Round2DecimalPlaces(l_amt) { var l_dblRounded = +(Math.round(l_amt + "e+2") + "e-2"); return l_dblRounded; } Fiddle: http://jsfiddle.net/1jf3ut3v/ I'm mainly confused on how Math.round works with "e+2" and how addition the "+" sign to the beginning of Math.round makes any difference at all. I understand the basic of the function; the decimal...

## How to round to zero decimals if there is no decimal value with Jinja2?

I building a website using the (excellent) Flask framework in which I now want to display some numbers. The round filter provided by jinja2 works fine, except for when there is no decimal value: {{ 1.55555|round(2) }} -> 1.56 {{ 1.5|round(2) }} -> 1.5 {{ 1.0|round(2) }} -> 1.0 {{...

## EXCEL - incorporating ROUND to IF statement

excel,if-statement,excel-formula,rounding
I'm trying to calculate accurate capscrew lengths between to connections where one side is drill & tap and the other is a flange. For some reason I can't post the image; essentially I've got a bunch of dimensions from B4 through B10 with a yes or no on B8 followed...

## How to do a special type of rounding in excel/vba

excel,vba,rounding
I have to do a special type of rounding in excel for my school project. If the number is bigger than #.5 I have to round it up. If the number is equal to #.5 I have to round it to the nearest even number. If the number is less...

## MySQL database updates to the round decimal

python,mysql,decimal,rounding,mysql-python
I am using Python 2.7 and MySQLdb. I am trying to update and set as the number the decimal I have set as data but what I get is an the closest integer. This is the code: Value = 5 data = 5 data = data + 0.5 print(data) x.execute("""...

## The same (int)doubles round up and down in Java

java,int,double,rounding,mouselistener
I'm having the weirdest problem with my game in java. :| I can get around it, so I will be able to continue on this game without a solution, but I just thought it was really weird. It's a 2D Minecraft-ish (I know, I know, it's just for practice) game,...

## How to rounding up in oracle

oracle,rounding
I want to convert this value "2167.124" to "2167.13" using round function in oracle 11g. Problem is that it converts LIKE "2167.12" But i need "2167.13". Please help, Thanks in advance...

## why does _mm_mulhrs_epi16() always do biased rounding to positive infinity?

rounding,sse
Does anyone know why the pmulhrsw instruction or _mm_mulhrs_epi16(x) := RoundDown((x * y + 16384) / 32768) always rounds towards positive infinity? To me, this is terribly biased for negative numbers, because then a sequence like -0.6, 0.6, -0.6, 0.6, ... won't add up to 0 on average. Is this...

## php round a number [duplicate]

php,variables,rounding
This question already has an answer here: PHP: show a number to 2 decimal places 11 answers I have a variable \$amount = 621.00; I need the 30% of the variable with output 186.30 When I calculate: \$amount2 = round(\$amount*30/100 , 2); echo \$amount2 gives the output of 186.3...

## Java Dealing with Double values having E [closed]

java,string,math,rounding,number-formatting
Suppose that I have: double Nc= 7.6695805E-4; NumberFormat formatter = new DecimalFormat("0.00000000000"); String string = formatter.format(Nc); System.out.println(string); the output would be: 0.00076695805 But it is place in string type variable! What i have to do is to convert it into double or float or long so that it should remain...

## Java: double rounding algorithm

java,floating-point,rounding
I got curious about a rounding algorithm, because in CS we had to emulate an HP35 without using the Math library. We didn't include a rounding algorithm in our final build, but I wanted to do it anyway. public class Round { public static void main(String[] args) { /* *...

## What is the best way to round numbers in Clojure?

clojure,rounding
This is an easy one. But anyway, I think it is a good idea to have this question answered here for a faster, easier reference. This operation: (/ 3 2) yields this: 3/2 I need one function to round up, which would yield 2 and another one to round down,...

## “(int)Math.ceil(double)” always return 1 when values is greater than 0

java,casting,int,double,rounding
I'm creating an Android app and I need to calculate the movement speed of the device. I do this by taking an average of some earlier locations' speeds. However, I need the speed to be in km/h as an int, so I use (int)Math.ceil(speedAsDouble) However, this always equal to 1,...

## Simplest Way of Rounding Up the Average in C++

c++,rounding
int a, b, c = 0; c = (a+b)/2; In this code, if both "a" and "b" are even (Example 1), then there's no problem. But if one of them is odd (Example 2), then the answer will have +0.5. I want to round it up. Example 1. a=4, b=10...

## How to round a float up on 5 [duplicate]

python,c++,python-2.7,rounding
This question already has an answer here: Limiting floats to two decimal points 11 answers So I was surprised I didn't find anything regarding this. I have a python script which is testing a C++ program. It needs to format a float in the same way std::setprecision does. That...

## How to get a pizza program to round to a full pizza In PYTHON [duplicate]

python,math,rounding
This question already has an answer here: How do you round UP a number in Python? 9 answers Python round up integer to next hundred 6 answers so i'm making a pizza program in Python 3.3 that takes input from the user and prints the amount of pizza's needed....

## “width: calc(100% / 3);” not working properly in any IE

css,internet-explorer,width,rounding,calc
I have a 3 column layout that should fill the whole screen so on my columns I am using: width: calc(100% / 3); So lets say for example my screen is 782px wide: 782 / 3 = 260.66̅ However the problem I have is in Internet Explorer, where it rounds...

## PHP Round With Decimal & Comma \$1,000

php,rounding,number-formatting
<?= round(number_format(\$vehicle->prices['total_rental'], 2, '.', ',') * 0.50,2) ?> I would like the output to round up to the next 2 decimal places (for money / dollars & cents). This works great when \$vehicle->prices is below \$1,000. When \$vehicle->prices is above \$1,000, it just outputs .50. What is the correct way...

## Rounding small floating point numbers in R

r,rounding
Suppose I have a numeric vector which I'd like to round to 'prettier' numbers, such as: vec <- c(1.739362e-08,8.782537e-08,0.5339712) I'd like it to be: pretty.vec <- c(1.74e-08,8.78e-08,0.53) How do I achieve that? using round doesn't really help since it rounds the first two elements to 0: > round(vec,2) [1] 0.00...

## What is the cleanest way to round a value to nearest 45 degrees?

language-agnostic,rounding
I have the same question as the question here. The user asked: I just wrote this to return the nearest 45 degree angle. Like 0, 45, 90, 135... It feels like there must be a better way of doing this though. This is working fine but it looks messy. public...

## What's an efficient way to round a signed single precision float to the nearest integer?

floating-point,rounding,msp430
float input = whatever; long output = (long)(0.5f + input); This is inefficient for my application on an MSP430, using the compiler-supplied floating point addition support library. I'm musing that there may likely be a clever 'trick' to this particular kind of 'nearest integer' rounding, avoiding plain floating point addition...

## Math.round MidPointRounding.AwayFromZero in javascript

javascript,c#,math,rounding
I wanted to get the same result in javascript from this line in c#: round = Math.Round((17245.22 / 100), 2, MidpointRounding.AwayFromZero); // Outputs: 172.45 I've tried this but no success: var round = Math.round(value/100).toFixed(2); Thanks in advance :)...

## Why does HALF_UP sometimes round down with double?

java,rounding
The following code: double doubleValue = 1713.6; float floatValue = 1713.6f; String fs = "%-9s : %-7s %-7s\n"; System.out.printf( fs, "", "double", "float" ); DecimalFormat format = new DecimalFormat("#0"); System.out.printf( fs, "toString", String.valueOf( doubleValue ), String.valueOf( floatValue ) ); format.setRoundingMode( RoundingMode.DOWN ); System.out.printf( fs, "DOWN", format.format( doubleValue ), format.format( floatValue...

## Round to whole numbers without using conditional statements in Python - Logic

python,logic,rounding,number-rounding
I'm taking a Python course at Udacity, and I'm trying to work this out for myself without looking at the answer. Perhaps you can give me a hint for my logic? Below are the instructions and what I have so far. We haven't learned conditional statements yet, so I can't...

## Rounding user input in form using JavaScript

javascript,jquery,regex,rounding
I'm looking for a regex and a JavaScript function that rounds up what the user just input to 2 decimals max, the user can input any number and dots e.g. 1, 2.3490, 23 and it should change when the user clicks away from the field to 1.00, 2.35, 23.00. I've...

## Round Off in PHP

php,rounding
I want to round off the number with exact value of decimal in PHP. Eg: 1.399 => 1.39 or 363.3 => 363.30 I have used printf("%.2f", 1.399) and number_format((float)\$a,2,'.','') but the answer is 1.40 which is incorrect for me....

## Explanation of JavaScript Decimal Rounding example at MDN?

javascript,rounding,tostring
I'm learning JavaScript, and I've heard that there can be issues among different browsers when using JavaScript's Math.round() and .toFixed() methods. After researching on this website, the solution I've with the seen with least criticisms are the Decimal Rounding method as illustrated at the MDN. Looking over the code, I'm...

## PHP round precision bug?

php,rounding
Is this a bug or some math thing I don't understand? round(58.900662, 2) => 58.9 Where is the last zero? EDIT: In my opinion, the documentation is lacking information. The following code does as expected number_format(round(58.900662, 2), 2) => 58.90 ...

## Given a microsecond value , how to accurately get a timeval struct? /*UPDATE GETTING NEGATIVE VALUE*/

c++,timestamp,double,rounding
Is this the right way to convert a microseconds and represent it as a timeval in my application ? I require the usage of a struct timeval and the above code is part of a routine that converts a double microsecond to a timeval NEGATIVE Value in this code //UPDATE...

## Why is rounding done like this? [on hold]

python,python-3.x,rounding
Why is Python rounding like this? >>> 1.12345678901234567890 1.1234567890123457 >>> 0.0001100110011001100110011001100110011001100110011 0.00011001100110011001 ...

## How to round smoothly percentage in JS

javascript,math,rounding
I have an object containing decimals values : evo, meteo and usage I try to display this values with three conditions : values can be positive and negative values must be displayed as percentage without any decimals (A) must be true (A): Math.round(meteo*100)+Math.round(usage*100) = Math.round(evo*100) For example, if we apply...

## Replace “Lunch Out, Lunch In” with duration in formula to give Time Out/In difference excluding Lunch

excel,excel-formula,rounding,worksheet-function,time-format
I currently have the following formula to track my work schedule. Time is put down in traditional format ie. 8:00 am, and is then totaled to show hours worked as a whole number 8, for 8 hrs worked: =IF(D2="","",ROUND(IF(OR(C2="",B2=""),(D2-A2),(B2-A2)+(D2-C2))*24*4,0)/4) A=Time In , B=Lunch Out , C=Lunch In , D=Time Out....

## Fixed number rounding down in JavaScript

javascript,floating-point,rounding,floor
Problem I get numbers from 1 to 5 including all possible floating point numbers in between. The output must contain two digits after comma and in case of after-comma digits they need to be rounded down (floor). Example input and output: 1 -> 1.00 4.3 -> 4.30 1.1000 -> 1.10...

## R by() round stat.desc

r,statistics,rounding
I am concerned about the following question. If I apply the function by(productivity\$LOC, productivity\$extension, stat.desc, norm = TRUE, basic = TRUE) how can I round the output values of the by() function? ...

## How to Perform Tuckerman Rounding for Floating Point Square Root

c++,matlab,math,floating-point,rounding
I am trying to perform a Tuckerman Rounding Test in order to determine the correctly rounded to nearest result. I created a program in C++ to compare two solutions to a square root of a number and perform a tuckerman test on them. However, the C++ math library solution fails...

## Development of a windows form-based application to calculate the area and boundary lengths for Circles, Squares and Right-Angled Triangles [closed]

I am trying to create a program in C# using Microsoft Visual Studio. The application should be able to calculate the area and boundary lengths for Circles, Squares and Right-Angled Triangles; it must also draw each of these shapes on the screen at the currently set size. One of the...

## BigDecimal 1.0E+8 / 100000000 with ROUND_HALF_UP is 0

java,rounding,bigdecimal,divide
Can some one explain why I get 0 as result for the first line? System.out.println((new BigDecimal("1.0E+8")).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP)); System.out.println((new BigDecimal("1.0E+8")).subtract(BigDecimal.ONE).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP)); 0E+7 1 ...

## How to show number of asterisks to nearest thousand?

java,rounding
bar1 = store1/1000; System.out.print("Store 1: "); for(int i = 1; i <= bar1; i++) System.out.print("*"); How to show number of "*" rounded up or down to the nearest thousand. Right now it just rounds down....

## Parsing JSON rounds Negative Values

c#,json.net,rounding
I am using NewtonSoft's JSON.NET assembly to load a .json file in a C# console application. I think I have done most of the work except I am finding that some negative float values are being rounded. Here is relevant code; as you can see, I have tried both load...

## Custom round number function

r,function,rounding
I am trying to create a function (my.func) that could round a number/numeric vector/matrix/data.frame conditionaly to its value. For example: my.func(1630.123) will give 1630 and my.func(0.123) will return 0.12 I have tried: my.func <- function(x0, ...) { unlist(lapply(x0, function(x) { if(x >= 100) return(round(x, 0)) if(x >= 10 & x...

## Problems rounding large figures using ng-currency

angularjs,rounding,currency
I'm using the ng-currency library - http://aguirrel.github.io/ng-currency/ - to display currency values in a project. However, it's not exactly what I need, the currency value cannot be negative cannot be greater than 999,999,999 must be rounded to the nearest whole number i.e. contain no decimal rendered as a currency value,...

## Is it possible to use BASH/bc/printf to round a float to it's first significant figure?

bash,math,printf,rounding,bc
I've found tons and tons of information about rounding a float to a specific number of decimal places by using 'scale' with BC and '%.xf' with printf, but if I'm working with numbers that don't always have the same format like I've shown below, is there a way to round...

## SQL Server - How to round up or down decimals?

sql,sql-server,select,rounding
I would like to be abble to round up or down 10.823. Expected result: rounding down = 10.82 rounding up = 10.83 Knowing that round(10.823, 2) only rounds down. How to round it up?...

## RoundingMode.HALF_DOWN issue in Java8

java,java-8,rounding,number-rounding
I am using jdk 1.8.0_45, and our tests discovered a bug in rouding. RoundingMode.HALF_DOWN works the same as RoundingMode.HALF_UP when the last decimal that decide the rounding is 5. I found related issues with RoundingMode.HALF_UP, but they are fixed in update 40. I also put a bug to the oracle,...

## Controlling digits / rounding as argument in base functions

r,rounding,rmarkdown,digits
In scientific paper writing, values are typically reported as rounded values with one, two or three digits, often depending on the type of value reported. This means that everytime when e.g. including an inline mean value in Rmarkdown I have to add round to the code. Thus I am wondering:...

## random rounding

php,random,rounding
So, i got two numbers, say, A and B. A is any positive number and B is percentage between 0 and 100. What i need is percentage B of A, but randomly round up or down, e.g. A = 15, B = 50, result=7(50%) or 8(50%) A = 10, B...

## Precision, Rounding, and data types in XSLT2.0

xslt,decimal,rounding,xslt-2.0,data-type-conversion
This is a question about precision, rounding, data types, and using the xs:integer() function in XSLT 2.0. We have the following line of code: <xsl:value-of select="xs:integer(round(InvoiceAmount * 100))"/> When the value of InvoiceAmount in the source XML is -62.84, the result of the value-of is -6283 which is incorrect. We...

## Excel formula for working with multiples

excel-formula,rounding,worksheet-function
I need a formula on Excel which would deduct the multiple of 20 from a given number. For example: 2 would give you 18, 10 would give 10, 23 would give 17, 118 would give 2, 321 would give 19....

## Geometry rounding problems: object no longer convex after simple transformations

c++,geometry,rounding,cgal,convex
I'm making a little app to analyze geometry. In one part of my program, I use an algorithm that has to have a convex object as input. Luckily, all my objects are initially convex, but some are just barely so (see image). After I apply some transformations, my algorithm fails...

## Why does a cast from int to float round the value?

c,casting,int,rounding
I'm reading CS:APP, and regarding casts it says that when casting from int to float, the number cannot overflow, but it may be rounded. It seemed odd to me as I didn't know what there was to round, so I've tried it out. I thought that this would only be...

## How to get 1 digit interger number in a double number in Postgres SQL?

postgresql,int,rounding
In Postgres SQL: Is it possible to get 1 digit number from a double number? For example: I have 27/10 = 2.7 I WANT TO GET the number "2" only (as number not string) I tried to convert 2.7 into integer but it will be rounded into 3. How can...

## Efficient way to round n/4 upward

c,algorithm,math,optimization,rounding
I have an integer number n and I need to rounds n/4 upward. For performance reason I need to find out a fast way in C. The division by 4 can be done using a >> 2 shift operation but I don't know about the round. I could use ceil...

## How can I change a var to the nearest number? [duplicate]

javascript,rounding
This question already has an answer here: get closest number out of array 9 answers I have two numbers wich can change, like x1 and x2. Then I also have an other number what is random but always between x1 and x2, like z. What I want to do...

## Rounding floats in C# WITHOUT using Math.Round

c#,floating-point,rounding
https://github.com/TelerikAcademy/CSharp-Part-1/blob/master/4.%20Console%20In%20and%20Out/README.md Problem 3, here's my code: Console.Write("Please enter circle radius: "); double Radius = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("\nPerimeter is: {0:F2}", Math.PI*2*Radius); Console.WriteLine("Area is: {0:F2}", Math.PI*Radius*Radius); Problem 5, here's my code: Console.Write("Enter first number: "); int a = Convert.ToInt32(Console.ReadLine()); if (a<0 || a>500) { Console.WriteLine("number A out of bounds!");...

## VBA Range.Find function on rounded negative numbers

excel-vba,find,rounding
I'm having an issue with a VBA macro I wrote, with the part that is intended to find a lowest value in range. The line looks like this: Min = Application.WorksheetFunction.Min(a0eqB) Set MinCell = a0eqB.Find(Min, LookIn:=xlValues) And it returns Object variable or With block variable not set error. Now, I...

## How is default rounding in divison handled?

rounding,cobol
In COBOL what is the result of COMPUTE RESULT1 = 97 / 100 COMPUTE RESULT2 = 50 / 100 COMPUTE RESULT3 = 32 / 100 COMPUTE RESULT4 = -97 / 100 COMPUTE RESULT5 = -50 / 100 COMPUTE RESULT6 = -32 / 100 When RESULT1/2/3 are: PIC S9(4) PIC S9(4)V9...

## How to do custom rounding of numbers in Java?

java,rounding
Suppose I want to round numbers that have mantissa greater than 0.3 'up' and those below 'down'. How can I do it in Java? The only thing that came to my mind was Math.round(), but I can't seem to make it follow a certain rule....

## Doubles from ViewModel get rounded to ints in javascript array

javascript,arrays,razor,rounding,asp.net-mvc-viewmodel
I have this code (@Model.TW is 11,58 and @Model.TK is 27,65)(both doubles): var parameters = [@Model.TW,@Model.TK]; When checking parameters[0] and [1] the double values are rounded to 11 and 27. Why is this? The same happens when just doing var double = [@Model.TW]; or var double = parseFloat('[@Model.TW]'); even if...

## round() returns redundant amount of decimals

php,rounding,precision,floating-point-precision
I've written many PHP applications and have just stumbled upon a weird scenario. The round function doesn't seem to be working in a very complex set of code. I've tried many different things before calling round, but this just doesn't work. The function returns 0.56000000000000001 when given round(\$val,2), with \$val=0.5600....

## Calculate RTT with 3 decimal places in Python 3

python,python-3.x,time,rounding,decimal-point
I have a simple UDP client–server program and I get the time in ms of sending a packet and the time in ms of receiving the packet like this: send_time_ms = int(round(time.time() * 1000)) # sending the packet # ... # receiving the packet recv_time_ms = int(round(time.time() * 1000)) For...

## Round numbers and divide them to 2 columns

sed,grep,numbers,rounding
Now it looks like: xmin = 0 xmax = 15.393970521541949 xmin = 15.393970521541949 xmax = 27.58997052154195 xmin = 27.58997052154195 xmax = 46.05797052154195 xmin = 46.05797052154195 xmax = 65.67797052154194 xmin = 65.67797052154194 xmax = 81.08048969617173 xmin = 81.08048969617173 xmax = 82.7959410430839 It should look like: 0 15.39 15.39 27.59 27.59 46.06...

## Rounding decimal number upto two decimal places

c#,asp.net,vb.net,rounding
I am trying to round decimal number upto two decimal places which is working perfectly. I am doing as below : Math.Round(Amount, 2) So, if I have Amount as 40000.4567, I am getting 40000.46which is exactly what I want. Now problem is I have decimal number like 40000.0000, when I...

## SQL: Sum a negative and positive real gives wrong value

sql,sql-server,rounding
Why does the following query result in the value 3.21865081787109E-06 when the value should be zero? CREATE DATABASE TEST GO USE TEST CREATE TABLE NUMS (NUMBER REAL) GO INSERT INTO NUMS VALUES (1.67460317460317),(-1.6746) GO Then run: SELECT SUM(NUMBER) FROM NUMS This returns the value 3.21865081787109E-06? If I cast the values...

## How does Python babel round numbers?

python,decimal,rounding,currency,babel
I'm building a financial website with the Flask framework and I'm currently writing unit tests for it. I'm using the Babel package to format money amounts and I hit upon rather strange rounding behaviour. I would expect rounding to be up in case of a 5, or to at least...

## Why do I have a decimal error when writing data to MS Access via Matlab?

matlab,ms-access,rounding,numeric
I write numeric data to MS Access tables. All the tables have the same numeric fields format (ie 'real simple', 'standard', 'auto'). I push numbers via Matlab in the tables and MS Access rounds numbers to the 1rst decimal and i can't modify it. Does someone know ? Screenshots there...

## Is Cross-Platform Double Math Determinism Possible with Rounding?

double,cross-platform,rounding,precision,deterministic
I understand that there can be a .000000000000001 margin of error for double math and this is be made worse by multiplication to make the margin of error larger. With that said, is it possible to round off every calculation to a significant digit (maybe 4 decimal places) to achieve...

## Round number in java and add separator

java,rounding,separator
I would like to do this: if I have 1234.5678, I would like 1 234.57. I have tried several things, like: Object theValue = theValues.get(theHeaderName); DecimalFormatSymbols theSymbols = new DecimalFormatSymbols(); theSymbols.setGroupingSeparator(' '); DecimalFormat theFormatter = new DecimalFormat("#.00", theSymbols); el.text(theFormatter.format(theValue)); But I don't manage to have the rounding and the separator....

## Subsetting Outliers from a data frame by using the results of a boxplot diagram

r,subset,rounding
I transformed my data into a boxplot (used geom_boxplot of ggplot), so that the outliers got visible. Afterwards I wanted to remove them from my data. That is why I used "ggplot_build" to get on all the informations of the plot and saved it with a new name. Outlier_boxplot<-ggplot_build(boxplot) Now...