Average Error: 2.0 → 0.5
Time: 5.0s
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.0470584125175238 \cdot 10^{54} \lor \neg \left(b \le 1.08530942283683892 \cdot 10^{105}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + a \cdot \left(z \cdot b\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.0470584125175238 \cdot 10^{54} \lor \neg \left(b \le 1.08530942283683892 \cdot 10^{105}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r684087 = x;
        double r684088 = y;
        double r684089 = z;
        double r684090 = r684088 * r684089;
        double r684091 = r684087 + r684090;
        double r684092 = t;
        double r684093 = a;
        double r684094 = r684092 * r684093;
        double r684095 = r684091 + r684094;
        double r684096 = r684093 * r684089;
        double r684097 = b;
        double r684098 = r684096 * r684097;
        double r684099 = r684095 + r684098;
        return r684099;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r684100 = b;
        double r684101 = -1.0470584125175238e+54;
        bool r684102 = r684100 <= r684101;
        double r684103 = 1.0853094228368389e+105;
        bool r684104 = r684100 <= r684103;
        double r684105 = !r684104;
        bool r684106 = r684102 || r684105;
        double r684107 = x;
        double r684108 = y;
        double r684109 = z;
        double r684110 = r684108 * r684109;
        double r684111 = r684107 + r684110;
        double r684112 = t;
        double r684113 = a;
        double r684114 = r684112 * r684113;
        double r684115 = r684111 + r684114;
        double r684116 = r684113 * r684109;
        double r684117 = r684116 * r684100;
        double r684118 = r684115 + r684117;
        double r684119 = r684109 * r684100;
        double r684120 = r684113 * r684119;
        double r684121 = r684115 + r684120;
        double r684122 = r684106 ? r684118 : r684121;
        return r684122;
}

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.5
\[\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.0470584125175238e+54 or 1.0853094228368389e+105 < 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 -1.0470584125175238e+54 < b < 1.0853094228368389e+105

    1. Initial program 2.7

      \[\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*0.4

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

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

Reproduce

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