Average Error: 2.1 → 0.1
Time: 8.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}\;z \le -9.86863163542813958 \cdot 10^{61} \lor \neg \left(z \le 1.0568915565668573 \cdot 10^{33}\right):\\ \;\;\;\;\left(z \cdot \left(y + b \cdot a\right) + x\right) + t \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\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}\;z \le -9.86863163542813958 \cdot 10^{61} \lor \neg \left(z \le 1.0568915565668573 \cdot 10^{33}\right):\\
\;\;\;\;\left(z \cdot \left(y + b \cdot a\right) + x\right) + t \cdot a\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r3757 = x;
        double r3758 = y;
        double r3759 = z;
        double r3760 = r3758 * r3759;
        double r3761 = r3757 + r3760;
        double r3762 = t;
        double r3763 = a;
        double r3764 = r3762 * r3763;
        double r3765 = r3761 + r3764;
        double r3766 = r3763 * r3759;
        double r3767 = b;
        double r3768 = r3766 * r3767;
        double r3769 = r3765 + r3768;
        return r3769;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r3770 = z;
        double r3771 = -9.86863163542814e+61;
        bool r3772 = r3770 <= r3771;
        double r3773 = 1.0568915565668573e+33;
        bool r3774 = r3770 <= r3773;
        double r3775 = !r3774;
        bool r3776 = r3772 || r3775;
        double r3777 = y;
        double r3778 = b;
        double r3779 = a;
        double r3780 = r3778 * r3779;
        double r3781 = r3777 + r3780;
        double r3782 = r3770 * r3781;
        double r3783 = x;
        double r3784 = r3782 + r3783;
        double r3785 = t;
        double r3786 = r3785 * r3779;
        double r3787 = r3784 + r3786;
        double r3788 = r3777 * r3770;
        double r3789 = r3783 + r3788;
        double r3790 = r3770 * r3778;
        double r3791 = r3790 + r3785;
        double r3792 = r3779 * r3791;
        double r3793 = r3789 + r3792;
        double r3794 = r3776 ? r3787 : r3793;
        return r3794;
}

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.1
\[\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 z < -9.86863163542814e+61 or 1.0568915565668573e+33 < z

    1. Initial program 6.5

      \[\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+6.5

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

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

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

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

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

    if -9.86863163542814e+61 < z < 1.0568915565668573e+33

    1. Initial program 0.4

      \[\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+0.4

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

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

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

Reproduce

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