Average Error: 2.0 → 0.7
Time: 7.8s
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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 1.8357449125512327 \cdot 10^{262}\right):\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 1.8357449125512327 \cdot 10^{262}\right):\\
\;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r822918 = x;
        double r822919 = y;
        double r822920 = z;
        double r822921 = r822919 * r822920;
        double r822922 = r822918 + r822921;
        double r822923 = t;
        double r822924 = a;
        double r822925 = r822923 * r822924;
        double r822926 = r822922 + r822925;
        double r822927 = r822924 * r822920;
        double r822928 = b;
        double r822929 = r822927 * r822928;
        double r822930 = r822926 + r822929;
        return r822930;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r822931 = x;
        double r822932 = y;
        double r822933 = z;
        double r822934 = r822932 * r822933;
        double r822935 = r822931 + r822934;
        double r822936 = t;
        double r822937 = a;
        double r822938 = r822936 * r822937;
        double r822939 = r822935 + r822938;
        double r822940 = r822937 * r822933;
        double r822941 = b;
        double r822942 = r822940 * r822941;
        double r822943 = r822939 + r822942;
        double r822944 = -inf.0;
        bool r822945 = r822943 <= r822944;
        double r822946 = 1.8357449125512327e+262;
        bool r822947 = r822943 <= r822946;
        double r822948 = !r822947;
        bool r822949 = r822945 || r822948;
        double r822950 = r822933 * r822941;
        double r822951 = r822936 + r822950;
        double r822952 = r822937 * r822951;
        double r822953 = r822935 + r822952;
        double r822954 = r822949 ? r822953 : r822943;
        return r822954;
}

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.3
Herbie0.7
\[\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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < -inf.0 or 1.8357449125512327e+262 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))

    1. Initial program 16.7

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

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

    if -inf.0 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < 1.8357449125512327e+262

    1. Initial program 0.3

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

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

Reproduce

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