Average Error: 30.2 → 0
Time: 7.5s
Precision: 64
\[\sqrt{{x}^{2}}\]
\[\left|{x}^{\left(\frac{2}{2}\right)}\right|\]
\sqrt{{x}^{2}}
\left|{x}^{\left(\frac{2}{2}\right)}\right|
double f(double x) {
        double r1743490 = x;
        double r1743491 = 2.0;
        double r1743492 = pow(r1743490, r1743491);
        double r1743493 = sqrt(r1743492);
        return r1743493;
}

double f(double x) {
        double r1743494 = x;
        double r1743495 = 2.0;
        double r1743496 = 2.0;
        double r1743497 = r1743495 / r1743496;
        double r1743498 = pow(r1743494, r1743497);
        double r1743499 = fabs(r1743498);
        return r1743499;
}

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}^{2}}\]
  2. Using strategy rm
  3. Applied sqr-pow30.2

    \[\leadsto \sqrt{\color{blue}{{x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}}}\]
  4. Applied rem-sqrt-square0

    \[\leadsto \color{blue}{\left|{x}^{\left(\frac{2}{2}\right)}\right|}\]
  5. Final simplification0

    \[\leadsto \left|{x}^{\left(\frac{2}{2}\right)}\right|\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(pow(x,2))"
  :precision binary64
  (sqrt (pow x 2)))