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

\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{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 -1.8130033807802028e+40) (not (<= y 2.5049101239841056e-124)))
   (+ x (* y (/ 1.0 (/ (- z a) (- z t)))))
   (+ x (/ (* y (- z t)) (- 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 <= -1.8130033807802028e+40) || !(y <= 2.5049101239841056e-124)) {
		tmp = x + (y * (1.0 / ((z - a) / (z - t))));
	} else {
		tmp = x + ((y * (z - 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

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.81300338078020276e40 or 2.504910123984106e-124 < y

    1. Initial program 0.8

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied clear-num_binary640.9

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

    if -1.81300338078020276e40 < y < 2.504910123984106e-124

    1. Initial program 2.1

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied associate-*r/_binary640.5

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

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

Reproduce

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