Average Error: 16.6 → 9.7
Time: 13.7s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.2439891650814672 \cdot 10^{-88}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{\sqrt{1}}{\sqrt[3]{a - t}}, y, x + y\right)\\ \mathbf{elif}\;a \le 5.6339865852383654 \cdot 10^{29}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t - z}{a - t} \cdot y + \left(x + y\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.2439891650814672 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{\sqrt{1}}{\sqrt[3]{a - t}}, y, x + y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r553179 = x;
        double r553180 = y;
        double r553181 = r553179 + r553180;
        double r553182 = z;
        double r553183 = t;
        double r553184 = r553182 - r553183;
        double r553185 = r553184 * r553180;
        double r553186 = a;
        double r553187 = r553186 - r553183;
        double r553188 = r553185 / r553187;
        double r553189 = r553181 - r553188;
        return r553189;
}

double f(double x, double y, double z, double t, double a) {
        double r553190 = a;
        double r553191 = -2.2439891650814672e-88;
        bool r553192 = r553190 <= r553191;
        double r553193 = t;
        double r553194 = z;
        double r553195 = r553193 - r553194;
        double r553196 = r553190 - r553193;
        double r553197 = cbrt(r553196);
        double r553198 = r553197 * r553197;
        double r553199 = r553195 / r553198;
        double r553200 = 1.0;
        double r553201 = sqrt(r553200);
        double r553202 = r553201 / r553197;
        double r553203 = r553199 * r553202;
        double r553204 = y;
        double r553205 = x;
        double r553206 = r553205 + r553204;
        double r553207 = fma(r553203, r553204, r553206);
        double r553208 = 5.6339865852383654e+29;
        bool r553209 = r553190 <= r553208;
        double r553210 = r553194 / r553193;
        double r553211 = fma(r553210, r553204, r553205);
        double r553212 = r553195 / r553196;
        double r553213 = r553212 * r553204;
        double r553214 = r553213 + r553206;
        double r553215 = r553209 ? r553211 : r553214;
        double r553216 = r553192 ? r553207 : r553215;
        return r553216;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.6
Target8.2
Herbie9.7
\[\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 3 regimes
  2. if a < -2.2439891650814672e-88

    1. Initial program 15.1

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

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

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

      \[\leadsto \mathsf{fma}\left(\left(t - z\right) \cdot \frac{1}{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}}, y, x + y\right)\]
    7. Applied add-sqr-sqrt8.2

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

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

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

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

    if -2.2439891650814672e-88 < a < 5.6339865852383654e+29

    1. Initial program 19.2

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

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

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

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

    if 5.6339865852383654e+29 < a

    1. Initial program 14.2

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

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

      \[\leadsto \color{blue}{\frac{t - z}{a - t} \cdot y + \left(x + y\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.7

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

Reproduce

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