Average Error: 1.8 → 0.3
Time: 13.3s
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 r494036 = x;
        double r494037 = y;
        double r494038 = z;
        double r494039 = r494037 * r494038;
        double r494040 = r494036 + r494039;
        double r494041 = t;
        double r494042 = a;
        double r494043 = r494041 * r494042;
        double r494044 = r494040 + r494043;
        double r494045 = r494042 * r494038;
        double r494046 = b;
        double r494047 = r494045 * r494046;
        double r494048 = r494044 + r494047;
        return r494048;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r494049 = a;
        double r494050 = -5.898618251789109e+86;
        bool r494051 = r494049 <= r494050;
        double r494052 = 7.188070421996829e+35;
        bool r494053 = r494049 <= r494052;
        double r494054 = !r494053;
        bool r494055 = r494051 || r494054;
        double r494056 = x;
        double r494057 = y;
        double r494058 = z;
        double r494059 = r494057 * r494058;
        double r494060 = r494056 + r494059;
        double r494061 = b;
        double r494062 = r494061 * r494058;
        double r494063 = t;
        double r494064 = r494062 + r494063;
        double r494065 = r494064 * r494049;
        double r494066 = r494060 + r494065;
        double r494067 = r494049 * r494063;
        double r494068 = r494067 + r494056;
        double r494069 = r494061 * r494049;
        double r494070 = r494057 + r494069;
        double r494071 = r494058 * r494070;
        double r494072 = r494068 + r494071;
        double r494073 = r494055 ? r494066 : r494072;
        return r494073;
}

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)))