largest number of java integer is about two billion. if variable integer over it, it get overflow.
public class MathInJava
{
public double amdahlSpeedup(double s, double n)
{
return 1 / (s + (1 - s)/n);
}
public double crossRatio(double a, double b, double c, double d)
{
return ((a-c)*(b-d))/((b-c)*(a-d));
}
public double average(double a, double b, double c, double d)
{
// To do!
return (a + b + c + d)/ 4.0;
}
}
public void reduce()
{
red = (red * 6 / 256) * 51;
green = (green * 6 / 256) * 51;
blue = (blue * 6 / 256) * 51;
}