Average Error: 30.2 → 0
Time: 808.0ms
Precision: 64
\[\sqrt{x \cdot x}\]
\[\left|x\right|\]
\sqrt{x \cdot x}
\left|x\right|
double f(double x) {
        double r699373 = x;
        double r699374 = r699373 * r699373;
        double r699375 = sqrt(r699374);
        return r699375;
}

double f(double x) {
        double r699376 = x;
        double r699377 = fabs(r699376);
        return r699377;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.2

    \[\sqrt{x \cdot x}\]
  2. Simplified0

    \[\leadsto \color{blue}{\left|x\right|}\]
  3. Final simplification0

    \[\leadsto \left|x\right|\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x*x)"
  :precision binary64
  (sqrt (* x x)))