Average Error: 1.9 → 0.5
Time: 9.9s
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}\;b \le -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\ \;\;\;\;\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]{b}\\ \mathbf{else}:\\ \;\;\;\;t \cdot a + \left(z \cdot \left(b \cdot a + y\right) + x\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}\;b \le -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\
\;\;\;\;\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]{b}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r554542 = x;
        double r554543 = y;
        double r554544 = z;
        double r554545 = r554543 * r554544;
        double r554546 = r554542 + r554545;
        double r554547 = t;
        double r554548 = a;
        double r554549 = r554547 * r554548;
        double r554550 = r554546 + r554549;
        double r554551 = r554548 * r554544;
        double r554552 = b;
        double r554553 = r554551 * r554552;
        double r554554 = r554550 + r554553;
        return r554554;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r554555 = b;
        double r554556 = -1.7881082058704177e+30;
        bool r554557 = r554555 <= r554556;
        double r554558 = 6.065547839025837e+109;
        bool r554559 = r554555 <= r554558;
        double r554560 = !r554559;
        bool r554561 = r554557 || r554560;
        double r554562 = x;
        double r554563 = y;
        double r554564 = z;
        double r554565 = r554563 * r554564;
        double r554566 = r554562 + r554565;
        double r554567 = t;
        double r554568 = a;
        double r554569 = r554567 * r554568;
        double r554570 = r554566 + r554569;
        double r554571 = r554568 * r554564;
        double r554572 = cbrt(r554555);
        double r554573 = r554572 * r554572;
        double r554574 = r554571 * r554573;
        double r554575 = r554574 * r554572;
        double r554576 = r554570 + r554575;
        double r554577 = r554555 * r554568;
        double r554578 = r554577 + r554563;
        double r554579 = r554564 * r554578;
        double r554580 = r554579 + r554562;
        double r554581 = r554569 + r554580;
        double r554582 = r554561 ? r554576 : r554581;
        return r554582;
}

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

Original1.9
Target0.4
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 b < -1.7881082058704177e+30 or 6.065547839025837e+109 < b

    1. Initial program 0.7

      \[\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-cbrt1.1

      \[\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*1.1

      \[\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}}\]

    if -1.7881082058704177e+30 < b < 6.065547839025837e+109

    1. Initial program 2.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}{a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\right)}\]
    3. Using strategy rm
    4. Applied distribute-rgt-in0.3

      \[\leadsto \color{blue}{\left(t \cdot a + \left(z \cdot b\right) \cdot a\right)} + \left(x + y \cdot z\right)\]
    5. Applied associate-+l+0.3

      \[\leadsto \color{blue}{t \cdot a + \left(\left(z \cdot b\right) \cdot a + \left(x + y \cdot z\right)\right)}\]
    6. Taylor expanded around inf 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\ \;\;\;\;\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]{b}\\ \mathbf{else}:\\ \;\;\;\;t \cdot a + \left(z \cdot \left(b \cdot a + y\right) + x\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -11820553527347888000) (+ (* 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)))