I read a book about Java and I've faced a strange issue. Would be really nice if you help me to figure what's going on :).. Take a look on the code please:
class Promote {
public static void main (String args[]) {
byte b = 42;
char c = 'a';
short s = 1024;
int i = 50000;
float f = 5.67f;
double d = .1234;
double x = 238.14 + 515 - 126.3616;
double result = (f * b) + (i / c) - (d * s); // (5.67 * 42) + (50000 / 97) - (0.1234 * 1024)
System.out.println((f * b) + " + " + (i / c) + " - " + (d * s) + " = " + result); // 238.14 + 515 - 126.3616 = 626.7784
}
}
My calculations in comments seems to be logical, but the actual output is 626.7784146484375 I've no clue why do I've this 0.0000146484375 difference. Make it clear for me please! Thank you.