This is the part of the code in my "ProjectEntity" class (where I make SQL calls with hibernate)
@Column(name = "BUDGET")
private float budget;
public float getBudget() {
return budget;
}
public float setBudget(float budget) {
this.budget = budget;
}
From another class I call my setter like this:
newProject.setBudget(Float.parseFloat(strTotalAmount.substring(0, strTotalAmount.indexOf(" (hrs)"))) * m);
In here I have a String called strTotalAmount and it looks like this: "51.0 (hrs)". So it basically gets the value 51.0 from string and multiplies with float "m" which is equal to 47.6 Everything is fine till here. It should have set the value to 2427.6 Instead it sets to 2427.5999. What might be the problem?
Note: At first in ProjectEntity "budget" value was double instead of float. I've changed it into float. But nothing has changed.