Average Error: 2.2 → 0.4
Time: 10.5s
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 5.116019414478908543360651182801591114306 \cdot 10^{293}\right):\\ \;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\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 5.116019414478908543360651182801591114306 \cdot 10^{293}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\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 r1144803 = x;
        double r1144804 = y;
        double r1144805 = z;
        double r1144806 = r1144804 * r1144805;
        double r1144807 = r1144803 + r1144806;
        double r1144808 = t;
        double r1144809 = a;
        double r1144810 = r1144808 * r1144809;
        double r1144811 = r1144807 + r1144810;
        double r1144812 = r1144809 * r1144805;
        double r1144813 = b;
        double r1144814 = r1144812 * r1144813;
        double r1144815 = r1144811 + r1144814;
        return r1144815;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1144816 = x;
        double r1144817 = y;
        double r1144818 = z;
        double r1144819 = r1144817 * r1144818;
        double r1144820 = r1144816 + r1144819;
        double r1144821 = t;
        double r1144822 = a;
        double r1144823 = r1144821 * r1144822;
        double r1144824 = r1144820 + r1144823;
        double r1144825 = r1144822 * r1144818;
        double r1144826 = b;
        double r1144827 = r1144825 * r1144826;
        double r1144828 = r1144824 + r1144827;
        double r1144829 = -inf.0;
        bool r1144830 = r1144828 <= r1144829;
        double r1144831 = 5.1160194144789085e+293;
        bool r1144832 = r1144828 <= r1144831;
        double r1144833 = !r1144832;
        bool r1144834 = r1144830 || r1144833;
        double r1144835 = r1144818 * r1144826;
        double r1144836 = r1144821 + r1144835;
        double r1144837 = r1144822 * r1144836;
        double r1144838 = r1144837 + r1144820;
        double r1144839 = r1144834 ? r1144838 : r1144828;
        return r1144839;
}

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.4
Herbie0.4
\[\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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < -inf.0 or 5.1160194144789085e+293 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))

    1. Initial program 34.0

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

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

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

    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.4

    \[\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 5.116019414478908543360651182801591114306 \cdot 10^{293}\right):\\ \;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + y \cdot z\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 2019303 
(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)))