Average Error: 17.6 → 12.9
Time: 10.1s
Precision: 64
\[\sqrt{a + b \cdot {x}^{2}}\]
\[\sqrt{a + \left(b \cdot {x}^{\left(\frac{2}{2}\right)}\right) \cdot {x}^{\left(\frac{2}{2}\right)}}\]
\sqrt{a + b \cdot {x}^{2}}
\sqrt{a + \left(b \cdot {x}^{\left(\frac{2}{2}\right)}\right) \cdot {x}^{\left(\frac{2}{2}\right)}}
double f(double a, double b, double x) {
        double r198123 = a;
        double r198124 = b;
        double r198125 = x;
        double r198126 = 2.0;
        double r198127 = pow(r198125, r198126);
        double r198128 = r198124 * r198127;
        double r198129 = r198123 + r198128;
        double r198130 = sqrt(r198129);
        return r198130;
}

double f(double a, double b, double x) {
        double r198131 = a;
        double r198132 = b;
        double r198133 = x;
        double r198134 = 2.0;
        double r198135 = 2.0;
        double r198136 = r198134 / r198135;
        double r198137 = pow(r198133, r198136);
        double r198138 = r198132 * r198137;
        double r198139 = r198138 * r198137;
        double r198140 = r198131 + r198139;
        double r198141 = sqrt(r198140);
        return r198141;
}

Error

Bits error versus a

Bits error versus b

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 17.6

    \[\sqrt{a + b \cdot {x}^{2}}\]
  2. Using strategy rm
  3. Applied sqr-pow17.6

    \[\leadsto \sqrt{a + b \cdot \color{blue}{\left({x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}\right)}}\]
  4. Applied associate-*r*12.9

    \[\leadsto \sqrt{a + \color{blue}{\left(b \cdot {x}^{\left(\frac{2}{2}\right)}\right) \cdot {x}^{\left(\frac{2}{2}\right)}}}\]
  5. Final simplification12.9

    \[\leadsto \sqrt{a + \left(b \cdot {x}^{\left(\frac{2}{2}\right)}\right) \cdot {x}^{\left(\frac{2}{2}\right)}}\]

Reproduce

herbie shell --seed 1 
(FPCore (a b x)
  :name "sqrt(a +b*x^2)"
  :precision binary64
  (sqrt (+ a (* b (pow x 2)))))