# point « decimal « Java Data Type Q&A

### 1. Plotting a Decimal valued Points in Java    stackoverflow.com

I am Creating a Graph Plotting Software in java. As a part of process if the equation is of form of y = Sin(x) * Cos(x) then in that case the value of y ...

### 2. printf %f with only 2 decimal points?    stackoverflow.com

In my printf, I need to use %f but I'm not sure how to truncate to 2 deminal places: ex: getting 3.14159 to print as: 3.14 Thanks

### 4. need a double returned with 2 decimal points    coderanch.com

A double doesn't have any number of decimal points. You can try rounding it to 2dp precision, which is as near as you will get. There is the Math.round() method, but you will have to multiply and divide to use that. You can use several methods, one of which you have already found, to display it with 2dp.

### 6. java Mathematical decimal point error    go4expert.com

Java math error. I got a prompt asking to covert from Fahrenheit to Celsius and it seem to compiled right and everything but the mathematical solution does not have the right decimal point. I tried everything I know please help. Example if you cal 72 F = 22.22 C...I got 72 F = 22.0 C. Here the program. Code: import java.util.Scanner; ...

### 8. I need 2x decimal points in result    java-forums.org

Hello, I have this java code but it calculates a whole, rounded number. I need it to be a decimal (x2). Can you help?

### 11. Decimal Points    forums.oracle.com

} } Here is my code... I now that it could be simplified a lot, but this is my weak attempt at my first programs. So I want to have keyboard input but I don't have a keyboard class yet. Thats why I don't import the keyboard here. Also under each system.out.flush() I want to read from the keyboard and use ...

### 13. Help with specifying numbers after decimal point    forums.oracle.com

Hey guys , hope you always are ok , well i just written a program and the output of it is not what i wan it to show up thus , here is the exercise i am tryin to solve : (Conversion from kilograms to pounds) Write a program that displays the following table (note that 1 kilogram is 2.2 pounds): ...

### 17. Working with decimal points...    forums.oracle.com

Just to drive the point home, due to your use of a double which uses floating point you're actually passing 7657876567878.98046875 and 76543216789765.03125 to BigDecimal. Adding those two numbers together gets you exactly what you'd expect. If you were to pass a String literal BigDecimal can properly parse the number, accurately represent the number and accurately add the numbers. In fact, ...