Java rounding issues
<p>I am using the following code to round the float value which is given as input. But i cant get it right. If i give $80 i should get $80.00 and if i give $40.009889 i should get $40.01. How do i do this ?</p>

<pre>
public class round {
public static float round_this(float num) {
    //float num = 2.954165f;
    float round = Round(num,2);
    return round;
  }
  private static float Round(float Rval, int Rpl) {
  float p = (float)Math.pow(10,Rpl);
  Rval = Rval * p;
  float tmp = Math.round(Rval);
  return (float)tmp/p;
    }
}</pre>
