Class MathFunctions

java.lang.Object
it.unimi.di.prog2.e06.MathFunctions

public class MathFunctions extends Object
Utility class for computing mathematical functions.
  • Constructor Details

    • MathFunctions

      private MathFunctions()
      .
  • Method Details

    • sqrt

      public static double sqrt(double x)
      Extracts (if possible) the square root of the given number.

      Partial function which, when the argument is non-negative, returns an approximation \( y \) of the square root in the sense that \( |y^2 - x| < 10^{-3} \).

      Parameters:
      x - the number whose square root is to be extracted; must be non-negative.
      Returns:
      an approximation of the square root.