Average Error: 1.9 → 1.3
Time: 8.6s
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.15879112181343211934394488782529501731 \cdot 10^{-117}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + a \cdot \left(z \cdot b\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.15879112181343211934394488782529501731 \cdot 10^{-117}:\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + a \cdot \left(z \cdot b\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 r665429 = x;
        double r665430 = y;
        double r665431 = z;
        double r665432 = r665430 * r665431;
        double r665433 = r665429 + r665432;
        double r665434 = t;
        double r665435 = a;
        double r665436 = r665434 * r665435;
        double r665437 = r665433 + r665436;
        double r665438 = r665435 * r665431;
        double r665439 = b;
        double r665440 = r665438 * r665439;
        double r665441 = r665437 + r665440;
        return r665441;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r665442 = a;
        double r665443 = -1.1587911218134321e-117;
        bool r665444 = r665442 <= r665443;
        double r665445 = x;
        double r665446 = y;
        double r665447 = z;
        double r665448 = r665446 * r665447;
        double r665449 = r665445 + r665448;
        double r665450 = t;
        double r665451 = r665450 * r665442;
        double r665452 = r665449 + r665451;
        double r665453 = b;
        double r665454 = r665447 * r665453;
        double r665455 = r665442 * r665454;
        double r665456 = r665452 + r665455;
        double r665457 = r665442 * r665447;
        double r665458 = r665457 * r665453;
        double r665459 = r665452 + r665458;
        double r665460 = r665444 ? r665456 : r665459;
        return r665460;
}

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.2
Herbie1.3
\[\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 a < -1.1587911218134321e-117

    1. Initial program 2.9

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

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

    if -1.1587911218134321e-117 < a

    1. Initial program 1.5

      \[\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.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.15879112181343211934394488782529501731 \cdot 10^{-117}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + a \cdot \left(z \cdot b\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 2019350 
(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)))