Average Error: 1.4 → 0.7
Time: 4.5s
Precision: binary64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -4.4037374926802204 \cdot 10^{-213} \lor \neg \left(y \leq 1.4975338283952657 \cdot 10^{-71}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \leq -4.4037374926802204 \cdot 10^{-213} \lor \neg \left(y \leq 1.4975338283952657 \cdot 10^{-71}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= y -4.4037374926802204e-213) (not (<= y 1.4975338283952657e-71)))
   (+ x (* y (/ (- z t) (- z a))))
   (+ x (* (* y (- z t)) (/ 1.0 (- z a))))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -4.4037374926802204e-213) || !(y <= 1.4975338283952657e-71)) {
		tmp = x + (y * ((z - t) / (z - a)));
	} else {
		tmp = x + ((y * (z - t)) * (1.0 / (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

Original1.4
Target1.2
Herbie0.7
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.40373749268022044e-213 or 1.4975338283952657e-71 < y

    1. Initial program 0.8

      \[x + y \cdot \frac{z - t}{z - a}\]

    if -4.40373749268022044e-213 < y < 1.4975338283952657e-71

    1. Initial program 2.7

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

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

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

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

Reproduce

herbie shell --seed 2020219 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

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