Average Error: 16.1 → 8.6
Time: 4.8s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \leq -8.425934768441706 \cdot 10^{-145}:\\ \;\;\;\;\left(x + y\right) - \frac{\frac{z - t}{a - t}}{\frac{1}{y}}\\ \mathbf{elif}\;a \leq 8.442089888717434 \cdot 10^{-134}:\\ \;\;\;\;x + \frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) - \frac{z - t}{\frac{a - t}{y}}\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \leq -8.425934768441706 \cdot 10^{-145}:\\
\;\;\;\;\left(x + y\right) - \frac{\frac{z - t}{a - t}}{\frac{1}{y}}\\

\mathbf{elif}\;a \leq 8.442089888717434 \cdot 10^{-134}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\

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

\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 (<= a -8.425934768441706e-145)
   (- (+ x y) (/ (/ (- z t) (- a t)) (/ 1.0 y)))
   (if (<= a 8.442089888717434e-134)
     (+ x (/ z (/ t y)))
     (- (+ x y) (/ (- z t) (/ (- a t) y))))))
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 (a <= -8.425934768441706e-145) {
		tmp = (x + y) - (((z - t) / (a - t)) / (1.0 / y));
	} else if (a <= 8.442089888717434e-134) {
		tmp = x + (z / (t / y));
	} else {
		tmp = (x + y) - ((z - t) / ((a - t) / y));
	}
	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.1
Target8.6
Herbie8.6
\[\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 a < -8.4259347684417065e-145

    1. Initial program 14.6

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

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

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

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

    if -8.4259347684417065e-145 < a < 8.44208988871743389e-134

    1. Initial program 20.1

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

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

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

      \[\leadsto \color{blue}{x + \frac{z}{\frac{t}{y}}}\]

    if 8.44208988871743389e-134 < a

    1. Initial program 14.8

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

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

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

Reproduce

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