Average Error: 2.0 → 1.0
Time: 5.4s
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 -1.625374371266990680822013191263407453732 \cdot 10^{97} \lor \neg \left(b \le 2.415252056082114662102450908306260614324 \cdot 10^{201}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\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}\;b \le -1.625374371266990680822013191263407453732 \cdot 10^{97} \lor \neg \left(b \le 2.415252056082114662102450908306260614324 \cdot 10^{201}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r681729 = x;
        double r681730 = y;
        double r681731 = z;
        double r681732 = r681730 * r681731;
        double r681733 = r681729 + r681732;
        double r681734 = t;
        double r681735 = a;
        double r681736 = r681734 * r681735;
        double r681737 = r681733 + r681736;
        double r681738 = r681735 * r681731;
        double r681739 = b;
        double r681740 = r681738 * r681739;
        double r681741 = r681737 + r681740;
        return r681741;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r681742 = b;
        double r681743 = -1.6253743712669907e+97;
        bool r681744 = r681742 <= r681743;
        double r681745 = 2.4152520560821147e+201;
        bool r681746 = r681742 <= r681745;
        double r681747 = !r681746;
        bool r681748 = r681744 || r681747;
        double r681749 = x;
        double r681750 = y;
        double r681751 = z;
        double r681752 = r681750 * r681751;
        double r681753 = r681749 + r681752;
        double r681754 = t;
        double r681755 = a;
        double r681756 = r681754 * r681755;
        double r681757 = r681753 + r681756;
        double r681758 = r681755 * r681751;
        double r681759 = r681758 * r681742;
        double r681760 = r681757 + r681759;
        double r681761 = r681751 * r681742;
        double r681762 = r681754 + r681761;
        double r681763 = r681755 * r681762;
        double r681764 = r681749 + r681763;
        double r681765 = r681752 + r681764;
        double r681766 = r681748 ? r681760 : r681765;
        return r681766;
}

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
Herbie1.0
\[\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.6253743712669907e+97 or 2.4152520560821147e+201 < 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.6253743712669907e+97 < b < 2.4152520560821147e+201

    1. Initial program 2.3

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

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

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

Reproduce

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

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