If you try to run the following code
public class Main {
public static void main(String[] args) {
long a = (long)Math.pow(13, 15);
System.out.println(a + " " + a%13);
}
}
You will get "51185893014090752 8"
The correct value of 13^15 is 51185893014090757, i.e. greater than the result returned by Math.pow
by 5. Any ideas of what may cause it?