I'm using a float constant and setting a objects private float variable to the float constant below, but when the object outputs the value it was set to, it's rounding up the last digit in the float.
private final float RF_FREQUENCY = 956.35625f;
Object o = new Object();
o.setRFFrequency(RF_FREQUENCY);
System.out.println(o.getRFFrequency);
Output: 956.35626
The variable in the object is declared as protected float rfFrequency;
and below are the getters and setters.
public float getRFFrequency() {
return rfFrequency;
}
public void setRFFrequency(float value) {
this.rfFrequency = value;
}
Any idea why this is happening?