Average Error: 1.9 → 0.5
Time: 11.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 -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}\\ \mathbf{else}:\\ \;\;\;\;a \cdot t + \left(x + z \cdot \left(y + b \cdot a\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 -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r475148 = x;
        double r475149 = y;
        double r475150 = z;
        double r475151 = r475149 * r475150;
        double r475152 = r475148 + r475151;
        double r475153 = t;
        double r475154 = a;
        double r475155 = r475153 * r475154;
        double r475156 = r475152 + r475155;
        double r475157 = r475154 * r475150;
        double r475158 = b;
        double r475159 = r475157 * r475158;
        double r475160 = r475156 + r475159;
        return r475160;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r475161 = b;
        double r475162 = -1.7881082058704177e+30;
        bool r475163 = r475161 <= r475162;
        double r475164 = 6.065547839025837e+109;
        bool r475165 = r475161 <= r475164;
        double r475166 = !r475165;
        bool r475167 = r475163 || r475166;
        double r475168 = x;
        double r475169 = y;
        double r475170 = z;
        double r475171 = r475169 * r475170;
        double r475172 = r475168 + r475171;
        double r475173 = t;
        double r475174 = a;
        double r475175 = r475173 * r475174;
        double r475176 = r475172 + r475175;
        double r475177 = r475174 * r475170;
        double r475178 = cbrt(r475161);
        double r475179 = r475178 * r475178;
        double r475180 = r475177 * r475179;
        double r475181 = r475180 * r475178;
        double r475182 = r475176 + r475181;
        double r475183 = r475174 * r475173;
        double r475184 = r475161 * r475174;
        double r475185 = r475169 + r475184;
        double r475186 = r475170 * r475185;
        double r475187 = r475168 + r475186;
        double r475188 = r475183 + r475187;
        double r475189 = r475167 ? r475182 : r475188;
        return r475189;
}

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

Original1.9
Target0.4
Herbie0.5
\[\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.7881082058704177e+30 or 6.065547839025837e+109 < b

    1. Initial program 0.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 add-cube-cbrt1.1

      \[\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*1.1

      \[\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}}\]

    if -1.7881082058704177e+30 < b < 6.065547839025837e+109

    1. Initial program 2.5

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

      \[\leadsto \color{blue}{a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\right)}\]
    3. Using strategy rm
    4. Applied distribute-lft-in0.3

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

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

      \[\leadsto a \cdot t + \color{blue}{\left(\left(z \cdot b\right) \cdot a + \left(x + y \cdot z\right)\right)}\]
    7. Taylor expanded around inf 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1788108205870417660888775393280 \lor \neg \left(b \le 6.065547839025836903524779259049428175727 \cdot 10^{109}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}\\ \mathbf{else}:\\ \;\;\;\;a \cdot t + \left(x + z \cdot \left(y + b \cdot a\right)\right)\\ \end{array}\]

Reproduce

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