Average Error: 2.3 → 2.3
Time: 14.9s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
double f(double x, double y, double z, double t, double a, double b) {
        double r39653687 = x;
        double r39653688 = y;
        double r39653689 = z;
        double r39653690 = r39653688 * r39653689;
        double r39653691 = r39653687 + r39653690;
        double r39653692 = t;
        double r39653693 = a;
        double r39653694 = r39653692 * r39653693;
        double r39653695 = r39653691 + r39653694;
        double r39653696 = r39653693 * r39653689;
        double r39653697 = b;
        double r39653698 = r39653696 * r39653697;
        double r39653699 = r39653695 + r39653698;
        return r39653699;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r39653700 = x;
        double r39653701 = y;
        double r39653702 = z;
        double r39653703 = r39653701 * r39653702;
        double r39653704 = r39653700 + r39653703;
        double r39653705 = t;
        double r39653706 = a;
        double r39653707 = r39653705 * r39653706;
        double r39653708 = r39653704 + r39653707;
        double r39653709 = r39653706 * r39653702;
        double r39653710 = b;
        double r39653711 = r39653709 * r39653710;
        double r39653712 = r39653708 + r39653711;
        return r39653712;
}

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.3
Target0.3
Herbie2.3
\[\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. Initial program 2.3

    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
  2. Final simplification2.3

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"

  :herbie-target
  (if (< z -1.1820553527347888e+19) (+ (* 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)))