Average Error: 1.9 → 1.2
Time: 6.9s
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(t + 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.67032308676182466 \cdot 10^{79}:\\
\;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + 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 r803251 = x;
        double r803252 = y;
        double r803253 = z;
        double r803254 = r803252 * r803253;
        double r803255 = r803251 + r803254;
        double r803256 = t;
        double r803257 = a;
        double r803258 = r803256 * r803257;
        double r803259 = r803255 + r803258;
        double r803260 = r803257 * r803253;
        double r803261 = b;
        double r803262 = r803260 * r803261;
        double r803263 = r803259 + r803262;
        return r803263;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r803264 = a;
        double r803265 = -1.6703230867618247e+79;
        bool r803266 = r803264 <= r803265;
        double r803267 = x;
        double r803268 = y;
        double r803269 = z;
        double r803270 = r803268 * r803269;
        double r803271 = r803267 + r803270;
        double r803272 = t;
        double r803273 = b;
        double r803274 = r803269 * r803273;
        double r803275 = r803272 + r803274;
        double r803276 = r803264 * r803275;
        double r803277 = r803271 + r803276;
        double r803278 = r803272 * r803264;
        double r803279 = r803271 + r803278;
        double r803280 = r803264 * r803269;
        double r803281 = r803280 * r803273;
        double r803282 = r803279 + r803281;
        double r803283 = r803266 ? r803277 : r803282;
        return r803283;
}

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. Simplified0.1

      \[\leadsto \color{blue}{\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\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(t + 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 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)))