Average Error: 2.2 → 0.4
Time: 5.1s
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 -6.015094620886468 \cdot 10^{50} \lor \neg \left(b \le 4.25415853079040421 \cdot 10^{40}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\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 -6.015094620886468 \cdot 10^{50} \lor \neg \left(b \le 4.25415853079040421 \cdot 10^{40}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r585155 = x;
        double r585156 = y;
        double r585157 = z;
        double r585158 = r585156 * r585157;
        double r585159 = r585155 + r585158;
        double r585160 = t;
        double r585161 = a;
        double r585162 = r585160 * r585161;
        double r585163 = r585159 + r585162;
        double r585164 = r585161 * r585157;
        double r585165 = b;
        double r585166 = r585164 * r585165;
        double r585167 = r585163 + r585166;
        return r585167;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r585168 = b;
        double r585169 = -6.015094620886468e+50;
        bool r585170 = r585168 <= r585169;
        double r585171 = 4.254158530790404e+40;
        bool r585172 = r585168 <= r585171;
        double r585173 = !r585172;
        bool r585174 = r585170 || r585173;
        double r585175 = x;
        double r585176 = y;
        double r585177 = z;
        double r585178 = r585176 * r585177;
        double r585179 = r585175 + r585178;
        double r585180 = t;
        double r585181 = a;
        double r585182 = r585180 * r585181;
        double r585183 = r585179 + r585182;
        double r585184 = r585181 * r585177;
        double r585185 = r585184 * r585168;
        double r585186 = r585183 + r585185;
        double r585187 = r585177 * r585168;
        double r585188 = r585187 + r585180;
        double r585189 = r585181 * r585188;
        double r585190 = r585179 + r585189;
        double r585191 = r585174 ? r585186 : r585190;
        return r585191;
}

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.2
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 < -6.015094620886468e+50 or 4.254158530790404e+40 < 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 -6.015094620886468e+50 < b < 4.254158530790404e+40

    1. Initial program 3.1

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-+l+3.1

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

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

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

Reproduce

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