Average Error: 1.9 → 0.3
Time: 8.3s
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}\;b \le -1.105946974802992278559418043363022786483 \cdot 10^{84} \lor \neg \left(b \le 2.275670857919027604786398689364637711891 \cdot 10^{-29}\right):\\ \;\;\;\;\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) + a \cdot \left(z \cdot b\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}\;b \le -1.105946974802992278559418043363022786483 \cdot 10^{84} \lor \neg \left(b \le 2.275670857919027604786398689364637711891 \cdot 10^{-29}\right):\\
\;\;\;\;\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) + a \cdot \left(z \cdot b\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r397096 = x;
        double r397097 = y;
        double r397098 = z;
        double r397099 = r397097 * r397098;
        double r397100 = r397096 + r397099;
        double r397101 = t;
        double r397102 = a;
        double r397103 = r397101 * r397102;
        double r397104 = r397100 + r397103;
        double r397105 = r397102 * r397098;
        double r397106 = b;
        double r397107 = r397105 * r397106;
        double r397108 = r397104 + r397107;
        return r397108;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r397109 = b;
        double r397110 = -1.1059469748029923e+84;
        bool r397111 = r397109 <= r397110;
        double r397112 = 2.2756708579190276e-29;
        bool r397113 = r397109 <= r397112;
        double r397114 = !r397113;
        bool r397115 = r397111 || r397114;
        double r397116 = x;
        double r397117 = y;
        double r397118 = z;
        double r397119 = r397117 * r397118;
        double r397120 = r397116 + r397119;
        double r397121 = t;
        double r397122 = a;
        double r397123 = r397121 * r397122;
        double r397124 = r397120 + r397123;
        double r397125 = r397122 * r397118;
        double r397126 = r397125 * r397109;
        double r397127 = r397124 + r397126;
        double r397128 = r397118 * r397109;
        double r397129 = r397122 * r397128;
        double r397130 = r397124 + r397129;
        double r397131 = r397115 ? r397127 : r397130;
        return r397131;
}

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

Original1.9
Target0.3
Herbie0.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. Split input into 2 regimes
  2. if b < -1.1059469748029923e+84 or 2.2756708579190276e-29 < b

    1. Initial program 0.6

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

    if -1.1059469748029923e+84 < b < 2.2756708579190276e-29

    1. Initial program 2.8

      \[\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.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.105946974802992278559418043363022786483 \cdot 10^{84} \lor \neg \left(b \le 2.275670857919027604786398689364637711891 \cdot 10^{-29}\right):\\ \;\;\;\;\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) + a \cdot \left(z \cdot b\right)\\ \end{array}\]

Reproduce

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