Average Error: 11.2 → 1.4
Time: 5.0s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -3.5486213838242893 \cdot 10^{-100} \lor \neg \left(z \leq 4.314373561989049 \cdot 10^{-114}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;z \leq -3.5486213838242893 \cdot 10^{-100} \lor \neg \left(z \leq 4.314373561989049 \cdot 10^{-114}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + (((double) (y * ((double) (z - t)))) / ((double) (z - a)))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((z <= -3.5486213838242893e-100) || !(z <= 4.314373561989049e-114))) {
		VAR = ((double) (x + ((double) (y * (((double) (z - t)) / ((double) (z - a)))))));
	} else {
		VAR = ((double) (x + (((double) (y * ((double) (z - t)))) / ((double) (z - a)))));
	}
	return VAR;
}

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

Original11.2
Target1.3
Herbie1.4
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.5486213838242893e-100 or 4.31437356198904865e-114 < z

    1. Initial program 14.5

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Simplified0.5

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

    if -3.5486213838242893e-100 < z < 4.31437356198904865e-114

    1. Initial program 3.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.5486213838242893 \cdot 10^{-100} \lor \neg \left(z \leq 4.314373561989049 \cdot 10^{-114}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \end{array}\]

Reproduce

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

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

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