Average Error: 2.1 → 0.7
Time: 4.1s
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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 2.127724558569206 \cdot 10^{275}\right):\\ \;\;\;\;y \cdot z + \left(x + \left(a \cdot t + a \cdot \left(z \cdot b\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \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}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b = -\infty \lor \neg \left(\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \le 2.127724558569206 \cdot 10^{275}\right):\\
\;\;\;\;y \cdot z + \left(x + \left(a \cdot t + a \cdot \left(z \cdot b\right)\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r644638 = x;
        double r644639 = y;
        double r644640 = z;
        double r644641 = r644639 * r644640;
        double r644642 = r644638 + r644641;
        double r644643 = t;
        double r644644 = a;
        double r644645 = r644643 * r644644;
        double r644646 = r644642 + r644645;
        double r644647 = r644644 * r644640;
        double r644648 = b;
        double r644649 = r644647 * r644648;
        double r644650 = r644646 + r644649;
        return r644650;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r644651 = x;
        double r644652 = y;
        double r644653 = z;
        double r644654 = r644652 * r644653;
        double r644655 = r644651 + r644654;
        double r644656 = t;
        double r644657 = a;
        double r644658 = r644656 * r644657;
        double r644659 = r644655 + r644658;
        double r644660 = r644657 * r644653;
        double r644661 = b;
        double r644662 = r644660 * r644661;
        double r644663 = r644659 + r644662;
        double r644664 = -inf.0;
        bool r644665 = r644663 <= r644664;
        double r644666 = 2.1277245585692058e+275;
        bool r644667 = r644663 <= r644666;
        double r644668 = !r644667;
        bool r644669 = r644665 || r644668;
        double r644670 = r644657 * r644656;
        double r644671 = r644653 * r644661;
        double r644672 = r644657 * r644671;
        double r644673 = r644670 + r644672;
        double r644674 = r644651 + r644673;
        double r644675 = r644654 + r644674;
        double r644676 = r644669 ? r644675 : r644663;
        return r644676;
}

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.1
Target0.4
Herbie0.7
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888000:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.75897431883642871 \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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < -inf.0 or 2.1277245585692058e+275 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))

    1. Initial program 21.2

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

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

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

    if -inf.0 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < 2.1277245585692058e+275

    1. Initial program 0.3

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.7

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

Reproduce

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