Average Error: 16.7 → 8.4
Time: 31.3s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.779827711068164583616374224793799672309 \cdot 10^{85} \lor \neg \left(t \le 5.547130691672522804697196022043674214808 \cdot 10^{55}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}}, \frac{y}{\frac{a}{\sqrt[3]{t - z}} - \frac{t}{\sqrt[3]{t - z}}}, x + y\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -2.779827711068164583616374224793799672309 \cdot 10^{85} \lor \neg \left(t \le 5.547130691672522804697196022043674214808 \cdot 10^{55}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r345220 = x;
        double r345221 = y;
        double r345222 = r345220 + r345221;
        double r345223 = z;
        double r345224 = t;
        double r345225 = r345223 - r345224;
        double r345226 = r345225 * r345221;
        double r345227 = a;
        double r345228 = r345227 - r345224;
        double r345229 = r345226 / r345228;
        double r345230 = r345222 - r345229;
        return r345230;
}

double f(double x, double y, double z, double t, double a) {
        double r345231 = t;
        double r345232 = -2.7798277110681646e+85;
        bool r345233 = r345231 <= r345232;
        double r345234 = 5.547130691672523e+55;
        bool r345235 = r345231 <= r345234;
        double r345236 = !r345235;
        bool r345237 = r345233 || r345236;
        double r345238 = z;
        double r345239 = r345238 / r345231;
        double r345240 = y;
        double r345241 = x;
        double r345242 = fma(r345239, r345240, r345241);
        double r345243 = 1.0;
        double r345244 = r345231 - r345238;
        double r345245 = cbrt(r345244);
        double r345246 = r345245 * r345245;
        double r345247 = r345243 / r345246;
        double r345248 = r345243 / r345247;
        double r345249 = a;
        double r345250 = r345249 / r345245;
        double r345251 = r345231 / r345245;
        double r345252 = r345250 - r345251;
        double r345253 = r345240 / r345252;
        double r345254 = r345241 + r345240;
        double r345255 = fma(r345248, r345253, r345254);
        double r345256 = r345237 ? r345242 : r345255;
        return r345256;
}

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.3
Herbie8.4
\[\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 < -2.7798277110681646e+85 or 5.547130691672523e+55 < t

    1. Initial program 29.2

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

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

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

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

    if -2.7798277110681646e+85 < t < 5.547130691672523e+55

    1. Initial program 7.6

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{t - z} - \frac{t}{t - z}} \cdot y + \left(x + y\right)}\]
    9. Simplified5.6

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{t - z} - \frac{t}{t - z}}} + \left(x + y\right)\]
    10. Using strategy rm
    11. Applied add-cube-cbrt5.7

      \[\leadsto \frac{y}{\frac{a}{t - z} - \frac{t}{\color{blue}{\left(\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}\right) \cdot \sqrt[3]{t - z}}}} + \left(x + y\right)\]
    12. Applied *-un-lft-identity5.7

      \[\leadsto \frac{y}{\frac{a}{t - z} - \frac{\color{blue}{1 \cdot t}}{\left(\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}\right) \cdot \sqrt[3]{t - z}}} + \left(x + y\right)\]
    13. Applied times-frac5.7

      \[\leadsto \frac{y}{\frac{a}{t - z} - \color{blue}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \frac{t}{\sqrt[3]{t - z}}}} + \left(x + y\right)\]
    14. Applied add-cube-cbrt5.8

      \[\leadsto \frac{y}{\frac{a}{\color{blue}{\left(\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}\right) \cdot \sqrt[3]{t - z}}} - \frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \frac{t}{\sqrt[3]{t - z}}} + \left(x + y\right)\]
    15. Applied *-un-lft-identity5.8

      \[\leadsto \frac{y}{\frac{\color{blue}{1 \cdot a}}{\left(\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}\right) \cdot \sqrt[3]{t - z}} - \frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \frac{t}{\sqrt[3]{t - z}}} + \left(x + y\right)\]
    16. Applied times-frac5.8

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \frac{a}{\sqrt[3]{t - z}}} - \frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \frac{t}{\sqrt[3]{t - z}}} + \left(x + y\right)\]
    17. Applied distribute-lft-out--5.8

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \left(\frac{a}{\sqrt[3]{t - z}} - \frac{t}{\sqrt[3]{t - z}}\right)}} + \left(x + y\right)\]
    18. Applied *-un-lft-identity5.8

      \[\leadsto \frac{\color{blue}{1 \cdot y}}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}} \cdot \left(\frac{a}{\sqrt[3]{t - z}} - \frac{t}{\sqrt[3]{t - z}}\right)} + \left(x + y\right)\]
    19. Applied times-frac5.0

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}} \cdot \frac{y}{\frac{a}{\sqrt[3]{t - z}} - \frac{t}{\sqrt[3]{t - z}}}} + \left(x + y\right)\]
    20. Applied fma-def5.0

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

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

Reproduce

herbie shell --seed 2019347 +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))))