people
How come this simple code yield different results?
System.out.println(1000.0/3.0/2.0/4.0/7.0);
System.out.println((double)(1000/3/2/4/7));
the output:
5.9523809523809526
5.0
And how can one perform such a simple arithmetic without casting every single member.
Extra: why does the following piece of code results in "int out of range error", even when I cast it?
long n1 = 291328282135; //Error description: The literal 291328282135 of type int is out of range.
//version with cast:
long n2 = (long) 291328282135; //Error description: The literal 291328282135 of type int is out of range.
Thanks in advance.