Average Error: 16.7 → 3.8
Time: 12.6s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -1.686508813163046 \cdot 10^{+200} \lor \neg \left(t \leq 4.669954669182884 \cdot 10^{+177}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{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 -1.686508813163046 \cdot 10^{+200} \lor \neg \left(t \leq 4.669954669182884 \cdot 10^{+177}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{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 (or (<= t -1.686508813163046e+200) (not (<= t 4.669954669182884e+177)))
   (+ x (/ y (/ t (- z a))))
   (+ x (* y (- (+ (/ t (- a t)) 1.0) (/ z (- 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 <= -1.686508813163046e+200) || !(t <= 4.669954669182884e+177)) {
		tmp = x + (y / (t / (z - a)));
	} else {
		tmp = x + (y * (((t / (a - t)) + 1.0) - (z / (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.7
Target8.9
Herbie3.8
\[\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 2 regimes
  2. if t < -1.6865088131630461e200 or 4.66995466918288402e177 < 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_1502725.7

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

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

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

      \[\leadsto x + \color{blue}{\frac{z \cdot y - a \cdot y}{t}}\]
    7. Simplified4.0

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

    if -1.6865088131630461e200 < t < 4.66995466918288402e177

    1. Initial program 11.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.686508813163046 \cdot 10^{+200} \lor \neg \left(t \leq 4.669954669182884 \cdot 10^{+177}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{a - t}\right)\\ \end{array}\]

Reproduce

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