Average Error: 2.2 → 0.7
Time: 4.2s
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 -2.034026435353058108559897623200424052493 \cdot 10^{109} \lor \neg \left(b \le 1.027237226989843754671268111265519470689 \cdot 10^{-78} \lor \neg \left(b \le 2.647623770860597189657221275416878067542 \cdot 10^{247}\right)\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\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 -2.034026435353058108559897623200424052493 \cdot 10^{109} \lor \neg \left(b \le 1.027237226989843754671268111265519470689 \cdot 10^{-78} \lor \neg \left(b \le 2.647623770860597189657221275416878067542 \cdot 10^{247}\right)\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r841540 = x;
        double r841541 = y;
        double r841542 = z;
        double r841543 = r841541 * r841542;
        double r841544 = r841540 + r841543;
        double r841545 = t;
        double r841546 = a;
        double r841547 = r841545 * r841546;
        double r841548 = r841544 + r841547;
        double r841549 = r841546 * r841542;
        double r841550 = b;
        double r841551 = r841549 * r841550;
        double r841552 = r841548 + r841551;
        return r841552;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r841553 = b;
        double r841554 = -2.034026435353058e+109;
        bool r841555 = r841553 <= r841554;
        double r841556 = 1.0272372269898438e-78;
        bool r841557 = r841553 <= r841556;
        double r841558 = 2.6476237708605972e+247;
        bool r841559 = r841553 <= r841558;
        double r841560 = !r841559;
        bool r841561 = r841557 || r841560;
        double r841562 = !r841561;
        bool r841563 = r841555 || r841562;
        double r841564 = x;
        double r841565 = y;
        double r841566 = z;
        double r841567 = r841565 * r841566;
        double r841568 = r841564 + r841567;
        double r841569 = t;
        double r841570 = a;
        double r841571 = r841569 * r841570;
        double r841572 = r841568 + r841571;
        double r841573 = r841570 * r841566;
        double r841574 = r841573 * r841553;
        double r841575 = r841572 + r841574;
        double r841576 = r841566 * r841553;
        double r841577 = r841569 + r841576;
        double r841578 = r841570 * r841577;
        double r841579 = r841564 + r841578;
        double r841580 = r841567 + r841579;
        double r841581 = r841563 ? r841575 : r841580;
        return r841581;
}

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.2
Target0.4
Herbie0.7
\[\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 < -2.034026435353058e+109 or 1.0272372269898438e-78 < b < 2.6476237708605972e+247

    1. Initial program 0.6

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]

    if -2.034026435353058e+109 < b < 1.0272372269898438e-78 or 2.6476237708605972e+247 < b

    1. Initial program 3.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.034026435353058108559897623200424052493 \cdot 10^{109} \lor \neg \left(b \le 1.027237226989843754671268111265519470689 \cdot 10^{-78} \lor \neg \left(b \le 2.647623770860597189657221275416878067542 \cdot 10^{247}\right)\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 
(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)))