Average Error: 2.2 → 0.8
Time: 4.4s
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 -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\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 -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\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 r677907 = x;
        double r677908 = y;
        double r677909 = z;
        double r677910 = r677908 * r677909;
        double r677911 = r677907 + r677910;
        double r677912 = t;
        double r677913 = a;
        double r677914 = r677912 * r677913;
        double r677915 = r677911 + r677914;
        double r677916 = r677913 * r677909;
        double r677917 = b;
        double r677918 = r677916 * r677917;
        double r677919 = r677915 + r677918;
        return r677919;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r677920 = b;
        double r677921 = -7.48864513222409e+114;
        bool r677922 = r677920 <= r677921;
        double r677923 = 7.394757241471236e+132;
        bool r677924 = r677920 <= r677923;
        double r677925 = !r677924;
        bool r677926 = r677922 || r677925;
        double r677927 = x;
        double r677928 = y;
        double r677929 = z;
        double r677930 = r677928 * r677929;
        double r677931 = r677927 + r677930;
        double r677932 = t;
        double r677933 = a;
        double r677934 = r677932 * r677933;
        double r677935 = r677931 + r677934;
        double r677936 = r677933 * r677929;
        double r677937 = r677936 * r677920;
        double r677938 = r677935 + r677937;
        double r677939 = r677929 * r677920;
        double r677940 = r677939 + r677932;
        double r677941 = r677933 * r677940;
        double r677942 = r677931 + r677941;
        double r677943 = r677926 ? r677938 : r677942;
        return r677943;
}

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.8
\[\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 < -7.48864513222409e+114 or 7.394757241471236e+132 < b

    1. Initial program 1.0

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

    if -7.48864513222409e+114 < b < 7.394757241471236e+132

    1. Initial program 2.6

      \[\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+2.6

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

      \[\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.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\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 2020036 
(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)))