Average Error: 2.0 → 0.7
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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 1.8357449125512327 \cdot 10^{262}\right):\\ \;\;\;\;\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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 1.8357449125512327 \cdot 10^{262}\right):\\
\;\;\;\;\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 r758355 = x;
        double r758356 = y;
        double r758357 = z;
        double r758358 = r758356 * r758357;
        double r758359 = r758355 + r758358;
        double r758360 = t;
        double r758361 = a;
        double r758362 = r758360 * r758361;
        double r758363 = r758359 + r758362;
        double r758364 = r758361 * r758357;
        double r758365 = b;
        double r758366 = r758364 * r758365;
        double r758367 = r758363 + r758366;
        return r758367;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r758368 = x;
        double r758369 = y;
        double r758370 = z;
        double r758371 = r758369 * r758370;
        double r758372 = r758368 + r758371;
        double r758373 = t;
        double r758374 = a;
        double r758375 = r758373 * r758374;
        double r758376 = r758372 + r758375;
        double r758377 = r758374 * r758370;
        double r758378 = b;
        double r758379 = r758377 * r758378;
        double r758380 = r758376 + r758379;
        double r758381 = -inf.0;
        bool r758382 = r758380 <= r758381;
        double r758383 = 1.8357449125512327e+262;
        bool r758384 = r758380 <= r758383;
        double r758385 = !r758384;
        bool r758386 = r758382 || r758385;
        double r758387 = r758370 * r758378;
        double r758388 = r758373 + r758387;
        double r758389 = r758374 * r758388;
        double r758390 = r758372 + r758389;
        double r758391 = r758386 ? r758390 : r758380;
        return r758391;
}

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.0
Target0.3
Herbie0.7
\[\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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < -inf.0 or 1.8357449125512327e+262 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))

    1. Initial program 16.7

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

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

    if -inf.0 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < 1.8357449125512327e+262

    1. Initial program 0.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 simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 1.8357449125512327 \cdot 10^{262}\right):\\ \;\;\;\;\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 2020046 
(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)))