Average Error: 34.2 → 27.9
Time: 1.0m
Precision: 64
\[\left(\left(\left(\left(\left(\left(-5\right) \cdot x\right) \cdot x + 15 \cdot {y}^{2}\right) \cdot x - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.542825977128760169545909118616403477543 \cdot 10^{-173} \lor \neg \left(x \le 1.901072786134052772564067954192634290842 \cdot 10^{-148}\right):\\ \;\;\;\;\left(\left(15 \cdot {p}^{4} + x \cdot \left(\left(15 \cdot \left(\left(\left(x \cdot y\right) \cdot y\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \left(15 \cdot {p}^{4}\right) - 6 \cdot {q}^{5}\right)\\ \end{array}\]
\left(\left(\left(\left(\left(\left(-5\right) \cdot x\right) \cdot x + 15 \cdot {y}^{2}\right) \cdot x - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x
\begin{array}{l}
\mathbf{if}\;x \le -7.542825977128760169545909118616403477543 \cdot 10^{-173} \lor \neg \left(x \le 1.901072786134052772564067954192634290842 \cdot 10^{-148}\right):\\
\;\;\;\;\left(\left(15 \cdot {p}^{4} + x \cdot \left(\left(15 \cdot \left(\left(\left(x \cdot y\right) \cdot y\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \left(15 \cdot {p}^{4}\right) - 6 \cdot {q}^{5}\right)\\

\end{array}
double f(double x, double y, double z, double p, double q) {
        double r542373 = 5.0;
        double r542374 = -r542373;
        double r542375 = x;
        double r542376 = r542374 * r542375;
        double r542377 = r542376 * r542375;
        double r542378 = 15.0;
        double r542379 = y;
        double r542380 = 2.0;
        double r542381 = pow(r542379, r542380);
        double r542382 = r542378 * r542381;
        double r542383 = r542377 + r542382;
        double r542384 = r542383 * r542375;
        double r542385 = 20.0;
        double r542386 = z;
        double r542387 = 3.0;
        double r542388 = pow(r542386, r542387);
        double r542389 = r542385 * r542388;
        double r542390 = r542384 - r542389;
        double r542391 = r542390 * r542375;
        double r542392 = p;
        double r542393 = 4.0;
        double r542394 = pow(r542392, r542393);
        double r542395 = r542378 * r542394;
        double r542396 = r542391 + r542395;
        double r542397 = r542396 * r542375;
        double r542398 = 6.0;
        double r542399 = q;
        double r542400 = pow(r542399, r542373);
        double r542401 = r542398 * r542400;
        double r542402 = r542397 - r542401;
        double r542403 = r542402 * r542375;
        return r542403;
}

double f(double x, double y, double z, double p, double q) {
        double r542404 = x;
        double r542405 = -7.54282597712876e-173;
        bool r542406 = r542404 <= r542405;
        double r542407 = 1.9010727861340528e-148;
        bool r542408 = r542404 <= r542407;
        double r542409 = !r542408;
        bool r542410 = r542406 || r542409;
        double r542411 = 15.0;
        double r542412 = p;
        double r542413 = 4.0;
        double r542414 = pow(r542412, r542413);
        double r542415 = r542411 * r542414;
        double r542416 = y;
        double r542417 = r542404 * r542416;
        double r542418 = r542417 * r542416;
        double r542419 = 1.0;
        double r542420 = -1.0;
        double r542421 = 2.0;
        double r542422 = pow(r542420, r542421);
        double r542423 = r542419 / r542422;
        double r542424 = 1.0;
        double r542425 = pow(r542423, r542424);
        double r542426 = r542418 * r542425;
        double r542427 = r542411 * r542426;
        double r542428 = 5.0;
        double r542429 = 3.0;
        double r542430 = pow(r542404, r542429);
        double r542431 = r542428 * r542430;
        double r542432 = r542427 - r542431;
        double r542433 = 20.0;
        double r542434 = z;
        double r542435 = 3.0;
        double r542436 = pow(r542434, r542435);
        double r542437 = r542433 * r542436;
        double r542438 = r542432 - r542437;
        double r542439 = r542404 * r542438;
        double r542440 = r542415 + r542439;
        double r542441 = r542440 * r542404;
        double r542442 = 6.0;
        double r542443 = q;
        double r542444 = pow(r542443, r542428);
        double r542445 = r542442 * r542444;
        double r542446 = r542441 - r542445;
        double r542447 = r542446 * r542404;
        double r542448 = r542404 * r542415;
        double r542449 = r542448 - r542445;
        double r542450 = r542404 * r542449;
        double r542451 = r542410 ? r542447 : r542450;
        return r542451;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus p

Bits error versus q

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -7.54282597712876e-173 or 1.9010727861340528e-148 < x

    1. Initial program 25.1

      \[\left(\left(\left(\left(\left(\left(-5\right) \cdot x\right) \cdot x + 15 \cdot {y}^{2}\right) \cdot x - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
    2. Taylor expanded around -inf 25.0

      \[\leadsto \left(\left(\left(\color{blue}{\left(15 \cdot \left(\left(x \cdot {y}^{2}\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right)} - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
    3. Using strategy rm
    4. Applied sqr-pow25.0

      \[\leadsto \left(\left(\left(\left(15 \cdot \left(\left(x \cdot \color{blue}{\left({y}^{\left(\frac{2}{2}\right)} \cdot {y}^{\left(\frac{2}{2}\right)}\right)}\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
    5. Applied associate-*r*22.3

      \[\leadsto \left(\left(\left(\left(15 \cdot \left(\color{blue}{\left(\left(x \cdot {y}^{\left(\frac{2}{2}\right)}\right) \cdot {y}^{\left(\frac{2}{2}\right)}\right)} \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
    6. Simplified22.3

      \[\leadsto \left(\left(\left(\left(15 \cdot \left(\left(\color{blue}{\left(x \cdot y\right)} \cdot {y}^{\left(\frac{2}{2}\right)}\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]

    if -7.54282597712876e-173 < x < 1.9010727861340528e-148

    1. Initial program 40.9

      \[\left(\left(\left(\left(\left(\left(-5\right) \cdot x\right) \cdot x + 15 \cdot {y}^{2}\right) \cdot x - 20 \cdot {z}^{3}\right) \cdot x + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
    2. Taylor expanded around 0 31.9

      \[\leadsto \left(\left(\color{blue}{0} + 15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\]
  3. Recombined 2 regimes into one program.
  4. Final simplification27.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.542825977128760169545909118616403477543 \cdot 10^{-173} \lor \neg \left(x \le 1.901072786134052772564067954192634290842 \cdot 10^{-148}\right):\\ \;\;\;\;\left(\left(15 \cdot {p}^{4} + x \cdot \left(\left(15 \cdot \left(\left(\left(x \cdot y\right) \cdot y\right) \cdot {\left(\frac{1}{{-1}^{2}}\right)}^{1}\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) \cdot x - 6 \cdot {q}^{5}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot \left(15 \cdot {p}^{4}\right) - 6 \cdot {q}^{5}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x y z p q)
  :name "(((((-5*x)*x+15*pow(y,2))*x - 20*pow(z,3))*x + 15*pow(p,4))*x - 6*pow(q, 5))*x "
  :precision binary64
  (* (- (* (+ (* (- (* (+ (* (* (- 5) x) x) (* 15 (pow y 2))) x) (* 20 (pow z 3))) x) (* 15 (pow p 4))) x) (* 6 (pow q 5))) x))