Average Error: 16.5 → 8.5
Time: 4.7s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.12430825583283118 \cdot 10^{131} \lor \neg \left(t \le 6.29361288009581358 \cdot 10^{112}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}{\frac{a - 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 -3.12430825583283118 \cdot 10^{131} \lor \neg \left(t \le 6.29361288009581358 \cdot 10^{112}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r567425 = x;
        double r567426 = y;
        double r567427 = r567425 + r567426;
        double r567428 = z;
        double r567429 = t;
        double r567430 = r567428 - r567429;
        double r567431 = r567430 * r567426;
        double r567432 = a;
        double r567433 = r567432 - r567429;
        double r567434 = r567431 / r567433;
        double r567435 = r567427 - r567434;
        return r567435;
}

double f(double x, double y, double z, double t, double a) {
        double r567436 = t;
        double r567437 = -3.124308255832831e+131;
        bool r567438 = r567436 <= r567437;
        double r567439 = 6.293612880095814e+112;
        bool r567440 = r567436 <= r567439;
        double r567441 = !r567440;
        bool r567442 = r567438 || r567441;
        double r567443 = z;
        double r567444 = r567443 / r567436;
        double r567445 = y;
        double r567446 = x;
        double r567447 = fma(r567444, r567445, r567446);
        double r567448 = r567436 - r567443;
        double r567449 = cbrt(r567448);
        double r567450 = r567449 * r567449;
        double r567451 = a;
        double r567452 = r567451 - r567436;
        double r567453 = r567452 / r567449;
        double r567454 = r567450 / r567453;
        double r567455 = r567446 + r567445;
        double r567456 = fma(r567445, r567454, r567455);
        double r567457 = r567442 ? r567447 : r567456;
        return r567457;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.5
Target8.7
Herbie8.5
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \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.47542934445772333 \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 < -3.124308255832831e+131 or 6.293612880095814e+112 < t

    1. Initial program 31.4

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(t - z\right) + \left(x + y\right)\]
    7. Applied associate-*l*21.9

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

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

      \[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
    10. Simplified11.6

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

    if -3.124308255832831e+131 < t < 6.293612880095814e+112

    1. Initial program 9.3

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(t - z\right) + \left(x + y\right)\]
    7. Applied associate-*l*6.8

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

      \[\leadsto y \cdot \color{blue}{\frac{t - z}{a - t}} + \left(x + y\right)\]
    9. Using strategy rm
    10. Applied fma-def6.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - z}{a - t}, x + y\right)}\]
    11. Using strategy rm
    12. Applied add-cube-cbrt7.0

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

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

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

Reproduce

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