Average Error: 16.2 → 9.6
Time: 30.7s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.073980726117884802107450590791436932533 \cdot 10^{-225} \lor \neg \left(a \le 1.563379921336354695015274590614129069856 \cdot 10^{-22}\right):\\ \;\;\;\;\frac{t - z}{a - t} \cdot y + \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.073980726117884802107450590791436932533 \cdot 10^{-225} \lor \neg \left(a \le 1.563379921336354695015274590614129069856 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{t - z}{a - t} \cdot y + \left(x + y\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r341007 = x;
        double r341008 = y;
        double r341009 = r341007 + r341008;
        double r341010 = z;
        double r341011 = t;
        double r341012 = r341010 - r341011;
        double r341013 = r341012 * r341008;
        double r341014 = a;
        double r341015 = r341014 - r341011;
        double r341016 = r341013 / r341015;
        double r341017 = r341009 - r341016;
        return r341017;
}

double f(double x, double y, double z, double t, double a) {
        double r341018 = a;
        double r341019 = -2.0739807261178848e-225;
        bool r341020 = r341018 <= r341019;
        double r341021 = 1.5633799213363547e-22;
        bool r341022 = r341018 <= r341021;
        double r341023 = !r341022;
        bool r341024 = r341020 || r341023;
        double r341025 = t;
        double r341026 = z;
        double r341027 = r341025 - r341026;
        double r341028 = r341018 - r341025;
        double r341029 = r341027 / r341028;
        double r341030 = y;
        double r341031 = r341029 * r341030;
        double r341032 = x;
        double r341033 = r341032 + r341030;
        double r341034 = r341031 + r341033;
        double r341035 = r341026 * r341030;
        double r341036 = r341035 / r341025;
        double r341037 = r341036 + r341032;
        double r341038 = r341024 ? r341034 : r341037;
        return r341038;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original16.2
Target8.3
Herbie9.6
\[\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.0739807261178848e-225 or 1.5633799213363547e-22 < a

    1. Initial program 14.7

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

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

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

    if -2.0739807261178848e-225 < a < 1.5633799213363547e-22

    1. Initial program 19.8

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

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

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

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

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

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

      \[\leadsto \frac{\frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}{\color{blue}{\sqrt[3]{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \sqrt[3]{\sqrt[3]{a - t}}}} \cdot y + \left(x + y\right)\]
    11. Applied add-cube-cbrt19.9

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

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

      \[\leadsto \color{blue}{\left(\frac{\frac{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}{\sqrt[3]{a - t}}}{\sqrt[3]{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \frac{\frac{\sqrt[3]{t - z}}{\sqrt[3]{a - t}}}{\sqrt[3]{\sqrt[3]{a - t}}}\right)} \cdot y + \left(x + y\right)\]
    14. Applied associate-*l*17.1

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

      \[\leadsto \frac{\frac{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}{\sqrt[3]{a - t}}}{\sqrt[3]{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \color{blue}{\left(y \cdot \frac{\sqrt[3]{t - z}}{{\left(\sqrt[3]{\sqrt[3]{a - t}}\right)}^{\left(3 + 1\right)}}\right)} + \left(x + y\right)\]
    16. Taylor expanded around inf 12.6

      \[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.073980726117884802107450590791436932533 \cdot 10^{-225} \lor \neg \left(a \le 1.563379921336354695015274590614129069856 \cdot 10^{-22}\right):\\ \;\;\;\;\frac{t - z}{a - t} \cdot y + \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \end{array}\]

Reproduce

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