Average Error: 2.1 → 0.4
Time: 4.5s
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 r654252 = x;
        double r654253 = y;
        double r654254 = z;
        double r654255 = r654253 * r654254;
        double r654256 = r654252 + r654255;
        double r654257 = t;
        double r654258 = a;
        double r654259 = r654257 * r654258;
        double r654260 = r654256 + r654259;
        double r654261 = r654258 * r654254;
        double r654262 = b;
        double r654263 = r654261 * r654262;
        double r654264 = r654260 + r654263;
        return r654264;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r654265 = b;
        double r654266 = -1.2260483342250231e+64;
        bool r654267 = r654265 <= r654266;
        double r654268 = 1.3931728005119902e+43;
        bool r654269 = r654265 <= r654268;
        double r654270 = !r654269;
        bool r654271 = r654267 || r654270;
        double r654272 = x;
        double r654273 = y;
        double r654274 = z;
        double r654275 = r654273 * r654274;
        double r654276 = r654272 + r654275;
        double r654277 = t;
        double r654278 = a;
        double r654279 = r654277 * r654278;
        double r654280 = r654276 + r654279;
        double r654281 = r654278 * r654274;
        double r654282 = r654281 * r654265;
        double r654283 = r654280 + r654282;
        double r654284 = r654274 * r654265;
        double r654285 = r654277 + r654284;
        double r654286 = r654278 * r654285;
        double r654287 = r654272 + r654286;
        double r654288 = r654275 + r654287;
        double r654289 = r654271 ? r654283 : r654288;
        return r654289;
}

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