Average Error: 1.9 → 1.2
Time: 6.8s
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}\;a \le -1.67032308676182466 \cdot 10^{79}:\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \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}\;a \le -1.67032308676182466 \cdot 10^{79}:\\
\;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r979677 = x;
        double r979678 = y;
        double r979679 = z;
        double r979680 = r979678 * r979679;
        double r979681 = r979677 + r979680;
        double r979682 = t;
        double r979683 = a;
        double r979684 = r979682 * r979683;
        double r979685 = r979681 + r979684;
        double r979686 = r979683 * r979679;
        double r979687 = b;
        double r979688 = r979686 * r979687;
        double r979689 = r979685 + r979688;
        return r979689;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r979690 = a;
        double r979691 = -1.6703230867618247e+79;
        bool r979692 = r979690 <= r979691;
        double r979693 = x;
        double r979694 = y;
        double r979695 = z;
        double r979696 = r979694 * r979695;
        double r979697 = r979693 + r979696;
        double r979698 = b;
        double r979699 = r979695 * r979698;
        double r979700 = t;
        double r979701 = r979699 + r979700;
        double r979702 = r979690 * r979701;
        double r979703 = r979697 + r979702;
        double r979704 = r979700 * r979690;
        double r979705 = r979697 + r979704;
        double r979706 = r979690 * r979695;
        double r979707 = r979706 * r979698;
        double r979708 = r979705 + r979707;
        double r979709 = r979692 ? r979703 : r979708;
        return r979709;
}

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.3
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888000:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.75897431883642871 \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 a < -1.6703230867618247e+79

    1. Initial program 6.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 associate-+l+6.2

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

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

    if -1.6703230867618247e+79 < a

    1. Initial program 1.3

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.2

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

Reproduce

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