Average Error: 1.9 → 1.1
Time: 16.5s
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.4635097826338302 \cdot 10^{-92}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b + \left(a \cdot t + \left(x + y \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(b \cdot z + t\right) + \left(x + y \cdot z\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}\;a \le 1.4635097826338302 \cdot 10^{-92}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b + \left(a \cdot t + \left(x + y \cdot z\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r30745693 = x;
        double r30745694 = y;
        double r30745695 = z;
        double r30745696 = r30745694 * r30745695;
        double r30745697 = r30745693 + r30745696;
        double r30745698 = t;
        double r30745699 = a;
        double r30745700 = r30745698 * r30745699;
        double r30745701 = r30745697 + r30745700;
        double r30745702 = r30745699 * r30745695;
        double r30745703 = b;
        double r30745704 = r30745702 * r30745703;
        double r30745705 = r30745701 + r30745704;
        return r30745705;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r30745706 = a;
        double r30745707 = 1.4635097826338302e-92;
        bool r30745708 = r30745706 <= r30745707;
        double r30745709 = z;
        double r30745710 = r30745709 * r30745706;
        double r30745711 = b;
        double r30745712 = r30745710 * r30745711;
        double r30745713 = t;
        double r30745714 = r30745706 * r30745713;
        double r30745715 = x;
        double r30745716 = y;
        double r30745717 = r30745716 * r30745709;
        double r30745718 = r30745715 + r30745717;
        double r30745719 = r30745714 + r30745718;
        double r30745720 = r30745712 + r30745719;
        double r30745721 = r30745711 * r30745709;
        double r30745722 = r30745721 + r30745713;
        double r30745723 = r30745706 * r30745722;
        double r30745724 = r30745723 + r30745718;
        double r30745725 = r30745708 ? r30745720 : r30745724;
        return r30745725;
}

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.1
\[\begin{array}{l} \mathbf{if}\;z \lt -1.1820553527347888 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.7589743188364287 \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.4635097826338302e-92

    1. Initial program 1.4

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

    if 1.4635097826338302e-92 < a

    1. Initial program 3.3

      \[\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+3.3

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

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

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

Reproduce

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