Average Error: 34.4 → 28.0
Time: 45.9s
Precision: 64
$\left(\left(\left(\left(\left(x \cdot x - 5 \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 -1.011807563150526507462654195669846512228 \cdot 10^{-171} \lor \neg \left(x \le 8.222215056991096048405876811545026367367 \cdot 10^{-149}\right):\\ \;\;\;\;\left(x \cdot \left(15 \cdot {p}^{4} + x \cdot \left(\left(\left({x}^{4} + \left(y \cdot \left(x \cdot y\right)\right) \cdot 15\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) - 6 \cdot {q}^{5}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right)\\ \end{array}$
\left(\left(\left(\left(\left(x \cdot x - 5 \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 -1.011807563150526507462654195669846512228 \cdot 10^{-171} \lor \neg \left(x \le 8.222215056991096048405876811545026367367 \cdot 10^{-149}\right):\\
\;\;\;\;\left(x \cdot \left(15 \cdot {p}^{4} + x \cdot \left(\left(\left({x}^{4} + \left(y \cdot \left(x \cdot y\right)\right) \cdot 15\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) - 6 \cdot {q}^{5}\right) \cdot x\\

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

\end{array}
double f(double x, double y, double z, double p, double q) {
double r400012 = x;
double r400013 = r400012 * r400012;
double r400014 = 5.0;
double r400015 = r400014 * r400012;
double r400016 = r400013 - r400015;
double r400017 = r400016 * r400012;
double r400018 = 15.0;
double r400019 = y;
double r400020 = 2.0;
double r400021 = pow(r400019, r400020);
double r400022 = r400018 * r400021;
double r400023 = r400017 + r400022;
double r400024 = r400023 * r400012;
double r400025 = 20.0;
double r400026 = z;
double r400027 = 3.0;
double r400028 = pow(r400026, r400027);
double r400029 = r400025 * r400028;
double r400030 = r400024 - r400029;
double r400031 = r400030 * r400012;
double r400032 = p;
double r400033 = 4.0;
double r400034 = pow(r400032, r400033);
double r400035 = r400018 * r400034;
double r400036 = r400031 + r400035;
double r400037 = r400036 * r400012;
double r400038 = 6.0;
double r400039 = q;
double r400040 = pow(r400039, r400014);
double r400041 = r400038 * r400040;
double r400042 = r400037 - r400041;
double r400043 = r400042 * r400012;
return r400043;
}


double f(double x, double y, double z, double p, double q) {
double r400044 = x;
double r400045 = -1.0118075631505265e-171;
bool r400046 = r400044 <= r400045;
double r400047 = 8.222215056991096e-149;
bool r400048 = r400044 <= r400047;
double r400049 = !r400048;
bool r400050 = r400046 || r400049;
double r400051 = 15.0;
double r400052 = p;
double r400053 = 4.0;
double r400054 = pow(r400052, r400053);
double r400055 = r400051 * r400054;
double r400056 = 4.0;
double r400057 = pow(r400044, r400056);
double r400058 = y;
double r400059 = r400044 * r400058;
double r400060 = r400058 * r400059;
double r400061 = r400060 * r400051;
double r400062 = r400057 + r400061;
double r400063 = 5.0;
double r400064 = 3.0;
double r400065 = pow(r400044, r400064);
double r400066 = r400063 * r400065;
double r400067 = r400062 - r400066;
double r400068 = 20.0;
double r400069 = z;
double r400070 = 3.0;
double r400071 = pow(r400069, r400070);
double r400072 = r400068 * r400071;
double r400073 = r400067 - r400072;
double r400074 = r400044 * r400073;
double r400075 = r400055 + r400074;
double r400076 = r400044 * r400075;
double r400077 = 6.0;
double r400078 = q;
double r400079 = pow(r400078, r400063);
double r400080 = r400077 * r400079;
double r400081 = r400076 - r400080;
double r400082 = r400081 * r400044;
double r400083 = r400055 * r400044;
double r400084 = r400083 - r400080;
double r400085 = r400044 * r400084;
double r400086 = r400050 ? r400082 : r400085;
return r400086;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < -1.0118075631505265e-171 or 8.222215056991096e-149 < x

1. Initial program 25.5

$\left(\left(\left(\left(\left(x \cdot x - 5 \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 25.4

$\leadsto \left(\left(\left(\color{blue}{\left(\left({x}^{4} + 15 \cdot \left(x \cdot {y}^{2}\right)\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.4

$\leadsto \left(\left(\left(\left(\left({x}^{4} + 15 \cdot \left(x \cdot \color{blue}{\left({y}^{\left(\frac{2}{2}\right)} \cdot {y}^{\left(\frac{2}{2}\right)}\right)}\right)\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.7

$\leadsto \left(\left(\left(\left(\left({x}^{4} + 15 \cdot \color{blue}{\left(\left(x \cdot {y}^{\left(\frac{2}{2}\right)}\right) \cdot {y}^{\left(\frac{2}{2}\right)}\right)}\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.7

$\leadsto \left(\left(\left(\left(\left({x}^{4} + 15 \cdot \left(\color{blue}{\left(x \cdot y\right)} \cdot {y}^{\left(\frac{2}{2}\right)}\right)\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 -1.0118075631505265e-171 < x < 8.222215056991096e-149

1. Initial program 40.8

$\left(\left(\left(\left(\left(x \cdot x - 5 \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 simplification28.0

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.011807563150526507462654195669846512228 \cdot 10^{-171} \lor \neg \left(x \le 8.222215056991096048405876811545026367367 \cdot 10^{-149}\right):\\ \;\;\;\;\left(x \cdot \left(15 \cdot {p}^{4} + x \cdot \left(\left(\left({x}^{4} + \left(y \cdot \left(x \cdot y\right)\right) \cdot 15\right) - 5 \cdot {x}^{3}\right) - 20 \cdot {z}^{3}\right)\right) - 6 \cdot {q}^{5}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(15 \cdot {p}^{4}\right) \cdot x - 6 \cdot {q}^{5}\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x y z p q)
:name "(((((x*x-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
(* (- (* (+ (* (- (* (+ (* (- (* x x) (* 5 x)) x) (* 15 (pow y 2))) x) (* 20 (pow z 3))) x) (* 15 (pow p 4))) x) (* 6 (pow q 5))) x))