Average Error: 16.3 → 6.5
Time: 21.1s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -4.728082249545035 \cdot 10^{+167}:\\ \;\;\;\;x + \left(\left(1 + \frac{a}{t}\right) \cdot \frac{y \cdot z}{t} - y \cdot \left(\frac{a}{t} + \frac{a}{t} \cdot \frac{a}{t}\right)\right)\\ \mathbf{elif}\;t \leq 8.129618047138009 \cdot 10^{+176}:\\ \;\;\;\;x + \left(y + y \cdot \left(\frac{t}{a - t} - \frac{z}{a - t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \leq -4.728082249545035 \cdot 10^{+167}:\\
\;\;\;\;x + \left(\left(1 + \frac{a}{t}\right) \cdot \frac{y \cdot z}{t} - y \cdot \left(\frac{a}{t} + \frac{a}{t} \cdot \frac{a}{t}\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\

\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 -4.728082249545035e+167)
   (+
    x
    (-
     (* (+ 1.0 (/ a t)) (/ (* y z) t))
     (* y (+ (/ a t) (* (/ a t) (/ a t))))))
   (if (<= t 8.129618047138009e+176)
     (+ x (+ y (* y (- (/ t (- a t)) (/ z (- a t))))))
     (+ x (/ y (/ t (- z a)))))))
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 <= -4.728082249545035e+167) {
		tmp = x + (((1.0 + (a / t)) * ((y * z) / t)) - (y * ((a / t) + ((a / t) * (a / t)))));
	} else if (t <= 8.129618047138009e+176) {
		tmp = x + (y + (y * ((t / (a - t)) - (z / (a - t)))));
	} else {
		tmp = x + (y / (t / (z - a)));
	}
	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.3
Target8.1
Herbie6.5
\[\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 < -4.7280822495450354e167

    1. Initial program 30.9

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate--l+_binary64_1331426.4

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

      \[\leadsto x + \color{blue}{\left(y - y \cdot \frac{z - t}{a - t}\right)}\]
    5. Taylor expanded around inf 23.8

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

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

    if -4.7280822495450354e167 < t < 8.12961804713800851e176

    1. Initial program 11.3

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

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

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

    if 8.12961804713800851e176 < t

    1. Initial program 34.4

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate--l+_binary64_1331429.9

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

      \[\leadsto x + \color{blue}{\left(y - y \cdot \frac{z - t}{a - t}\right)}\]
    5. Taylor expanded around inf 14.1

      \[\leadsto x + \color{blue}{\frac{z \cdot y - a \cdot y}{t}}\]
    6. Simplified5.6

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - a}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.728082249545035 \cdot 10^{+167}:\\ \;\;\;\;x + \left(\left(1 + \frac{a}{t}\right) \cdot \frac{y \cdot z}{t} - y \cdot \left(\frac{a}{t} + \frac{a}{t} \cdot \frac{a}{t}\right)\right)\\ \mathbf{elif}\;t \leq 8.129618047138009 \cdot 10^{+176}:\\ \;\;\;\;x + \left(y + y \cdot \left(\frac{t}{a - t} - \frac{z}{a - t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\ \end{array}\]

Reproduce

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