Im having problems with float data type in getting 1 or 2 decimal places only..
but if you look at the code seems okay to me but the output is different.. I dont want to convert into string yet co'z I need to do something else before the printing them out..
Just for testing purposes I did this literally. There are variables and workarounds just to simplify everything. It suppose to end at 12.8 but it yields 12.8000001 that's why it skips my testing..
float oh=11.0f;
int retval=1;
while (oh<=12.8)
{
//System.out.printf("%-11s",dec_format.format(oh)+'K');
System.out.println(oh);
oh=oh + 0.3f;
}
output is: 11.0 11.3 11.6 11.900001 12.200001 12.500001
It should end at 12.8 and why with ....00001??