Average Error: 2.0 → 1.1
Time: 4.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}\;a \le 2.042851256725408 \cdot 10^{-11}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + {\left(a \cdot \left(z \cdot b\right)\right)}^{1}\\ \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}\;a \le 2.042851256725408 \cdot 10^{-11}:\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r702077 = x;
        double r702078 = y;
        double r702079 = z;
        double r702080 = r702078 * r702079;
        double r702081 = r702077 + r702080;
        double r702082 = t;
        double r702083 = a;
        double r702084 = r702082 * r702083;
        double r702085 = r702081 + r702084;
        double r702086 = r702083 * r702079;
        double r702087 = b;
        double r702088 = r702086 * r702087;
        double r702089 = r702085 + r702088;
        return r702089;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r702090 = a;
        double r702091 = 2.042851256725408e-11;
        bool r702092 = r702090 <= r702091;
        double r702093 = x;
        double r702094 = y;
        double r702095 = z;
        double r702096 = r702094 * r702095;
        double r702097 = r702093 + r702096;
        double r702098 = t;
        double r702099 = r702098 * r702090;
        double r702100 = r702097 + r702099;
        double r702101 = r702090 * r702095;
        double r702102 = b;
        double r702103 = r702101 * r702102;
        double r702104 = r702100 + r702103;
        double r702105 = r702095 * r702102;
        double r702106 = r702090 * r702105;
        double r702107 = 1.0;
        double r702108 = pow(r702106, r702107);
        double r702109 = r702100 + r702108;
        double r702110 = r702092 ? r702104 : r702109;
        return r702110;
}

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.0
Target0.4
Herbie1.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 a < 2.042851256725408e-11

    1. Initial program 1.4

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

    if 2.042851256725408e-11 < a

    1. Initial program 4.7

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied pow14.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot \color{blue}{{b}^{1}}\]
    4. Applied pow14.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \color{blue}{{z}^{1}}\right) \cdot {b}^{1}\]
    5. Applied pow14.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\color{blue}{{a}^{1}} \cdot {z}^{1}\right) \cdot {b}^{1}\]
    6. Applied pow-prod-down4.7

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{{\left(a \cdot z\right)}^{1}} \cdot {b}^{1}\]
    7. Applied pow-prod-down4.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le 2.042851256725408 \cdot 10^{-11}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + {\left(a \cdot \left(z \cdot b\right)\right)}^{1}\\ \end{array}\]

Reproduce

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