Average Error: 11.1 → 0.4
Time: 5.8s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -5.4288497895092806 \cdot 10^{+17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{elif}\;y \leq 1.63191112146173 \cdot 10^{-35}:\\ \;\;\;\;x + \frac{y \cdot z - y \cdot t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \leq -5.4288497895092806 \cdot 10^{+17}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

\mathbf{elif}\;y \leq 1.63191112146173 \cdot 10^{-35}:\\
\;\;\;\;x + \frac{y \cdot z - y \cdot t}{z - a}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{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 (<= y -5.4288497895092806e+17)
   (+ x (* y (/ (- z t) (- z a))))
   (if (<= y 1.63191112146173e-35)
     (+ x (/ (- (* y z) (* y t)) (- z a)))
     (+ 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 <= -5.4288497895092806e+17) {
		tmp = x + (y * ((z - t) / (z - a)));
	} else if (y <= 1.63191112146173e-35) {
		tmp = x + (((y * z) - (y * t)) / (z - a));
	} 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

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

Derivation

  1. Split input into 2 regimes
  2. if y < -542884978950928064 or 1.63191112146173009e-35 < y

    1. Initial program 22.8

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6422.8

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

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

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

    if -542884978950928064 < y < 1.63191112146173009e-35

    1. Initial program 0.4

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied sub-neg_binary640.4

      \[\leadsto x + \frac{y \cdot \color{blue}{\left(z + \left(-t\right)\right)}}{z - a}\]
    4. Applied distribute-rgt-in_binary640.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.4288497895092806 \cdot 10^{+17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{elif}\;y \leq 1.63191112146173 \cdot 10^{-35}:\\ \;\;\;\;x + \frac{y \cdot z - y \cdot t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \end{array}\]

Reproduce

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