Average Error: 2.0 → 0.4
Time: 3.7s
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 -8.62178112851556249 \cdot 10^{67} \lor \neg \left(b \le 5.4395231278996286 \cdot 10^{-95}\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 -8.62178112851556249 \cdot 10^{67} \lor \neg \left(b \le 5.4395231278996286 \cdot 10^{-95}\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 r1473268 = x;
        double r1473269 = y;
        double r1473270 = z;
        double r1473271 = r1473269 * r1473270;
        double r1473272 = r1473268 + r1473271;
        double r1473273 = t;
        double r1473274 = a;
        double r1473275 = r1473273 * r1473274;
        double r1473276 = r1473272 + r1473275;
        double r1473277 = r1473274 * r1473270;
        double r1473278 = b;
        double r1473279 = r1473277 * r1473278;
        double r1473280 = r1473276 + r1473279;
        return r1473280;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1473281 = b;
        double r1473282 = -8.621781128515562e+67;
        bool r1473283 = r1473281 <= r1473282;
        double r1473284 = 5.4395231278996286e-95;
        bool r1473285 = r1473281 <= r1473284;
        double r1473286 = !r1473285;
        bool r1473287 = r1473283 || r1473286;
        double r1473288 = x;
        double r1473289 = y;
        double r1473290 = z;
        double r1473291 = r1473289 * r1473290;
        double r1473292 = r1473288 + r1473291;
        double r1473293 = t;
        double r1473294 = a;
        double r1473295 = r1473293 * r1473294;
        double r1473296 = r1473292 + r1473295;
        double r1473297 = r1473294 * r1473290;
        double r1473298 = r1473297 * r1473281;
        double r1473299 = r1473296 + r1473298;
        double r1473300 = r1473290 * r1473281;
        double r1473301 = r1473293 + r1473300;
        double r1473302 = r1473294 * r1473301;
        double r1473303 = r1473288 + r1473302;
        double r1473304 = r1473291 + r1473303;
        double r1473305 = r1473287 ? r1473299 : r1473304;
        return r1473305;
}

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.4
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 < -8.621781128515562e+67 or 5.4395231278996286e-95 < b

    1. Initial program 0.7

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

    if -8.621781128515562e+67 < b < 5.4395231278996286e-95

    1. Initial program 3.2

      \[\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 -8.62178112851556249 \cdot 10^{67} \lor \neg \left(b \le 5.4395231278996286 \cdot 10^{-95}\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 2020057 
(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)))