Average Error: 16.4 → 9.1
Time: 19.2s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.973743978705260629963631913953638110144 \cdot 10^{-158}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t}}, y, x + y\right)\\ \mathbf{elif}\;a \le 1.141495497687205277085024399098422182024 \cdot 10^{-132}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}\right) \cdot \left(\frac{\sqrt[3]{t - z}}{a - t} \cdot y\right) + \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 -4.973743978705260629963631913953638110144 \cdot 10^{-158}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{t - z}{\sqrt[3]{a - t}}, y, x + y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r632312 = x;
        double r632313 = y;
        double r632314 = r632312 + r632313;
        double r632315 = z;
        double r632316 = t;
        double r632317 = r632315 - r632316;
        double r632318 = r632317 * r632313;
        double r632319 = a;
        double r632320 = r632319 - r632316;
        double r632321 = r632318 / r632320;
        double r632322 = r632314 - r632321;
        return r632322;
}

double f(double x, double y, double z, double t, double a) {
        double r632323 = a;
        double r632324 = -4.973743978705261e-158;
        bool r632325 = r632323 <= r632324;
        double r632326 = 1.0;
        double r632327 = t;
        double r632328 = r632323 - r632327;
        double r632329 = cbrt(r632328);
        double r632330 = r632329 * r632329;
        double r632331 = r632326 / r632330;
        double r632332 = z;
        double r632333 = r632327 - r632332;
        double r632334 = r632333 / r632329;
        double r632335 = r632331 * r632334;
        double r632336 = y;
        double r632337 = x;
        double r632338 = r632337 + r632336;
        double r632339 = fma(r632335, r632336, r632338);
        double r632340 = 1.1414954976872053e-132;
        bool r632341 = r632323 <= r632340;
        double r632342 = r632332 / r632327;
        double r632343 = fma(r632342, r632336, r632337);
        double r632344 = cbrt(r632333);
        double r632345 = r632344 * r632344;
        double r632346 = r632344 / r632328;
        double r632347 = r632346 * r632336;
        double r632348 = r632345 * r632347;
        double r632349 = r632348 + r632338;
        double r632350 = r632341 ? r632343 : r632349;
        double r632351 = r632325 ? r632339 : r632350;
        return r632351;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original16.4
Target8.4
Herbie9.1
\[\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 3 regimes
  2. if a < -4.973743978705261e-158

    1. Initial program 15.1

      \[\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 add-cube-cbrt8.6

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

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

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

    if -4.973743978705261e-158 < a < 1.1414954976872053e-132

    1. Initial program 20.4

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

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

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

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

    if 1.1414954976872053e-132 < a

    1. Initial program 15.2

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

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

      \[\leadsto \color{blue}{\frac{t - z}{a - t} \cdot y + \left(x + y\right)}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity9.1

      \[\leadsto \frac{t - z}{\color{blue}{1 \cdot \left(a - t\right)}} \cdot y + \left(x + y\right)\]
    7. Applied add-cube-cbrt9.3

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

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

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

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

Reproduce

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