The second question you ask is how big is ulp in Java.
ulp 1/(n), int. , ulps . , , 1 9E15; , round(), . , int, Integer.MAX_VALUE.
n, , int:
public static void main(String[] args)
{
int m = Integer.MAX_VALUE;
double d = 0;
double largestError = 0;
int bigErrorCause = -1;
for (int n = 1; n < Integer.MAX_VALUE; n++)
{
d = (double) m / n;
double possibleError = Math.ulp(d) * n;
if (possibleError > largestError)
{
largestError = possibleError;
bigErrorCause = n;
}
}
System.out.println("int " + bigErrorCause + " causes at most "
+ largestError + " error");
}
:
int 1073741823 4.768371577590358E-7
, Math.round, int int.