Average Error: 15.6 → 9.2
Time: 22.1s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.3730723253157225 \cdot 10^{-129}:\\ \;\;\;\;\left(x + y\right) + \frac{y}{\sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\\ \mathbf{elif}\;a \le 5.959771805378206 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + \frac{y}{\sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -4.3730723253157225 \cdot 10^{-129}:\\
\;\;\;\;\left(x + y\right) + \frac{y}{\sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\\

\mathbf{elif}\;a \le 5.959771805378206 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r26945957 = x;
        double r26945958 = y;
        double r26945959 = r26945957 + r26945958;
        double r26945960 = z;
        double r26945961 = t;
        double r26945962 = r26945960 - r26945961;
        double r26945963 = r26945962 * r26945958;
        double r26945964 = a;
        double r26945965 = r26945964 - r26945961;
        double r26945966 = r26945963 / r26945965;
        double r26945967 = r26945959 - r26945966;
        return r26945967;
}

double f(double x, double y, double z, double t, double a) {
        double r26945968 = a;
        double r26945969 = -4.3730723253157225e-129;
        bool r26945970 = r26945968 <= r26945969;
        double r26945971 = x;
        double r26945972 = y;
        double r26945973 = r26945971 + r26945972;
        double r26945974 = t;
        double r26945975 = r26945968 - r26945974;
        double r26945976 = cbrt(r26945975);
        double r26945977 = r26945972 / r26945976;
        double r26945978 = z;
        double r26945979 = r26945974 - r26945978;
        double r26945980 = r26945976 * r26945976;
        double r26945981 = r26945979 / r26945980;
        double r26945982 = r26945977 * r26945981;
        double r26945983 = r26945973 + r26945982;
        double r26945984 = 5.959771805378206e-30;
        bool r26945985 = r26945968 <= r26945984;
        double r26945986 = r26945978 / r26945974;
        double r26945987 = fma(r26945986, r26945972, r26945971);
        double r26945988 = r26945985 ? r26945987 : r26945983;
        double r26945989 = r26945970 ? r26945983 : r26945988;
        return r26945989;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original15.6
Target8.4
Herbie9.2
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \cdot 10^{-07}:\\ \;\;\;\;\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.4754293444577233 \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 < -4.3730723253157225e-129 or 5.959771805378206e-30 < a

    1. Initial program 14.2

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

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

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

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

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

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

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

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

    if -4.3730723253157225e-129 < a < 5.959771805378206e-30

    1. Initial program 18.3

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.3730723253157225 \cdot 10^{-129}:\\ \;\;\;\;\left(x + y\right) + \frac{y}{\sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\\ \mathbf{elif}\;a \le 5.959771805378206 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + \frac{y}{\sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"

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