Multiplying doubles in java?
android, double, java, math, multiplication
Solution
Check out this great post by Stephen C.
https://stackoverflow.com/a/5385202/1214163
It should provide everything you need. He suggests that if you need to work with big numbers that you use the `BigDecimal` class
Problem
I'm trying to multiply the same double (square it) but the number comes out wrong. When i display the double by itself the number is correct but when i multiply it by itself it comes up with the wrong number. I already tried using the math.pow function and got the same result. ``` Double height=Double.parseDouble(myPrefs.getString("Heightent",""))*.0254; Double bmi = (height*height); dbmi.setText(bmi.toString()); ``` Height is entered in a different activity in inches. When i display height in a text box it comes out to be the right number. For example, Heightent entered is 74 and 1.8796 is displayed when i put height in a textview. Butwhen I use the code above the number 16 is displayed in TextView dbmi. Any help?