public double length(){
  return Math.sqrt(NumberConversions.square(x) + NumberConversions.square(y) + NumberConversions.square(z));
}

public double length ( ) { return Math . sqrt ( NumberConversions . square ( x ) + NumberConversions . square ( y ) + NumberConversions . square ( z ) ) ; }
gets the magnitude of the vector , defined as sqrt ( x ^ 2 + y ^ 2 + z ^ 2 ) . the value of this method is not cached and uses a costly square - root function , so do not repeatedly call this method to get the vector ' s magnitude . nan will be returned if the inner result of the sqrt ( ) function overflows , which will be caused if the length is too long .
