Average Error: 1.8 → 0.3
Time: 13.2s
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}\;a \le -5.898618251789108878581101532339311639133 \cdot 10^{86} \lor \neg \left(a \le 718807042199682877794743731326287872\right):\\ \;\;\;\;\left(x + y \cdot z\right) + \left(b \cdot z + t\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot t + x\right) + z \cdot \left(y + b \cdot a\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}\;a \le -5.898618251789108878581101532339311639133 \cdot 10^{86} \lor \neg \left(a \le 718807042199682877794743731326287872\right):\\
\;\;\;\;\left(x + y \cdot z\right) + \left(b \cdot z + t\right) \cdot a\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r605166 = x;
        double r605167 = y;
        double r605168 = z;
        double r605169 = r605167 * r605168;
        double r605170 = r605166 + r605169;
        double r605171 = t;
        double r605172 = a;
        double r605173 = r605171 * r605172;
        double r605174 = r605170 + r605173;
        double r605175 = r605172 * r605168;
        double r605176 = b;
        double r605177 = r605175 * r605176;
        double r605178 = r605174 + r605177;
        return r605178;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r605179 = a;
        double r605180 = -5.898618251789109e+86;
        bool r605181 = r605179 <= r605180;
        double r605182 = 7.188070421996829e+35;
        bool r605183 = r605179 <= r605182;
        double r605184 = !r605183;
        bool r605185 = r605181 || r605184;
        double r605186 = x;
        double r605187 = y;
        double r605188 = z;
        double r605189 = r605187 * r605188;
        double r605190 = r605186 + r605189;
        double r605191 = b;
        double r605192 = r605191 * r605188;
        double r605193 = t;
        double r605194 = r605192 + r605193;
        double r605195 = r605194 * r605179;
        double r605196 = r605190 + r605195;
        double r605197 = r605179 * r605193;
        double r605198 = r605197 + r605186;
        double r605199 = r605191 * r605179;
        double r605200 = r605187 + r605199;
        double r605201 = r605188 * r605200;
        double r605202 = r605198 + r605201;
        double r605203 = r605185 ? r605196 : r605202;
        return r605203;
}

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

Original1.8
Target0.3
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888128:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.758974318836428710669076838657752600596 \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 a < -5.898618251789109e+86 or 7.188070421996829e+35 < a

    1. Initial program 5.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+5.7

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

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

    if -5.898618251789109e+86 < a < 7.188070421996829e+35

    1. Initial program 0.4

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

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

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

Reproduce

herbie shell --seed 2019194 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"

  :herbie-target
  (if (< z -1.1820553527347888e+19) (+ (* 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)))