Average Error: 1.9 → 1.2
Time: 7.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 r1247305 = x;
        double r1247306 = y;
        double r1247307 = z;
        double r1247308 = r1247306 * r1247307;
        double r1247309 = r1247305 + r1247308;
        double r1247310 = t;
        double r1247311 = a;
        double r1247312 = r1247310 * r1247311;
        double r1247313 = r1247309 + r1247312;
        double r1247314 = r1247311 * r1247307;
        double r1247315 = b;
        double r1247316 = r1247314 * r1247315;
        double r1247317 = r1247313 + r1247316;
        return r1247317;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1247318 = a;
        double r1247319 = -1.6703230867618247e+79;
        bool r1247320 = r1247318 <= r1247319;
        double r1247321 = x;
        double r1247322 = y;
        double r1247323 = z;
        double r1247324 = r1247322 * r1247323;
        double r1247325 = r1247321 + r1247324;
        double r1247326 = t;
        double r1247327 = b;
        double r1247328 = r1247323 * r1247327;
        double r1247329 = r1247326 + r1247328;
        double r1247330 = r1247318 * r1247329;
        double r1247331 = r1247325 + r1247330;
        double r1247332 = r1247326 * r1247318;
        double r1247333 = r1247325 + r1247332;
        double r1247334 = r1247318 * r1247323;
        double r1247335 = r1247334 * r1247327;
        double r1247336 = r1247333 + r1247335;
        double r1247337 = r1247320 ? r1247331 : r1247336;
        return r1247337;
}

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)))