Average Error: 2.1 → 0.4
Time: 17.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}\;a \le -4.539344998412310163216098726290806926989 \cdot 10^{-29} \lor \neg \left(a \le 6.32466299026394733247098424868204187227 \cdot 10^{118}\right):\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\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}\;a \le -4.539344998412310163216098726290806926989 \cdot 10^{-29} \lor \neg \left(a \le 6.32466299026394733247098424868204187227 \cdot 10^{118}\right):\\
\;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\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 r407257 = x;
        double r407258 = y;
        double r407259 = z;
        double r407260 = r407258 * r407259;
        double r407261 = r407257 + r407260;
        double r407262 = t;
        double r407263 = a;
        double r407264 = r407262 * r407263;
        double r407265 = r407261 + r407264;
        double r407266 = r407263 * r407259;
        double r407267 = b;
        double r407268 = r407266 * r407267;
        double r407269 = r407265 + r407268;
        return r407269;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r407270 = a;
        double r407271 = -4.53934499841231e-29;
        bool r407272 = r407270 <= r407271;
        double r407273 = 6.324662990263947e+118;
        bool r407274 = r407270 <= r407273;
        double r407275 = !r407274;
        bool r407276 = r407272 || r407275;
        double r407277 = x;
        double r407278 = y;
        double r407279 = z;
        double r407280 = r407278 * r407279;
        double r407281 = r407277 + r407280;
        double r407282 = t;
        double r407283 = b;
        double r407284 = r407279 * r407283;
        double r407285 = r407282 + r407284;
        double r407286 = r407270 * r407285;
        double r407287 = r407281 + r407286;
        double r407288 = r407282 * r407270;
        double r407289 = r407281 + r407288;
        double r407290 = r407270 * r407279;
        double r407291 = r407290 * r407283;
        double r407292 = r407289 + r407291;
        double r407293 = r407276 ? r407287 : r407292;
        return r407293;
}

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.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 a < -4.53934499841231e-29 or 6.324662990263947e+118 < a

    1. Initial program 5.6

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

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

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

    if -4.53934499841231e-29 < a < 6.324662990263947e+118

    1. Initial program 0.6

      \[\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}\;a \le -4.539344998412310163216098726290806926989 \cdot 10^{-29} \lor \neg \left(a \le 6.32466299026394733247098424868204187227 \cdot 10^{118}\right):\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(t + z \cdot b\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 2019304 
(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)))