Average Error: 2.0 → 0.1
Time: 33.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}\;z \le -9.83355154561418 \cdot 10^{+29}:\\ \;\;\;\;a \cdot t + \left(x + z \cdot \left(a \cdot b + y\right)\right)\\ \mathbf{elif}\;z \le 1.2529910400748553 \cdot 10^{-43}:\\ \;\;\;\;\left(y \cdot z + x\right) + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot t + \left(x + z \cdot \left(a \cdot b + y\right)\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}\;z \le -9.83355154561418 \cdot 10^{+29}:\\
\;\;\;\;a \cdot t + \left(x + z \cdot \left(a \cdot b + y\right)\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r28397850 = x;
        double r28397851 = y;
        double r28397852 = z;
        double r28397853 = r28397851 * r28397852;
        double r28397854 = r28397850 + r28397853;
        double r28397855 = t;
        double r28397856 = a;
        double r28397857 = r28397855 * r28397856;
        double r28397858 = r28397854 + r28397857;
        double r28397859 = r28397856 * r28397852;
        double r28397860 = b;
        double r28397861 = r28397859 * r28397860;
        double r28397862 = r28397858 + r28397861;
        return r28397862;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r28397863 = z;
        double r28397864 = -9.83355154561418e+29;
        bool r28397865 = r28397863 <= r28397864;
        double r28397866 = a;
        double r28397867 = t;
        double r28397868 = r28397866 * r28397867;
        double r28397869 = x;
        double r28397870 = b;
        double r28397871 = r28397866 * r28397870;
        double r28397872 = y;
        double r28397873 = r28397871 + r28397872;
        double r28397874 = r28397863 * r28397873;
        double r28397875 = r28397869 + r28397874;
        double r28397876 = r28397868 + r28397875;
        double r28397877 = 1.2529910400748553e-43;
        bool r28397878 = r28397863 <= r28397877;
        double r28397879 = r28397872 * r28397863;
        double r28397880 = r28397879 + r28397869;
        double r28397881 = r28397863 * r28397870;
        double r28397882 = r28397867 + r28397881;
        double r28397883 = r28397866 * r28397882;
        double r28397884 = r28397880 + r28397883;
        double r28397885 = r28397878 ? r28397884 : r28397876;
        double r28397886 = r28397865 ? r28397876 : r28397885;
        return r28397886;
}

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.1
\[\begin{array}{l} \mathbf{if}\;z \lt -1.1820553527347888 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.7589743188364287 \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 z < -9.83355154561418e+29 or 1.2529910400748553e-43 < z

    1. Initial program 4.4

      \[\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+4.4

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

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{a \cdot \left(b \cdot z + t\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-in7.2

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{\left(\left(b \cdot z\right) \cdot a + t \cdot a\right)}\]
    7. Applied associate-+r+7.2

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

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

    if -9.83355154561418e+29 < z < 1.2529910400748553e-43

    1. Initial program 0.4

      \[\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 \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(b \cdot z + t\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

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

Reproduce

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