Please, help me to solve the problem: <source code> bit Result; float Density; Density = 0.55; if(( Density < 0.54999995) { Result = 0; } else { Result = 1; } While after running this code Result = 0 ?
0.54999995 == 0.55 - maybe. But why 0.54999995 > 0.55 ?
In the debugger, look at the raw binary representations of these numbers.
why do you float? store the value *100, take care of the decimal point in the presentation. Your program will compact and speed up and you will smile like the cheshire cat. Erik
0.55 - 3F 0C CC CD 0.54999995 - 3F 0C CC CC Why 0.55 < 0.54999995 ? I don't understand