Average Error: 2.1 → 1.2
Time: 14.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 -1.633099719810372038924919515496326271933 \cdot 10^{-76} \lor \neg \left(a \le 9.108876548869236631679254363644611836499 \cdot 10^{-243}\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}\;a \le -1.633099719810372038924919515496326271933 \cdot 10^{-76} \lor \neg \left(a \le 9.108876548869236631679254363644611836499 \cdot 10^{-243}\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 r370314 = x;
        double r370315 = y;
        double r370316 = z;
        double r370317 = r370315 * r370316;
        double r370318 = r370314 + r370317;
        double r370319 = t;
        double r370320 = a;
        double r370321 = r370319 * r370320;
        double r370322 = r370318 + r370321;
        double r370323 = r370320 * r370316;
        double r370324 = b;
        double r370325 = r370323 * r370324;
        double r370326 = r370322 + r370325;
        return r370326;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r370327 = a;
        double r370328 = -1.633099719810372e-76;
        bool r370329 = r370327 <= r370328;
        double r370330 = 9.108876548869237e-243;
        bool r370331 = r370327 <= r370330;
        double r370332 = !r370331;
        bool r370333 = r370329 || r370332;
        double r370334 = t;
        double r370335 = z;
        double r370336 = b;
        double r370337 = r370335 * r370336;
        double r370338 = r370334 + r370337;
        double r370339 = r370327 * r370338;
        double r370340 = x;
        double r370341 = y;
        double r370342 = r370341 * r370335;
        double r370343 = r370340 + r370342;
        double r370344 = r370339 + r370343;
        double r370345 = r370334 * r370327;
        double r370346 = r370343 + r370345;
        double r370347 = r370327 * r370335;
        double r370348 = r370347 * r370336;
        double r370349 = r370346 + r370348;
        double r370350 = r370333 ? r370344 : r370349;
        return r370350;
}

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.3
Herbie1.2
\[\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 < -1.633099719810372e-76 or 9.108876548869237e-243 < a

    1. Initial program 2.8

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

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

    if -1.633099719810372e-76 < a < 9.108876548869237e-243

    1. Initial program 0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.633099719810372038924919515496326271933 \cdot 10^{-76} \lor \neg \left(a \le 9.108876548869236631679254363644611836499 \cdot 10^{-243}\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 2019326 
(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)))