Average Error: 10.6 → 0.5
Time: 3.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.67021214527556027 \cdot 10^{43}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{elif}\;y \le 1.20618880313943598 \cdot 10^{-53}:\\ \;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t} - \frac{a}{z - t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -2.67021214527556027 \cdot 10^{43}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

\mathbf{elif}\;y \le 1.20618880313943598 \cdot 10^{-53}:\\
\;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t} - \frac{a}{z - t}}\\

\end{array}
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 temp;
	if ((y <= -2.6702121452755603e+43)) {
		temp = (x + (y * ((z - t) / (z - a))));
	} else {
		double temp_1;
		if ((y <= 1.206188803139436e-53)) {
			temp_1 = (x + (1.0 / ((z - a) / (y * (z - t)))));
		} else {
			temp_1 = (x + (y / ((z / (z - t)) - (a / (z - t)))));
		}
		temp = temp_1;
	}
	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

Original10.6
Target1.3
Herbie0.5
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.6702121452755603e+43

    1. Initial program 27.2

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

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

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

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

    if -2.6702121452755603e+43 < y < 1.206188803139436e-53

    1. Initial program 0.5

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

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

    if 1.206188803139436e-53 < y

    1. Initial program 19.0

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied associate-/l*0.6

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-sub0.6

      \[\leadsto x + \frac{y}{\color{blue}{\frac{z}{z - t} - \frac{a}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.67021214527556027 \cdot 10^{43}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{elif}\;y \le 1.20618880313943598 \cdot 10^{-53}:\\ \;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t} - \frac{a}{z - t}}\\ \end{array}\]

Reproduce

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