# precision « float « Java Data Type Q&A

### 1. Java floating point high precision library    stackoverflow.com

Which libraries for Java are there that have a fast implementation for floating point or fixed point operations with a precision of several thousands of digits? How performant are they? A requirement ...

### 2. Max value can stored in Java float with two digit precision (2 digit accuracy)?    stackoverflow.com

How I could find max two decimal precision vale that can be stored in float ? From my understanding, In 32 bit float we have 24(23+1) for storing the number excluding exponent. ...

### 3. Assign to Float from string with precision    stackoverflow.com

I have the following code, I want to assign a decimal value to float without losing precision.

``````String s1= "525.880005";
Float f = new Float(s1);
System.out.println(f);
``````
Output: 5.88 Expected Output: 525.880005

### 4. floating point precision    bytes.com

The double data type is a double-precision 64-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, For decimal values, this data type is generally ...

### 6. float precision    coderanch.com

There is no real difference between a float and a double other than a double is capable of storing larger values and is more accurate than a float can be. The BigDecimal class exists because float and double types are inherently non-precise, because they are incapable of representing all numbers within their range. The BigDecimal class allows for precise floating point ...

### 8. Double precision floating point    coderanch.com

Hi everyone, The byte data type represents 8 bit integers that range from -128 to 127. The double precision floating point data type has 64 bits. The first is the sign bit.The next 8 bits hold the exponent and the final 55 bits hold the mantissa. If the exponent is only 8 bits does this mean that the number before the ...

### 9. trouble with precision adding floats together    coderanch.com

I have two floats, and I want to add them together and keep a level of precision. How can I do this? Example: float a = 180285.61; float b = 381689.0; float tot; tot = a + b; I get 561974.6, but I want 561974.61 How do I make certain all the answers are in .00 format and round accordingly?

### 10. what accounts for precision problems when computing floating point numbers?    coderanch.com

Because computers can't REALLY represent .1 I don't remember exactly how to do it, but to accuratly store it, you'd need an infinite number of places after the decimal point... just like 1/3 is not really 0.3333333333 So, it represents is as close as it can. there are teeny tiny rounding errors, but they can (as you've seen) add up - ...

### 11. setting precision for float values    coderanch.com

Two decimal points makes me think of money. Ok, I drive by the PowerBall billboard on the way to work and think of money most of the morning. Anyhow, using floating point math for money will likely make you unhappy in the long run. Floats are good for very large numbers, like the number of atoms in the sun, but not ...

### 13. Java double floating point precision vs MS Excel    forums.oracle.com

I know that in floating point computations there are precission issues related to decimal-to-binary conversions and also related to IEEE 754 specification restrictions (basically the number of bits used for fp numbers) shared with a lot of languages and computer systems and that Java language makes simply more evident because it shows doubles with full precision by default when you print ...

### 14. float ,double precision ?    forums.oracle.com

No, I have a float/double of the form 1.123456789, who I use for repetive calculus. So sooner or later I will get numbers like this "3.483903E-7" . I need that instead of 1.123456789 , to use 1.1234 in my calculus, but I don't know how to obtain this number from that one.

### 15. Precision and presentation issue with datatype FLOAT    forums.oracle.com

We are trying to convert a BigDecimal value to float. While doing so, we are facing a problem. When I convert a BigDecimal value to double I am getting the correct value. But when I Convert it to Float it is fails to give the correct value it returns 8000.5654 instead of 8000.56564. Please run the above code snippet to see ...

### 16. Floating point precision    forums.oracle.com

Hello I have a string in the format 41.821874591 -88.273521. now I want to save the two float values for which I use st = new StringTokenizer("41.821874591 -88.273521"," "); float floatnum = new Float(st.nextToken()); when I print floatnum I get 41.821873 I loose 3 places of precision. I tried DecimalFormat but it only returns String data. How can I retain the ...

### 17. Problem with floating point precision    forums.oracle.com

If you are going to use the BigDecimal class, it is worth bearing in mind a tip that was passed on to me from georgemc. If you create the BigDecimal class instances using the constructor that accepts a String as input, then you can easily specify how many digits should follow the decimal point.