Average Error: 16.4 → 8.4
Time: 4.4s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.15793160420448230149828002182071870307 \cdot 10^{100} \lor \neg \left(t \le 382400113499174194852810194944\right):\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}}}, \frac{t - z}{\frac{a - t}{\sqrt[3]{y}}}, 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 -9.15793160420448230149828002182071870307 \cdot 10^{100} \lor \neg \left(t \le 382400113499174194852810194944\right):\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r589005 = x;
        double r589006 = y;
        double r589007 = r589005 + r589006;
        double r589008 = z;
        double r589009 = t;
        double r589010 = r589008 - r589009;
        double r589011 = r589010 * r589006;
        double r589012 = a;
        double r589013 = r589012 - r589009;
        double r589014 = r589011 / r589013;
        double r589015 = r589007 - r589014;
        return r589015;
}

double f(double x, double y, double z, double t, double a) {
        double r589016 = t;
        double r589017 = -9.157931604204482e+100;
        bool r589018 = r589016 <= r589017;
        double r589019 = 3.824001134991742e+29;
        bool r589020 = r589016 <= r589019;
        double r589021 = !r589020;
        bool r589022 = r589018 || r589021;
        double r589023 = 1.0;
        double r589024 = z;
        double r589025 = r589024 / r589016;
        double r589026 = y;
        double r589027 = x;
        double r589028 = fma(r589025, r589026, r589027);
        double r589029 = r589023 * r589028;
        double r589030 = cbrt(r589026);
        double r589031 = r589030 * r589030;
        double r589032 = r589023 / r589031;
        double r589033 = r589023 / r589032;
        double r589034 = r589016 - r589024;
        double r589035 = a;
        double r589036 = r589035 - r589016;
        double r589037 = r589036 / r589030;
        double r589038 = r589034 / r589037;
        double r589039 = r589027 + r589026;
        double r589040 = fma(r589033, r589038, r589039);
        double r589041 = r589022 ? r589029 : r589040;
        return r589041;
}

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.7
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 < -9.157931604204482e+100 or 3.824001134991742e+29 < t

    1. Initial program 28.5

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y}} \cdot \left(t - z\right) + \left(x + y\right)}\]
    7. Simplified20.8

      \[\leadsto \color{blue}{\frac{t - z}{\frac{a - t}{y}}} + \left(x + y\right)\]
    8. Using strategy rm
    9. Applied *-un-lft-identity20.8

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

      \[\leadsto \color{blue}{1 \cdot \frac{t - z}{\frac{a - t}{y}}} + 1 \cdot \left(x + y\right)\]
    11. Applied distribute-lft-out20.8

      \[\leadsto \color{blue}{1 \cdot \left(\frac{t - z}{\frac{a - t}{y}} + \left(x + y\right)\right)}\]
    12. Simplified19.4

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

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{z \cdot y}{t} + x\right)}\]
    14. Simplified13.2

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

    if -9.157931604204482e+100 < t < 3.824001134991742e+29

    1. Initial program 7.5

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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