public double distance2(double p1,double p2){
  return (p1 - p2) * (p1 - p2);
}

public double distance2 ( double p1 , double p2 ) { return ( p1 - p2 ) * ( p1 - p2 ) ; }
calculates the square of the euclidean distance between two 1d points represented by real values .
