Average Error: 1.4 → 1.5
Time: 27.0s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 7.46702847266602817 \cdot 10^{-71}\right):\\ \;\;\;\;x + y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 7.46702847266602817 \cdot 10^{-71}\right):\\
\;\;\;\;x + y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return (x + (y * ((z - t) / (a - t))));
}
double code(double x, double y, double z, double t, double a) {
	double temp;
	if (((t <= -1.0071455594193599e-271) || !(t <= 7.467028472666028e-71))) {
		temp = (x + (y * ((z / (a - t)) - (t / (a - t)))));
	} else {
		temp = (x + ((y * (z - t)) * (1.0 / (a - t))));
	}
	return temp;
}

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

Original1.4
Target0.5
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;y \lt -8.50808486055124107 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0071455594193599e-271 or 7.467028472666028e-71 < t

    1. Initial program 0.9

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied div-sub0.8

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

    if -1.0071455594193599e-271 < t < 7.467028472666028e-71

    1. Initial program 3.5

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied div-inv3.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 7.46702847266602817 \cdot 10^{-71}\right):\\ \;\;\;\;x + y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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