System.out.println((int) (368*Math.pow(2416,2)+100*2416+100));
does not produce the same output as a calculator would or python, what might be the reason for this?
System.out.println((int) (368*Math.pow(2416,2)+100*2416+100));
does not produce the same output as a calculator would or python, what might be the reason for this?
The result of the expression is larger than the range of java int. Since you are casting to int (java primitive type) which ranges from -2,147,483,648 (-2^31) to 2,147,483,647 ((2^31)-1), the code produces 2147483647(upper limit of java int data-type) as the output whereas the calculator will give correct result.