Average Error: 2.3 → 0.9
Time: 17.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}\;b \le -4.035514617533359053304326262914735101941 \cdot 10^{-85} \lor \neg \left(b \le 1.66963206289420839225539623091866545351 \cdot 10^{-233}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\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}\;b \le -4.035514617533359053304326262914735101941 \cdot 10^{-85} \lor \neg \left(b \le 1.66963206289420839225539623091866545351 \cdot 10^{-233}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r511446 = x;
        double r511447 = y;
        double r511448 = z;
        double r511449 = r511447 * r511448;
        double r511450 = r511446 + r511449;
        double r511451 = t;
        double r511452 = a;
        double r511453 = r511451 * r511452;
        double r511454 = r511450 + r511453;
        double r511455 = r511452 * r511448;
        double r511456 = b;
        double r511457 = r511455 * r511456;
        double r511458 = r511454 + r511457;
        return r511458;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r511459 = b;
        double r511460 = -4.035514617533359e-85;
        bool r511461 = r511459 <= r511460;
        double r511462 = 1.6696320628942084e-233;
        bool r511463 = r511459 <= r511462;
        double r511464 = !r511463;
        bool r511465 = r511461 || r511464;
        double r511466 = x;
        double r511467 = y;
        double r511468 = z;
        double r511469 = r511467 * r511468;
        double r511470 = r511466 + r511469;
        double r511471 = t;
        double r511472 = a;
        double r511473 = r511471 * r511472;
        double r511474 = r511470 + r511473;
        double r511475 = r511472 * r511468;
        double r511476 = r511475 * r511459;
        double r511477 = r511474 + r511476;
        double r511478 = r511468 * r511459;
        double r511479 = r511471 + r511478;
        double r511480 = r511472 * r511479;
        double r511481 = r511480 + r511470;
        double r511482 = r511465 ? r511477 : r511481;
        return r511482;
}

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.3
Target0.3
Herbie0.9
\[\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 < -4.035514617533359e-85 or 1.6696320628942084e-233 < b

    1. Initial program 1.3

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

    if -4.035514617533359e-85 < b < 1.6696320628942084e-233

    1. Initial program 4.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.035514617533359053304326262914735101941 \cdot 10^{-85} \lor \neg \left(b \le 1.66963206289420839225539623091866545351 \cdot 10^{-233}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\right)\\ \end{array}\]

Reproduce

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