I input 179.9 in an EditText
. When I retrieve it, the value is different if it's stored as a float
.
final EditText valueInput = mEntryDialogView.getValueInput();
final CharSequence input = valueInput.getText();
final String inputAsString = input.toString().trim();
final float asFloat = Float.valueOf(inputAsString); //179.899994
final double asDouble = Double.valueOf(inputAsString); //179.9
Something fishy is going on here, could anyone explain to me why the float value is not correct? Even so if I convert the double value above to a float, it will be incorrect.
Moreover, is there anything that can be done to retrieve the value as a float in such a manner that it is equivalent to the actual inputted value?