Average Error: 2.0 → 1.2
Time: 42.9s
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 2.289140927704578058538453283100075846866 \cdot 10^{-92}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b + \left(a \cdot t + \left(x + y \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot t + \left(x + y \cdot z\right)\right) + \left(b \cdot z\right) \cdot a\\ \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 2.289140927704578058538453283100075846866 \cdot 10^{-92}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b + \left(a \cdot t + \left(x + y \cdot z\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r28391069 = x;
        double r28391070 = y;
        double r28391071 = z;
        double r28391072 = r28391070 * r28391071;
        double r28391073 = r28391069 + r28391072;
        double r28391074 = t;
        double r28391075 = a;
        double r28391076 = r28391074 * r28391075;
        double r28391077 = r28391073 + r28391076;
        double r28391078 = r28391075 * r28391071;
        double r28391079 = b;
        double r28391080 = r28391078 * r28391079;
        double r28391081 = r28391077 + r28391080;
        return r28391081;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r28391082 = a;
        double r28391083 = 2.289140927704578e-92;
        bool r28391084 = r28391082 <= r28391083;
        double r28391085 = z;
        double r28391086 = r28391085 * r28391082;
        double r28391087 = b;
        double r28391088 = r28391086 * r28391087;
        double r28391089 = t;
        double r28391090 = r28391082 * r28391089;
        double r28391091 = x;
        double r28391092 = y;
        double r28391093 = r28391092 * r28391085;
        double r28391094 = r28391091 + r28391093;
        double r28391095 = r28391090 + r28391094;
        double r28391096 = r28391088 + r28391095;
        double r28391097 = r28391087 * r28391085;
        double r28391098 = r28391097 * r28391082;
        double r28391099 = r28391095 + r28391098;
        double r28391100 = r28391084 ? r28391096 : r28391099;
        return r28391100;
}

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
Herbie1.2
\[\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 < 2.289140927704578e-92

    1. Initial program 1.5

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

    if 2.289140927704578e-92 < a

    1. Initial program 3.5

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied add-cube-cbrt3.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot \color{blue}{\left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}\right)}\]
    4. Applied associate-*r*3.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}}\]
    5. Using strategy rm
    6. Applied associate-*l*1.3

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right)} \cdot \sqrt[3]{b}\]
    7. Using strategy rm
    8. Applied associate-*l*0.6

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

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

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

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(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)))