Average Error: 2.1 → 0.5
Time: 19.4s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.255270016911634748648504801355460091469 \cdot 10^{73}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\ \mathbf{elif}\;z \le 4.935976670534404868956354602279793360656 \cdot 10^{-142}:\\ \;\;\;\;y \cdot z + \left(a \cdot \left(b \cdot z + t\right) + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\ \end{array}\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;z \le -5.255270016911634748648504801355460091469 \cdot 10^{73}:\\
\;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\

\mathbf{elif}\;z \le 4.935976670534404868956354602279793360656 \cdot 10^{-142}:\\
\;\;\;\;y \cdot z + \left(a \cdot \left(b \cdot z + t\right) + x\right)\\

\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r30397433 = x;
        double r30397434 = y;
        double r30397435 = z;
        double r30397436 = r30397434 * r30397435;
        double r30397437 = r30397433 + r30397436;
        double r30397438 = t;
        double r30397439 = a;
        double r30397440 = r30397438 * r30397439;
        double r30397441 = r30397437 + r30397440;
        double r30397442 = r30397439 * r30397435;
        double r30397443 = b;
        double r30397444 = r30397442 * r30397443;
        double r30397445 = r30397441 + r30397444;
        return r30397445;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r30397446 = z;
        double r30397447 = -5.255270016911635e+73;
        bool r30397448 = r30397446 <= r30397447;
        double r30397449 = b;
        double r30397450 = a;
        double r30397451 = r30397449 * r30397450;
        double r30397452 = r30397451 * r30397446;
        double r30397453 = x;
        double r30397454 = y;
        double r30397455 = r30397454 * r30397446;
        double r30397456 = r30397453 + r30397455;
        double r30397457 = t;
        double r30397458 = r30397457 * r30397450;
        double r30397459 = r30397456 + r30397458;
        double r30397460 = r30397452 + r30397459;
        double r30397461 = 4.935976670534405e-142;
        bool r30397462 = r30397446 <= r30397461;
        double r30397463 = r30397449 * r30397446;
        double r30397464 = r30397463 + r30397457;
        double r30397465 = r30397450 * r30397464;
        double r30397466 = r30397465 + r30397453;
        double r30397467 = r30397455 + r30397466;
        double r30397468 = r30397462 ? r30397467 : r30397460;
        double r30397469 = r30397448 ? r30397460 : r30397468;
        return r30397469;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.1
Target0.3
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888128:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.758974318836428710669076838657752600596 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -5.255270016911635e+73 or 4.935976670534405e-142 < z

    1. Initial program 4.2

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied add-cube-cbrt4.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot \color{blue}{\left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}\right)}\]
    4. Applied associate-*r*4.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity4.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{\color{blue}{1 \cdot b}}\]
    7. Applied cbrt-prod4.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{b}\right)}\]
    8. Applied associate-*r*4.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(\left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{b}}\]
    9. Simplified1.4

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot \left(a \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right)} \cdot \sqrt[3]{b}\]
    10. Using strategy rm
    11. Applied associate-*l*1.0

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(\left(a \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}\right)}\]
    12. Simplified0.8

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \color{blue}{\left(a \cdot b\right)}\]

    if -5.255270016911635e+73 < z < 4.935976670534405e-142

    1. Initial program 0.5

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Simplified0.3

      \[\leadsto \color{blue}{z \cdot y + \left(a \cdot \left(t + z \cdot b\right) + x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.255270016911634748648504801355460091469 \cdot 10^{73}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\ \mathbf{elif}\;z \le 4.935976670534404868956354602279793360656 \cdot 10^{-142}:\\ \;\;\;\;y \cdot z + \left(a \cdot \left(b \cdot z + t\right) + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019170 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"

  :herbie-target
  (if (< z -1.1820553527347888e+19) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))