Average Error: 2.2 → 2.4
Time: 3.0s
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}\;t \le -4.2444358340416075 \cdot 10^{-97}:\\ \;\;\;\;\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}\;t \le -4.2444358340416075 \cdot 10^{-97}:\\
\;\;\;\;\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 r607721 = x;
        double r607722 = y;
        double r607723 = z;
        double r607724 = r607722 * r607723;
        double r607725 = r607721 + r607724;
        double r607726 = t;
        double r607727 = a;
        double r607728 = r607726 * r607727;
        double r607729 = r607725 + r607728;
        double r607730 = r607727 * r607723;
        double r607731 = b;
        double r607732 = r607730 * r607731;
        double r607733 = r607729 + r607732;
        return r607733;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r607734 = t;
        double r607735 = -4.2444358340416075e-97;
        bool r607736 = r607734 <= r607735;
        double r607737 = x;
        double r607738 = y;
        double r607739 = z;
        double r607740 = r607738 * r607739;
        double r607741 = r607737 + r607740;
        double r607742 = a;
        double r607743 = r607734 * r607742;
        double r607744 = r607741 + r607743;
        double r607745 = r607742 * r607739;
        double r607746 = b;
        double r607747 = r607745 * r607746;
        double r607748 = r607744 + r607747;
        double r607749 = r607739 * r607746;
        double r607750 = r607734 + r607749;
        double r607751 = r607742 * r607750;
        double r607752 = r607737 + r607751;
        double r607753 = r607740 + r607752;
        double r607754 = r607736 ? r607748 : r607753;
        return r607754;
}

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.2
Target0.3
Herbie2.4
\[\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 t < -4.2444358340416075e-97

    1. Initial program 1.7

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

    if -4.2444358340416075e-97 < t

    1. Initial program 2.5

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

      \[\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 simplification2.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.2444358340416075 \cdot 10^{-97}:\\ \;\;\;\;\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 2020064 
(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)))