Average Error: 1.9 → 0.9
Time: 10.7s
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 -2.184598399887742151607503598727674179515 \cdot 10^{173} \lor \neg \left(b \le 4.256811503202536895550421344867914511115 \cdot 10^{-102}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\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 -2.184598399887742151607503598727674179515 \cdot 10^{173} \lor \neg \left(b \le 4.256811503202536895550421344867914511115 \cdot 10^{-102}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1064502 = x;
        double r1064503 = y;
        double r1064504 = z;
        double r1064505 = r1064503 * r1064504;
        double r1064506 = r1064502 + r1064505;
        double r1064507 = t;
        double r1064508 = a;
        double r1064509 = r1064507 * r1064508;
        double r1064510 = r1064506 + r1064509;
        double r1064511 = r1064508 * r1064504;
        double r1064512 = b;
        double r1064513 = r1064511 * r1064512;
        double r1064514 = r1064510 + r1064513;
        return r1064514;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1064515 = b;
        double r1064516 = -2.1845983998877422e+173;
        bool r1064517 = r1064515 <= r1064516;
        double r1064518 = 4.256811503202537e-102;
        bool r1064519 = r1064515 <= r1064518;
        double r1064520 = !r1064519;
        bool r1064521 = r1064517 || r1064520;
        double r1064522 = x;
        double r1064523 = y;
        double r1064524 = z;
        double r1064525 = r1064523 * r1064524;
        double r1064526 = r1064522 + r1064525;
        double r1064527 = t;
        double r1064528 = a;
        double r1064529 = r1064527 * r1064528;
        double r1064530 = r1064526 + r1064529;
        double r1064531 = r1064528 * r1064524;
        double r1064532 = r1064531 * r1064515;
        double r1064533 = r1064530 + r1064532;
        double r1064534 = r1064524 * r1064515;
        double r1064535 = r1064527 + r1064534;
        double r1064536 = r1064528 * r1064535;
        double r1064537 = r1064536 + r1064526;
        double r1064538 = r1064521 ? r1064533 : r1064537;
        return r1064538;
}

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.3
Herbie0.9
\[\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 < -2.1845983998877422e+173 or 4.256811503202537e-102 < 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 -2.1845983998877422e+173 < b < 4.256811503202537e-102

    1. Initial program 2.7

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

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

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

Reproduce

herbie shell --seed 2019209 
(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.75897431883642871e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))