Average Error: 16.2 → 9.6
Time: 30.3s
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 r438327 = x;
        double r438328 = y;
        double r438329 = r438327 + r438328;
        double r438330 = z;
        double r438331 = t;
        double r438332 = r438330 - r438331;
        double r438333 = r438332 * r438328;
        double r438334 = a;
        double r438335 = r438334 - r438331;
        double r438336 = r438333 / r438335;
        double r438337 = r438329 - r438336;
        return r438337;
}

double f(double x, double y, double z, double t, double a) {
        double r438338 = a;
        double r438339 = -2.0739807261178848e-225;
        bool r438340 = r438338 <= r438339;
        double r438341 = 1.5633799213363547e-22;
        bool r438342 = r438338 <= r438341;
        double r438343 = !r438342;
        bool r438344 = r438340 || r438343;
        double r438345 = t;
        double r438346 = z;
        double r438347 = r438345 - r438346;
        double r438348 = r438338 - r438345;
        double r438349 = r438347 / r438348;
        double r438350 = y;
        double r438351 = r438349 * r438350;
        double r438352 = x;
        double r438353 = r438352 + r438350;
        double r438354 = r438351 + r438353;
        double r438355 = r438346 * r438350;
        double r438356 = r438355 / r438345;
        double r438357 = r438356 + r438352;
        double r438358 = r438344 ? r438354 : r438357;
        return r438358;
}

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))))