Average Error: 2.1 → 0.4
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}\;b \le -1222152538922250550351951625715712:\\ \;\;\;\;\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + a \cdot t\right)\\ \mathbf{elif}\;b \le 9.506576254366928178397427562354323697787 \cdot 10^{-109}:\\ \;\;\;\;\left(a \cdot t + x\right) + z \cdot \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + a \cdot 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 -1222152538922250550351951625715712:\\
\;\;\;\;\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + a \cdot t\right)\\

\mathbf{elif}\;b \le 9.506576254366928178397427562354323697787 \cdot 10^{-109}:\\
\;\;\;\;\left(a \cdot t + x\right) + z \cdot \left(y + a \cdot b\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r32782205 = x;
        double r32782206 = y;
        double r32782207 = z;
        double r32782208 = r32782206 * r32782207;
        double r32782209 = r32782205 + r32782208;
        double r32782210 = t;
        double r32782211 = a;
        double r32782212 = r32782210 * r32782211;
        double r32782213 = r32782209 + r32782212;
        double r32782214 = r32782211 * r32782207;
        double r32782215 = b;
        double r32782216 = r32782214 * r32782215;
        double r32782217 = r32782213 + r32782216;
        return r32782217;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r32782218 = b;
        double r32782219 = -1.2221525389222506e+33;
        bool r32782220 = r32782218 <= r32782219;
        double r32782221 = a;
        double r32782222 = z;
        double r32782223 = r32782221 * r32782222;
        double r32782224 = r32782223 * r32782218;
        double r32782225 = x;
        double r32782226 = y;
        double r32782227 = r32782226 * r32782222;
        double r32782228 = r32782225 + r32782227;
        double r32782229 = t;
        double r32782230 = r32782221 * r32782229;
        double r32782231 = r32782228 + r32782230;
        double r32782232 = r32782224 + r32782231;
        double r32782233 = 9.506576254366928e-109;
        bool r32782234 = r32782218 <= r32782233;
        double r32782235 = r32782230 + r32782225;
        double r32782236 = r32782221 * r32782218;
        double r32782237 = r32782226 + r32782236;
        double r32782238 = r32782222 * r32782237;
        double r32782239 = r32782235 + r32782238;
        double r32782240 = r32782234 ? r32782239 : r32782232;
        double r32782241 = r32782220 ? r32782232 : r32782240;
        return r32782241;
}

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.1
Target0.5
Herbie0.4
\[\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 b < -1.2221525389222506e+33 or 9.506576254366928e-109 < b

    1. Initial program 0.8

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

    if -1.2221525389222506e+33 < b < 9.506576254366928e-109

    1. Initial program 3.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1222152538922250550351951625715712:\\ \;\;\;\;\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + a \cdot t\right)\\ \mathbf{elif}\;b \le 9.506576254366928178397427562354323697787 \cdot 10^{-109}:\\ \;\;\;\;\left(a \cdot t + x\right) + z \cdot \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + a \cdot t\right)\\ \end{array}\]

Reproduce

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