Average Error: 2.1 → 0.4
Time: 4.2s
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 -1.2260483342250231 \cdot 10^{64} \lor \neg \left(b \le 1.39317280051199017 \cdot 10^{43}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\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 -1.2260483342250231 \cdot 10^{64} \lor \neg \left(b \le 1.39317280051199017 \cdot 10^{43}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r722283 = x;
        double r722284 = y;
        double r722285 = z;
        double r722286 = r722284 * r722285;
        double r722287 = r722283 + r722286;
        double r722288 = t;
        double r722289 = a;
        double r722290 = r722288 * r722289;
        double r722291 = r722287 + r722290;
        double r722292 = r722289 * r722285;
        double r722293 = b;
        double r722294 = r722292 * r722293;
        double r722295 = r722291 + r722294;
        return r722295;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r722296 = b;
        double r722297 = -1.2260483342250231e+64;
        bool r722298 = r722296 <= r722297;
        double r722299 = 1.3931728005119902e+43;
        bool r722300 = r722296 <= r722299;
        double r722301 = !r722300;
        bool r722302 = r722298 || r722301;
        double r722303 = x;
        double r722304 = y;
        double r722305 = z;
        double r722306 = r722304 * r722305;
        double r722307 = r722303 + r722306;
        double r722308 = t;
        double r722309 = a;
        double r722310 = r722308 * r722309;
        double r722311 = r722307 + r722310;
        double r722312 = r722309 * r722305;
        double r722313 = r722312 * r722296;
        double r722314 = r722311 + r722313;
        double r722315 = r722305 * r722296;
        double r722316 = r722308 + r722315;
        double r722317 = r722309 * r722316;
        double r722318 = r722303 + r722317;
        double r722319 = r722306 + r722318;
        double r722320 = r722302 ? r722314 : r722319;
        return r722320;
}

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.1
Target0.3
Herbie0.4
\[\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 b < -1.2260483342250231e+64 or 1.3931728005119902e+43 < b

    1. Initial program 0.8

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

    if -1.2260483342250231e+64 < b < 1.3931728005119902e+43

    1. Initial program 2.9

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

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

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

Reproduce

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