Average Error: 16.8 → 5.5
Time: 6.3s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
\[\begin{array}{l} t_1 := \left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\ \mathbf{elif}\;t_1 \leq -4.491227313089305 \cdot 10^{-248}:\\ \;\;\;\;y + \left(x + \left(y \cdot \left(t - z\right)\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\begin{array}{l} t_2 := 1 + \frac{a}{t}\\ \left(x + t_2 \cdot \frac{y \cdot z}{t}\right) - y \cdot \left(\frac{a}{t} \cdot t_2\right) \end{array}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \sqrt[3]{a - t}\\ t_4 := \sqrt[3]{t - z}\\ y + \left(x + \left(y \cdot \frac{t_4 \cdot t_4}{t_3 \cdot t_3}\right) \cdot \frac{t_4}{t_3}\right) \end{array}\\ \end{array} \]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\

\mathbf{elif}\;t_1 \leq -4.491227313089305 \cdot 10^{-248}:\\
\;\;\;\;y + \left(x + \left(y \cdot \left(t - z\right)\right) \cdot \frac{1}{a - t}\right)\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\begin{array}{l}
t_2 := 1 + \frac{a}{t}\\
\left(x + t_2 \cdot \frac{y \cdot z}{t}\right) - y \cdot \left(\frac{a}{t} \cdot t_2\right)
\end{array}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt[3]{a - t}\\
t_4 := \sqrt[3]{t - z}\\
y + \left(x + \left(y \cdot \frac{t_4 \cdot t_4}{t_3 \cdot t_3}\right) \cdot \frac{t_4}{t_3}\right)
\end{array}\\


\end{array}
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (+ x y) (/ (* y (- z t)) (- a t)))))
   (if (<= t_1 (- INFINITY))
     (+ x (* (/ y t) (- z a)))
     (if (<= t_1 -4.491227313089305e-248)
       (+ y (+ x (* (* y (- t z)) (/ 1.0 (- a t)))))
       (if (<= t_1 0.0)
         (let* ((t_2 (+ 1.0 (/ a t))))
           (- (+ x (* t_2 (/ (* y z) t))) (* y (* (/ a t) t_2))))
         (let* ((t_3 (cbrt (- a t))) (t_4 (cbrt (- t z))))
           (+ y (+ x (* (* y (/ (* t_4 t_4) (* t_3 t_3))) (/ t_4 t_3))))))))))
double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x + y) - ((y * (z - t)) / (a - t));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + ((y / t) * (z - a));
	} else if (t_1 <= -4.491227313089305e-248) {
		tmp = y + (x + ((y * (t - z)) * (1.0 / (a - t))));
	} else if (t_1 <= 0.0) {
		double t_2 = 1.0 + (a / t);
		tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2));
	} else {
		double t_3 = cbrt(a - t);
		double t_4 = cbrt(t - z);
		tmp = y + (x + ((y * ((t_4 * t_4) / (t_3 * t_3))) * (t_4 / t_3)));
	}
	return tmp;
}

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.8
Target8.3
Herbie5.5
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < -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} < 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 4 regimes
  2. if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0

    1. Initial program 64.0

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

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

      \[\leadsto \color{blue}{\left(\frac{y \cdot z}{t} + x\right) - \frac{a \cdot y}{t}} \]
    4. Simplified20.0

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

    if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.4912273130893047e-248

    1. Initial program 1.4

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

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

      \[\leadsto \color{blue}{\left(y + \left(\frac{y \cdot t}{a - t} + x\right)\right) - \frac{y \cdot z}{a - t}} \]
    4. Simplified2.9

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

      \[\leadsto y + \left(x + y \cdot \color{blue}{\left(\left(t - z\right) \cdot \frac{1}{a - t}\right)}\right) \]
    6. Applied associate-*r*_binary641.4

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

    if -4.4912273130893047e-248 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0

    1. Initial program 58.8

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

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

      \[\leadsto \color{blue}{\left(\frac{y \cdot z}{t} + \left(\frac{a \cdot \left(y \cdot z\right)}{{t}^{2}} + x\right)\right) - \left(\frac{a \cdot y}{t} + \frac{{a}^{2} \cdot y}{{t}^{2}}\right)} \]
    4. Simplified1.8

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

    if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t)))

    1. Initial program 12.9

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

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

      \[\leadsto \color{blue}{\left(y + \left(\frac{y \cdot t}{a - t} + x\right)\right) - \frac{y \cdot z}{a - t}} \]
    4. Simplified7.5

      \[\leadsto \color{blue}{y + \left(x + y \cdot \frac{t - z}{a - t}\right)} \]
    5. Applied add-cube-cbrt_binary647.8

      \[\leadsto y + \left(x + y \cdot \frac{t - z}{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}}\right) \]
    6. Applied add-cube-cbrt_binary647.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq -\infty:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\ \mathbf{elif}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq -4.491227313089305 \cdot 10^{-248}:\\ \;\;\;\;y + \left(x + \left(y \cdot \left(t - z\right)\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq 0:\\ \;\;\;\;\left(x + \left(1 + \frac{a}{t}\right) \cdot \frac{y \cdot z}{t}\right) - y \cdot \left(\frac{a}{t} \cdot \left(1 + \frac{a}{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(x + \left(y \cdot \frac{\sqrt[3]{t - z} \cdot \sqrt[3]{t - z}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\right) \cdot \frac{\sqrt[3]{t - z}}{\sqrt[3]{a - t}}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2021313 
(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-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- 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.0 (- a t))) y))))

  (- (+ x y) (/ (* (- z t) y) (- a t))))