Average Error: 2.0 → 1.2
Time: 4.2s
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 -6.529566600492990420691490017485673591516 \cdot 10^{-76} \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}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(z \cdot b + t\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 -6.529566600492990420691490017485673591516 \cdot 10^{-76} \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}:\\
\;\;\;\;\left(x + y \cdot z\right) + \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(z \cdot b + t\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r731728 = x;
        double r731729 = y;
        double r731730 = z;
        double r731731 = r731729 * r731730;
        double r731732 = r731728 + r731731;
        double r731733 = t;
        double r731734 = a;
        double r731735 = r731733 * r731734;
        double r731736 = r731732 + r731735;
        double r731737 = r731734 * r731730;
        double r731738 = b;
        double r731739 = r731737 * r731738;
        double r731740 = r731736 + r731739;
        return r731740;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r731741 = b;
        double r731742 = -6.52956660049299e-76;
        bool r731743 = r731741 <= r731742;
        double r731744 = 2.4152520560821147e+201;
        bool r731745 = r731741 <= r731744;
        double r731746 = !r731745;
        bool r731747 = r731743 || r731746;
        double r731748 = x;
        double r731749 = y;
        double r731750 = z;
        double r731751 = r731749 * r731750;
        double r731752 = r731748 + r731751;
        double r731753 = t;
        double r731754 = a;
        double r731755 = r731753 * r731754;
        double r731756 = r731752 + r731755;
        double r731757 = r731754 * r731750;
        double r731758 = r731757 * r731741;
        double r731759 = r731756 + r731758;
        double r731760 = cbrt(r731754);
        double r731761 = r731760 * r731760;
        double r731762 = r731750 * r731741;
        double r731763 = r731762 + r731753;
        double r731764 = r731760 * r731763;
        double r731765 = r731761 * r731764;
        double r731766 = r731752 + r731765;
        double r731767 = r731747 ? r731759 : r731766;
        return r731767;
}

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.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 b < -6.52956660049299e-76 or 2.4152520560821147e+201 < b

    1. Initial program 0.7

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

    if -6.52956660049299e-76 < b < 2.4152520560821147e+201

    1. Initial program 2.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+2.7

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

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{a \cdot \left(z \cdot b + t\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt1.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.529566600492990420691490017485673591516 \cdot 10^{-76} \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}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \left(\sqrt[3]{a} \cdot \left(z \cdot b + t\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)))