Average Error: 16.4 → 8.2
Time: 34.9s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.382440640320223928733814325683044872215 \cdot 10^{117}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{elif}\;t \le 2.716318285110477649425530294068824469982 \cdot 10^{127}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\frac{a - t}{\sqrt[3]{t}}} - \frac{z}{a - t}, y, x + y\right)\\ \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}\;t \le -1.382440640320223928733814325683044872215 \cdot 10^{117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

\mathbf{elif}\;t \le 2.716318285110477649425530294068824469982 \cdot 10^{127}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\frac{a - t}{\sqrt[3]{t}}} - \frac{z}{a - t}, y, x + y\right)\\

\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 r69928305 = x;
        double r69928306 = y;
        double r69928307 = r69928305 + r69928306;
        double r69928308 = z;
        double r69928309 = t;
        double r69928310 = r69928308 - r69928309;
        double r69928311 = r69928310 * r69928306;
        double r69928312 = a;
        double r69928313 = r69928312 - r69928309;
        double r69928314 = r69928311 / r69928313;
        double r69928315 = r69928307 - r69928314;
        return r69928315;
}

double f(double x, double y, double z, double t, double a) {
        double r69928316 = t;
        double r69928317 = -1.382440640320224e+117;
        bool r69928318 = r69928316 <= r69928317;
        double r69928319 = z;
        double r69928320 = r69928319 / r69928316;
        double r69928321 = y;
        double r69928322 = x;
        double r69928323 = fma(r69928320, r69928321, r69928322);
        double r69928324 = 2.7163182851104776e+127;
        bool r69928325 = r69928316 <= r69928324;
        double r69928326 = cbrt(r69928316);
        double r69928327 = r69928326 * r69928326;
        double r69928328 = a;
        double r69928329 = r69928328 - r69928316;
        double r69928330 = r69928329 / r69928326;
        double r69928331 = r69928327 / r69928330;
        double r69928332 = r69928319 / r69928329;
        double r69928333 = r69928331 - r69928332;
        double r69928334 = r69928322 + r69928321;
        double r69928335 = fma(r69928333, r69928321, r69928334);
        double r69928336 = r69928325 ? r69928335 : r69928323;
        double r69928337 = r69928318 ? r69928323 : r69928336;
        return r69928337;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.4
Target8.2
Herbie8.2
\[\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 t < -1.382440640320224e+117 or 2.7163182851104776e+127 < t

    1. Initial program 31.2

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

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

      \[\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.382440640320224e+117 < t < 2.7163182851104776e+127

    1. Initial program 9.4

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}{a - t} - \frac{z}{a - t}, y, x + y\right)\]
    7. Applied associate-/l*6.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.382440640320223928733814325683044872215 \cdot 10^{117}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{elif}\;t \le 2.716318285110477649425530294068824469982 \cdot 10^{127}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\frac{a - t}{\sqrt[3]{t}}} - \frac{z}{a - t}, y, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1.0 (- 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.0 (- a t))) y))))

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