Average Error: 16.8 → 4.7
Time: 8.6s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -3.0630271737675854 \cdot 10^{-72}:\\ \;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\ \mathbf{elif}\;t \leq 4.093149350033633 \cdot 10^{-213}:\\ \;\;\;\;x + \left(y - \frac{z}{\frac{a - t}{y}}\right)\\ \mathbf{elif}\;t \leq 1.5506905253087662 \cdot 10^{+106} \lor \neg \left(t \leq 6.614496158483137 \cdot 10^{+165}\right):\\ \;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(\frac{z}{a - t} + \frac{a}{t}\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \leq -3.0630271737675854 \cdot 10^{-72}:\\
\;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\

\mathbf{elif}\;t \leq 4.093149350033633 \cdot 10^{-213}:\\
\;\;\;\;x + \left(y - \frac{z}{\frac{a - t}{y}}\right)\\

\mathbf{elif}\;t \leq 1.5506905253087662 \cdot 10^{+106} \lor \neg \left(t \leq 6.614496158483137 \cdot 10^{+165}\right):\\
\;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\

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

\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
 (if (<= t -3.0630271737675854e-72)
   (+ x (* y (- (+ 1.0 (/ t (- a t))) (/ z (- a t)))))
   (if (<= t 4.093149350033633e-213)
     (+ x (- y (/ z (/ (- a t) y))))
     (if (or (<= t 1.5506905253087662e+106)
             (not (<= t 6.614496158483137e+165)))
       (+ x (* y (- (+ 1.0 (/ t (- a t))) (/ z (- a t)))))
       (- x (* y (+ (/ z (- a t)) (/ a t))))))))
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 tmp;
	if (t <= -3.0630271737675854e-72) {
		tmp = x + (y * ((1.0 + (t / (a - t))) - (z / (a - t))));
	} else if (t <= 4.093149350033633e-213) {
		tmp = x + (y - (z / ((a - t) / y)));
	} else if ((t <= 1.5506905253087662e+106) || !(t <= 6.614496158483137e+165)) {
		tmp = x + (y * ((1.0 + (t / (a - t))) - (z / (a - t))));
	} else {
		tmp = x - (y * ((z / (a - t)) + (a / t)));
	}
	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.6
Herbie4.7
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < -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} < 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 3 regimes
  2. if t < -3.0630271737675854e-72 or 4.0931493500336329e-213 < t < 1.5506905253087662e106 or 6.6144961584831372e165 < t

    1. Initial program 20.4

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Taylor expanded around 0 16.0

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

      \[\leadsto \color{blue}{x + \left(\left(y + \frac{t}{\frac{a - t}{y}}\right) - \frac{z}{\frac{a - t}{y}}\right)}\]
    4. Using strategy rm
    5. Applied associate-/r/_binary64_177567.3

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

      \[\leadsto x + \left(\left(y + \color{blue}{\frac{t}{a - t} \cdot y}\right) - \frac{z}{a - t} \cdot y\right)\]
    7. Applied distribute-rgt1-in_binary64_177664.6

      \[\leadsto x + \left(\color{blue}{\left(\frac{t}{a - t} + 1\right) \cdot y} - \frac{z}{a - t} \cdot y\right)\]
    8. Applied distribute-rgt-out--_binary64_177644.6

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

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

    if -3.0630271737675854e-72 < t < 4.0931493500336329e-213

    1. Initial program 4.6

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Taylor expanded around 0 4.1

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

      \[\leadsto \color{blue}{x + \left(\left(y + \frac{t}{\frac{a - t}{y}}\right) - \frac{z}{\frac{a - t}{y}}\right)}\]
    4. Taylor expanded around 0 3.6

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

    if 1.5506905253087662e106 < t < 6.6144961584831372e165

    1. Initial program 26.0

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Taylor expanded around 0 19.6

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

      \[\leadsto \color{blue}{x + \left(\left(y + \frac{t}{\frac{a - t}{y}}\right) - \frac{z}{\frac{a - t}{y}}\right)}\]
    4. Using strategy rm
    5. Applied associate-/r/_binary64_177569.0

      \[\leadsto x + \left(\left(y + \frac{t}{\frac{a - t}{y}}\right) - \color{blue}{\frac{z}{a - t} \cdot y}\right)\]
    6. Applied associate-/r/_binary64_177566.2

      \[\leadsto x + \left(\left(y + \color{blue}{\frac{t}{a - t} \cdot y}\right) - \frac{z}{a - t} \cdot y\right)\]
    7. Applied distribute-rgt1-in_binary64_177666.2

      \[\leadsto x + \left(\color{blue}{\left(\frac{t}{a - t} + 1\right) \cdot y} - \frac{z}{a - t} \cdot y\right)\]
    8. Applied distribute-rgt-out--_binary64_177646.2

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

      \[\leadsto x + y \cdot \color{blue}{\left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)}\]
    10. Taylor expanded around 0 11.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.0630271737675854 \cdot 10^{-72}:\\ \;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\ \mathbf{elif}\;t \leq 4.093149350033633 \cdot 10^{-213}:\\ \;\;\;\;x + \left(y - \frac{z}{\frac{a - t}{y}}\right)\\ \mathbf{elif}\;t \leq 1.5506905253087662 \cdot 10^{+106} \lor \neg \left(t \leq 6.614496158483137 \cdot 10^{+165}\right):\\ \;\;\;\;x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(\frac{z}{a - t} + \frac{a}{t}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020344 
(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.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))))