Average Error: 16.7 → 8.8
Time: 32.0s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.322501464893627557227599266531121403226 \cdot 10^{-115} \lor \neg \left(a \le 1.132547627968652530752459014111872971988 \cdot 10^{-26}\right):\\ \;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.322501464893627557227599266531121403226 \cdot 10^{-115} \lor \neg \left(a \le 1.132547627968652530752459014111872971988 \cdot 10^{-26}\right):\\
\;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r349260 = x;
        double r349261 = y;
        double r349262 = r349260 + r349261;
        double r349263 = z;
        double r349264 = t;
        double r349265 = r349263 - r349264;
        double r349266 = r349265 * r349261;
        double r349267 = a;
        double r349268 = r349267 - r349264;
        double r349269 = r349266 / r349268;
        double r349270 = r349262 - r349269;
        return r349270;
}

double f(double x, double y, double z, double t, double a) {
        double r349271 = a;
        double r349272 = -2.3225014648936276e-115;
        bool r349273 = r349271 <= r349272;
        double r349274 = 1.1325476279686525e-26;
        bool r349275 = r349271 <= r349274;
        double r349276 = !r349275;
        bool r349277 = r349273 || r349276;
        double r349278 = t;
        double r349279 = z;
        double r349280 = r349278 - r349279;
        double r349281 = r349271 - r349278;
        double r349282 = r349280 / r349281;
        double r349283 = y;
        double r349284 = fma(r349282, r349283, r349283);
        double r349285 = x;
        double r349286 = r349284 + r349285;
        double r349287 = cbrt(r349286);
        double r349288 = r349287 * r349287;
        double r349289 = r349288 * r349287;
        double r349290 = r349279 / r349278;
        double r349291 = fma(r349290, r349283, r349285);
        double r349292 = r349277 ? r349289 : r349291;
        return r349292;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.7
Target8.8
Herbie8.8
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.366497088939072697550672266103566343531 \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.475429344457723334351036314450840066235 \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 2 regimes
  2. if a < -2.3225014648936276e-115 or 1.1325476279686525e-26 < a

    1. Initial program 14.7

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\frac{t - z}{a - t}} \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot \sqrt[3]{\frac{t - z}{a - t}}\right)} \cdot y + \left(x + y\right)\]
    7. Using strategy rm
    8. Applied add-cube-cbrt8.9

      \[\leadsto \color{blue}{\left(\sqrt[3]{\left(\left(\sqrt[3]{\frac{t - z}{a - t}} \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot y + \left(x + y\right)} \cdot \sqrt[3]{\left(\left(\sqrt[3]{\frac{t - z}{a - t}} \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot y + \left(x + y\right)}\right) \cdot \sqrt[3]{\left(\left(\sqrt[3]{\frac{t - z}{a - t}} \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot y + \left(x + y\right)}}\]
    9. Simplified8.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\right)} \cdot \sqrt[3]{\left(\left(\sqrt[3]{\frac{t - z}{a - t}} \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot \sqrt[3]{\frac{t - z}{a - t}}\right) \cdot y + \left(x + y\right)}\]
    10. Simplified6.8

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

    if -2.3225014648936276e-115 < a < 1.1325476279686525e-26

    1. Initial program 20.4

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.322501464893627557227599266531121403226 \cdot 10^{-115} \lor \neg \left(a \le 1.132547627968652530752459014111872971988 \cdot 10^{-26}\right):\\ \;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{t - z}{a - t}, y, y\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019306 +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-7) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.47542934445772333e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

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