Average Error: 16.1 → 9.8
Time: 22.1s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.6129028996072948 \cdot 10^{-92}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \frac{1}{a - t}, y, x + y\right)\\ \mathbf{elif}\;a \le 1.47262880459774894 \cdot 10^{-249}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{elif}\;a \le 8.97162726104096737 \cdot 10^{-84}:\\ \;\;\;\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\ \mathbf{elif}\;a \le 2.8419677495754645 \cdot 10^{-28}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \left(\left(\sqrt[3]{\frac{1}{a - t}} \cdot \sqrt[3]{\frac{1}{a - t}}\right) \cdot \sqrt[3]{\frac{1}{a - t}}\right), y, x + y\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -3.6129028996072948 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \frac{1}{a - t}, y, x + y\right)\\

\mathbf{elif}\;a \le 1.47262880459774894 \cdot 10^{-249}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

\mathbf{elif}\;a \le 8.97162726104096737 \cdot 10^{-84}:\\
\;\;\;\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\

\mathbf{elif}\;a \le 2.8419677495754645 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \left(\left(\sqrt[3]{\frac{1}{a - t}} \cdot \sqrt[3]{\frac{1}{a - t}}\right) \cdot \sqrt[3]{\frac{1}{a - t}}\right), y, x + y\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r362423 = x;
        double r362424 = y;
        double r362425 = r362423 + r362424;
        double r362426 = z;
        double r362427 = t;
        double r362428 = r362426 - r362427;
        double r362429 = r362428 * r362424;
        double r362430 = a;
        double r362431 = r362430 - r362427;
        double r362432 = r362429 / r362431;
        double r362433 = r362425 - r362432;
        return r362433;
}

double f(double x, double y, double z, double t, double a) {
        double r362434 = a;
        double r362435 = -3.612902899607295e-92;
        bool r362436 = r362434 <= r362435;
        double r362437 = t;
        double r362438 = z;
        double r362439 = r362437 - r362438;
        double r362440 = 1.0;
        double r362441 = r362434 - r362437;
        double r362442 = r362440 / r362441;
        double r362443 = r362439 * r362442;
        double r362444 = y;
        double r362445 = x;
        double r362446 = r362445 + r362444;
        double r362447 = fma(r362443, r362444, r362446);
        double r362448 = 1.472628804597749e-249;
        bool r362449 = r362434 <= r362448;
        double r362450 = r362438 / r362437;
        double r362451 = fma(r362450, r362444, r362445);
        double r362452 = 8.971627261040967e-84;
        bool r362453 = r362434 <= r362452;
        double r362454 = r362438 - r362437;
        double r362455 = r362454 * r362444;
        double r362456 = r362455 / r362441;
        double r362457 = r362446 - r362456;
        double r362458 = 2.8419677495754645e-28;
        bool r362459 = r362434 <= r362458;
        double r362460 = cbrt(r362442);
        double r362461 = r362460 * r362460;
        double r362462 = r362461 * r362460;
        double r362463 = r362439 * r362462;
        double r362464 = fma(r362463, r362444, r362446);
        double r362465 = r362459 ? r362451 : r362464;
        double r362466 = r362453 ? r362457 : r362465;
        double r362467 = r362449 ? r362451 : r362466;
        double r362468 = r362436 ? r362447 : r362467;
        return r362468;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.1
Target8.4
Herbie9.8
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \cdot 10^{-7}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt 1.47542934445772333 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if a < -3.612902899607295e-92

    1. Initial program 14.1

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Simplified7.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t - z}{a - t}, y, x + y\right)}\]
    3. Using strategy rm
    4. Applied div-inv7.2

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(t - z\right) \cdot \frac{1}{a - t}}, y, x + y\right)\]

    if -3.612902899607295e-92 < a < 1.472628804597749e-249 or 8.971627261040967e-84 < a < 2.8419677495754645e-28

    1. Initial program 18.8

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Simplified18.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t - z}{a - t}, y, x + y\right)}\]
    3. Taylor expanded around inf 12.8

      \[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
    4. Simplified11.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}\]

    if 1.472628804597749e-249 < a < 8.971627261040967e-84

    1. Initial program 20.4

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]

    if 2.8419677495754645e-28 < a

    1. Initial program 14.4

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Simplified6.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t - z}{a - t}, y, x + y\right)}\]
    3. Using strategy rm
    4. Applied div-inv6.8

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(t - z\right) \cdot \frac{1}{a - t}}, y, x + y\right)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt7.0

      \[\leadsto \mathsf{fma}\left(\left(t - z\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{1}{a - t}} \cdot \sqrt[3]{\frac{1}{a - t}}\right) \cdot \sqrt[3]{\frac{1}{a - t}}\right)}, y, x + y\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.6129028996072948 \cdot 10^{-92}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \frac{1}{a - t}, y, x + y\right)\\ \mathbf{elif}\;a \le 1.47262880459774894 \cdot 10^{-249}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{elif}\;a \le 8.97162726104096737 \cdot 10^{-84}:\\ \;\;\;\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\ \mathbf{elif}\;a \le 2.8419677495754645 \cdot 10^{-28}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - z\right) \cdot \left(\left(\sqrt[3]{\frac{1}{a - t}} \cdot \sqrt[3]{\frac{1}{a - t}}\right) \cdot \sqrt[3]{\frac{1}{a - t}}\right), y, x + y\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

  (- (+ x y) (/ (* (- z t) y) (- a t))))