Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A

Percentage Accurate: 87.4% → 99.3%
Time: 6.0s
Alternatives: 11
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 87.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Alternative 1: 99.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-258} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-278}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(x + z\right)}{-y} - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
   (if (or (<= t_0 -4e-258) (not (<= t_0 4e-278)))
     t_0
     (- (/ (* z (+ x z)) (- y)) z))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278)) {
		tmp = t_0;
	} else {
		tmp = ((z * (x + z)) / -y) - z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    if ((t_0 <= (-4d-258)) .or. (.not. (t_0 <= 4d-278))) then
        tmp = t_0
    else
        tmp = ((z * (x + z)) / -y) - z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278)) {
		tmp = t_0;
	} else {
		tmp = ((z * (x + z)) / -y) - z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if (t_0 <= -4e-258) or not (t_0 <= 4e-278):
		tmp = t_0
	else:
		tmp = ((z * (x + z)) / -y) - z
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	tmp = 0.0
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278))
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(z * Float64(x + z)) / Float64(-y)) - z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) / (1.0 - (y / z));
	tmp = 0.0;
	if ((t_0 <= -4e-258) || ~((t_0 <= 4e-278)))
		tmp = t_0;
	else
		tmp = ((z * (x + z)) / -y) - z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-258], N[Not[LessEqual[t$95$0, 4e-278]], $MachinePrecision]], t$95$0, N[(N[(N[(z * N[(x + z), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-258} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-278}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999982e-258 or 3.99999999999999975e-278 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.8%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing

    if -3.99999999999999982e-258 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 3.99999999999999975e-278

    1. Initial program 28.7%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{\left(-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}\right) - \frac{{z}^{2}}{y}} \]
    4. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto \color{blue}{-1 \cdot z + \left(-1 \cdot \frac{x \cdot z}{y} - \frac{{z}^{2}}{y}\right)} \]
      2. associate-*r/100.0%

        \[\leadsto -1 \cdot z + \left(\color{blue}{\frac{-1 \cdot \left(x \cdot z\right)}{y}} - \frac{{z}^{2}}{y}\right) \]
      3. div-sub100.0%

        \[\leadsto -1 \cdot z + \color{blue}{\frac{-1 \cdot \left(x \cdot z\right) - {z}^{2}}{y}} \]
      4. remove-double-neg100.0%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{\left(-\left(-{z}^{2}\right)\right)}}{y} \]
      5. mul-1-neg100.0%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \left(-\color{blue}{-1 \cdot {z}^{2}}\right)}{y} \]
      6. neg-mul-1100.0%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{-1 \cdot \left(-1 \cdot {z}^{2}\right)}}{y} \]
      7. distribute-lft-out--100.0%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-1 \cdot \left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      8. mul-1-neg100.0%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-\left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      9. distribute-neg-frac100.0%

        \[\leadsto -1 \cdot z + \color{blue}{\left(-\frac{x \cdot z - -1 \cdot {z}^{2}}{y}\right)} \]
      10. unsub-neg100.0%

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z - -1 \cdot {z}^{2}}{y}} \]
      11. mul-1-neg100.0%

        \[\leadsto \color{blue}{\left(-z\right)} - \frac{x \cdot z - -1 \cdot {z}^{2}}{y} \]
      12. sub-neg100.0%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{x \cdot z + \left(--1 \cdot {z}^{2}\right)}}{y} \]
      13. mul-1-neg100.0%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \left(-\color{blue}{\left(-{z}^{2}\right)}\right)}{y} \]
      14. remove-double-neg100.0%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \color{blue}{{z}^{2}}}{y} \]
      15. +-commutative100.0%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{{z}^{2} + x \cdot z}}{y} \]
      16. unpow2100.0%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot z} + x \cdot z}{y} \]
      17. distribute-rgt-out100.0%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot \left(z + x\right)}}{y} \]
    5. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \leq -4 \cdot 10^{-258} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 4 \cdot 10^{-278}\right):\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(x + z\right)}{-y} - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-258} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-278}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
   (if (or (<= t_0 -4e-258) (not (<= t_0 4e-278)))
     t_0
     (* z (/ (+ x y) (- y))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278)) {
		tmp = t_0;
	} else {
		tmp = z * ((x + y) / -y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    if ((t_0 <= (-4d-258)) .or. (.not. (t_0 <= 4d-278))) then
        tmp = t_0
    else
        tmp = z * ((x + y) / -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278)) {
		tmp = t_0;
	} else {
		tmp = z * ((x + y) / -y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if (t_0 <= -4e-258) or not (t_0 <= 4e-278):
		tmp = t_0
	else:
		tmp = z * ((x + y) / -y)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	tmp = 0.0
	if ((t_0 <= -4e-258) || !(t_0 <= 4e-278))
		tmp = t_0;
	else
		tmp = Float64(z * Float64(Float64(x + y) / Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) / (1.0 - (y / z));
	tmp = 0.0;
	if ((t_0 <= -4e-258) || ~((t_0 <= 4e-278)))
		tmp = t_0;
	else
		tmp = z * ((x + y) / -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-258], N[Not[LessEqual[t$95$0, 4e-278]], $MachinePrecision]], t$95$0, N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-258} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-278}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999982e-258 or 3.99999999999999975e-278 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.8%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing

    if -3.99999999999999982e-258 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 3.99999999999999975e-278

    1. Initial program 28.7%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
    4. Step-by-step derivation
      1. *-commutative85.2%

        \[\leadsto \color{blue}{\frac{z \cdot \left(x + y\right)}{y} \cdot -1} \]
      2. associate-/l*100.0%

        \[\leadsto \color{blue}{\left(z \cdot \frac{x + y}{y}\right)} \cdot -1 \]
      3. associate-*r*100.0%

        \[\leadsto \color{blue}{z \cdot \left(\frac{x + y}{y} \cdot -1\right)} \]
      4. associate-*l/100.0%

        \[\leadsto z \cdot \color{blue}{\frac{\left(x + y\right) \cdot -1}{y}} \]
      5. *-commutative100.0%

        \[\leadsto z \cdot \frac{\color{blue}{-1 \cdot \left(x + y\right)}}{y} \]
      6. neg-mul-1100.0%

        \[\leadsto z \cdot \frac{\color{blue}{-\left(x + y\right)}}{y} \]
      7. distribute-neg-in100.0%

        \[\leadsto z \cdot \frac{\color{blue}{\left(-x\right) + \left(-y\right)}}{y} \]
      8. unsub-neg100.0%

        \[\leadsto z \cdot \frac{\color{blue}{\left(-x\right) - y}}{y} \]
    5. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \leq -4 \cdot 10^{-258} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 4 \cdot 10^{-278}\right):\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 68.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -0.082:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.55e+220)
   (- z)
   (if (<= y -0.082)
     (* y (/ z (- z y)))
     (if (<= y -1.45e-194)
       (+ x y)
       (if (<= y 3.3e+81) (/ x (- 1.0 (/ y z))) (- z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.55e+220) {
		tmp = -z;
	} else if (y <= -0.082) {
		tmp = y * (z / (z - y));
	} else if (y <= -1.45e-194) {
		tmp = x + y;
	} else if (y <= 3.3e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.55d+220)) then
        tmp = -z
    else if (y <= (-0.082d0)) then
        tmp = y * (z / (z - y))
    else if (y <= (-1.45d-194)) then
        tmp = x + y
    else if (y <= 3.3d+81) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.55e+220) {
		tmp = -z;
	} else if (y <= -0.082) {
		tmp = y * (z / (z - y));
	} else if (y <= -1.45e-194) {
		tmp = x + y;
	} else if (y <= 3.3e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.55e+220:
		tmp = -z
	elif y <= -0.082:
		tmp = y * (z / (z - y))
	elif y <= -1.45e-194:
		tmp = x + y
	elif y <= 3.3e+81:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.55e+220)
		tmp = Float64(-z);
	elseif (y <= -0.082)
		tmp = Float64(y * Float64(z / Float64(z - y)));
	elseif (y <= -1.45e-194)
		tmp = Float64(x + y);
	elseif (y <= 3.3e+81)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.55e+220)
		tmp = -z;
	elseif (y <= -0.082)
		tmp = y * (z / (z - y));
	elseif (y <= -1.45e-194)
		tmp = x + y;
	elseif (y <= 3.3e+81)
		tmp = x / (1.0 - (y / z));
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.55e+220], (-z), If[LessEqual[y, -0.082], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e-194], N[(x + y), $MachinePrecision], If[LessEqual[y, 3.3e+81], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-z)]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -0.082:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq -1.45 \cdot 10^{-194}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

\mathbf{else}:\\
\;\;\;\;-z\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.55000000000000002e220 or 3.3e81 < y

    1. Initial program 68.4%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 68.6%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg68.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified68.6%

      \[\leadsto \color{blue}{-z} \]

    if -3.55000000000000002e220 < y < -0.0820000000000000034

    1. Initial program 84.5%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 84.5%

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]
    4. Taylor expanded in x around 0 59.4%

      \[\leadsto \color{blue}{\frac{y \cdot z}{z - y}} \]
    5. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]
    6. Simplified71.4%

      \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]

    if -0.0820000000000000034 < y < -1.44999999999999985e-194

    1. Initial program 99.8%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 65.5%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative65.5%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified65.5%

      \[\leadsto \color{blue}{y + x} \]

    if -1.44999999999999985e-194 < y < 3.3e81

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 80.9%

      \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification73.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -0.082:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-6}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \frac{z}{-y} - z\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.3e-6)
   (+ x y)
   (if (<= z 3.2e-72)
     (- (* x (/ z (- y))) z)
     (if (<= z 8.5e+81) (/ x (- 1.0 (/ y z))) (* (+ x y) (+ 1.0 (/ y z)))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.3e-6) {
		tmp = x + y;
	} else if (z <= 3.2e-72) {
		tmp = (x * (z / -y)) - z;
	} else if (z <= 8.5e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = (x + y) * (1.0 + (y / z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1.3d-6)) then
        tmp = x + y
    else if (z <= 3.2d-72) then
        tmp = (x * (z / -y)) - z
    else if (z <= 8.5d+81) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = (x + y) * (1.0d0 + (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.3e-6) {
		tmp = x + y;
	} else if (z <= 3.2e-72) {
		tmp = (x * (z / -y)) - z;
	} else if (z <= 8.5e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = (x + y) * (1.0 + (y / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.3e-6:
		tmp = x + y
	elif z <= 3.2e-72:
		tmp = (x * (z / -y)) - z
	elif z <= 8.5e+81:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = (x + y) * (1.0 + (y / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.3e-6)
		tmp = Float64(x + y);
	elseif (z <= 3.2e-72)
		tmp = Float64(Float64(x * Float64(z / Float64(-y))) - z);
	elseif (z <= 8.5e+81)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.3e-6)
		tmp = x + y;
	elseif (z <= 3.2e-72)
		tmp = (x * (z / -y)) - z;
	elseif (z <= 8.5e+81)
		tmp = x / (1.0 - (y / z));
	else
		tmp = (x + y) * (1.0 + (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.3e-6], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.2e-72], N[(N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[z, 8.5e+81], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-6}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \frac{z}{-y} - z\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.30000000000000005e-6

    1. Initial program 100.0%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 75.7%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative75.7%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified75.7%

      \[\leadsto \color{blue}{y + x} \]

    if -1.30000000000000005e-6 < z < 3.19999999999999999e-72

    1. Initial program 77.5%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 78.5%

      \[\leadsto \color{blue}{\left(-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}\right) - \frac{{z}^{2}}{y}} \]
    4. Step-by-step derivation
      1. associate--l+78.5%

        \[\leadsto \color{blue}{-1 \cdot z + \left(-1 \cdot \frac{x \cdot z}{y} - \frac{{z}^{2}}{y}\right)} \]
      2. associate-*r/78.5%

        \[\leadsto -1 \cdot z + \left(\color{blue}{\frac{-1 \cdot \left(x \cdot z\right)}{y}} - \frac{{z}^{2}}{y}\right) \]
      3. div-sub78.5%

        \[\leadsto -1 \cdot z + \color{blue}{\frac{-1 \cdot \left(x \cdot z\right) - {z}^{2}}{y}} \]
      4. remove-double-neg78.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{\left(-\left(-{z}^{2}\right)\right)}}{y} \]
      5. mul-1-neg78.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \left(-\color{blue}{-1 \cdot {z}^{2}}\right)}{y} \]
      6. neg-mul-178.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{-1 \cdot \left(-1 \cdot {z}^{2}\right)}}{y} \]
      7. distribute-lft-out--78.5%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-1 \cdot \left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      8. mul-1-neg78.5%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-\left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      9. distribute-neg-frac78.5%

        \[\leadsto -1 \cdot z + \color{blue}{\left(-\frac{x \cdot z - -1 \cdot {z}^{2}}{y}\right)} \]
      10. unsub-neg78.5%

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z - -1 \cdot {z}^{2}}{y}} \]
      11. mul-1-neg78.5%

        \[\leadsto \color{blue}{\left(-z\right)} - \frac{x \cdot z - -1 \cdot {z}^{2}}{y} \]
      12. sub-neg78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{x \cdot z + \left(--1 \cdot {z}^{2}\right)}}{y} \]
      13. mul-1-neg78.5%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \left(-\color{blue}{\left(-{z}^{2}\right)}\right)}{y} \]
      14. remove-double-neg78.5%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \color{blue}{{z}^{2}}}{y} \]
      15. +-commutative78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{{z}^{2} + x \cdot z}}{y} \]
      16. unpow278.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot z} + x \cdot z}{y} \]
      17. distribute-rgt-out78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot \left(z + x\right)}}{y} \]
    5. Simplified78.5%

      \[\leadsto \color{blue}{\left(-z\right) - \frac{z \cdot \left(z + x\right)}{y}} \]
    6. Taylor expanded in z around 0 78.6%

      \[\leadsto \left(-z\right) - \color{blue}{\frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. associate-/l*76.8%

        \[\leadsto \left(-z\right) - \color{blue}{x \cdot \frac{z}{y}} \]
    8. Simplified76.8%

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

    if 3.19999999999999999e-72 < z < 8.49999999999999986e81

    1. Initial program 95.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 80.1%

      \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]

    if 8.49999999999999986e81 < z

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 71.6%

      \[\leadsto \color{blue}{x + \left(y + \frac{y \cdot \left(x + y\right)}{z}\right)} \]
    4. Step-by-step derivation
      1. associate-+r+71.6%

        \[\leadsto \color{blue}{\left(x + y\right) + \frac{y \cdot \left(x + y\right)}{z}} \]
      2. *-rgt-identity71.6%

        \[\leadsto \color{blue}{\left(x + y\right) \cdot 1} + \frac{y \cdot \left(x + y\right)}{z} \]
      3. *-commutative71.6%

        \[\leadsto \left(x + y\right) \cdot 1 + \frac{\color{blue}{\left(x + y\right) \cdot y}}{z} \]
      4. associate-/l*86.9%

        \[\leadsto \left(x + y\right) \cdot 1 + \color{blue}{\left(x + y\right) \cdot \frac{y}{z}} \]
      5. distribute-lft-in86.8%

        \[\leadsto \color{blue}{\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)} \]
      6. +-commutative86.8%

        \[\leadsto \color{blue}{\left(y + x\right)} \cdot \left(1 + \frac{y}{z}\right) \]
    5. Simplified86.8%

      \[\leadsto \color{blue}{\left(y + x\right) \cdot \left(1 + \frac{y}{z}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-6}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \frac{z}{-y} - z\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 66.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -9 \cdot 10^{+27} \lor \neg \left(y \leq 5.5 \cdot 10^{+82}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.5e+209)
   (- z)
   (if (<= y -1.4e+186)
     y
     (if (or (<= y -9e+27) (not (<= y 5.5e+82))) (- z) (+ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.5e+209) {
		tmp = -z;
	} else if (y <= -1.4e+186) {
		tmp = y;
	} else if ((y <= -9e+27) || !(y <= 5.5e+82)) {
		tmp = -z;
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.5d+209)) then
        tmp = -z
    else if (y <= (-1.4d+186)) then
        tmp = y
    else if ((y <= (-9d+27)) .or. (.not. (y <= 5.5d+82))) then
        tmp = -z
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.5e+209) {
		tmp = -z;
	} else if (y <= -1.4e+186) {
		tmp = y;
	} else if ((y <= -9e+27) || !(y <= 5.5e+82)) {
		tmp = -z;
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.5e+209:
		tmp = -z
	elif y <= -1.4e+186:
		tmp = y
	elif (y <= -9e+27) or not (y <= 5.5e+82):
		tmp = -z
	else:
		tmp = x + y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.5e+209)
		tmp = Float64(-z);
	elseif (y <= -1.4e+186)
		tmp = y;
	elseif ((y <= -9e+27) || !(y <= 5.5e+82))
		tmp = Float64(-z);
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.5e+209)
		tmp = -z;
	elseif (y <= -1.4e+186)
		tmp = y;
	elseif ((y <= -9e+27) || ~((y <= 5.5e+82)))
		tmp = -z;
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+209], (-z), If[LessEqual[y, -1.4e+186], y, If[Or[LessEqual[y, -9e+27], N[Not[LessEqual[y, 5.5e+82]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -9 \cdot 10^{+27} \lor \neg \left(y \leq 5.5 \cdot 10^{+82}\right):\\
\;\;\;\;-z\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.5000000000000003e209 or -1.40000000000000009e186 < y < -8.9999999999999998e27 or 5.49999999999999997e82 < y

    1. Initial program 72.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 63.6%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg63.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified63.6%

      \[\leadsto \color{blue}{-z} \]

    if -3.5000000000000003e209 < y < -1.40000000000000009e186

    1. Initial program 100.0%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 100.0%

      \[\leadsto \color{blue}{\frac{y}{1 - \frac{y}{z}}} \]
    4. Taylor expanded in y around 0 86.0%

      \[\leadsto \color{blue}{y} \]

    if -8.9999999999999998e27 < y < 5.49999999999999997e82

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 72.0%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative72.0%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified72.0%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -9 \cdot 10^{+27} \lor \neg \left(y \leq 5.5 \cdot 10^{+82}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 57.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -0.215 \lor \neg \left(y \leq 6.5 \cdot 10^{-8}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.5e+209)
   (- z)
   (if (<= y -1.4e+186)
     y
     (if (or (<= y -0.215) (not (<= y 6.5e-8))) (- z) x))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.5e+209) {
		tmp = -z;
	} else if (y <= -1.4e+186) {
		tmp = y;
	} else if ((y <= -0.215) || !(y <= 6.5e-8)) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.5d+209)) then
        tmp = -z
    else if (y <= (-1.4d+186)) then
        tmp = y
    else if ((y <= (-0.215d0)) .or. (.not. (y <= 6.5d-8))) then
        tmp = -z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.5e+209) {
		tmp = -z;
	} else if (y <= -1.4e+186) {
		tmp = y;
	} else if ((y <= -0.215) || !(y <= 6.5e-8)) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.5e+209:
		tmp = -z
	elif y <= -1.4e+186:
		tmp = y
	elif (y <= -0.215) or not (y <= 6.5e-8):
		tmp = -z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.5e+209)
		tmp = Float64(-z);
	elseif (y <= -1.4e+186)
		tmp = y;
	elseif ((y <= -0.215) || !(y <= 6.5e-8))
		tmp = Float64(-z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.5e+209)
		tmp = -z;
	elseif (y <= -1.4e+186)
		tmp = y;
	elseif ((y <= -0.215) || ~((y <= 6.5e-8)))
		tmp = -z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+209], (-z), If[LessEqual[y, -1.4e+186], y, If[Or[LessEqual[y, -0.215], N[Not[LessEqual[y, 6.5e-8]], $MachinePrecision]], (-z), x]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -0.215 \lor \neg \left(y \leq 6.5 \cdot 10^{-8}\right):\\
\;\;\;\;-z\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.5000000000000003e209 or -1.40000000000000009e186 < y < -0.214999999999999997 or 6.49999999999999997e-8 < y

    1. Initial program 76.7%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 58.7%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg58.7%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified58.7%

      \[\leadsto \color{blue}{-z} \]

    if -3.5000000000000003e209 < y < -1.40000000000000009e186

    1. Initial program 100.0%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 100.0%

      \[\leadsto \color{blue}{\frac{y}{1 - \frac{y}{z}}} \]
    4. Taylor expanded in y around 0 86.0%

      \[\leadsto \color{blue}{y} \]

    if -0.214999999999999997 < y < 6.49999999999999997e-8

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 60.5%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+209}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{+186}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -0.215 \lor \neg \left(y \leq 6.5 \cdot 10^{-8}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-7}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-72}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -2.1e-7)
   (+ x y)
   (if (<= z 5e-72)
     (* z (/ (+ x y) (- y)))
     (if (<= z 6.2e+81) (/ x (- 1.0 (/ y z))) (+ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.1e-7) {
		tmp = x + y;
	} else if (z <= 5e-72) {
		tmp = z * ((x + y) / -y);
	} else if (z <= 6.2e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-2.1d-7)) then
        tmp = x + y
    else if (z <= 5d-72) then
        tmp = z * ((x + y) / -y)
    else if (z <= 6.2d+81) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.1e-7) {
		tmp = x + y;
	} else if (z <= 5e-72) {
		tmp = z * ((x + y) / -y);
	} else if (z <= 6.2e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -2.1e-7:
		tmp = x + y
	elif z <= 5e-72:
		tmp = z * ((x + y) / -y)
	elif z <= 6.2e+81:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = x + y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -2.1e-7)
		tmp = Float64(x + y);
	elseif (z <= 5e-72)
		tmp = Float64(z * Float64(Float64(x + y) / Float64(-y)));
	elseif (z <= 6.2e+81)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -2.1e-7)
		tmp = x + y;
	elseif (z <= 5e-72)
		tmp = z * ((x + y) / -y);
	elseif (z <= 6.2e+81)
		tmp = x / (1.0 - (y / z));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -2.1e-7], N[(x + y), $MachinePrecision], If[LessEqual[z, 5e-72], N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+81], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-7}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-72}:\\
\;\;\;\;z \cdot \frac{x + y}{-y}\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.1e-7 or 6.2e81 < z

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 80.5%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative80.5%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified80.5%

      \[\leadsto \color{blue}{y + x} \]

    if -2.1e-7 < z < 4.9999999999999996e-72

    1. Initial program 77.5%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 71.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
    4. Step-by-step derivation
      1. *-commutative71.1%

        \[\leadsto \color{blue}{\frac{z \cdot \left(x + y\right)}{y} \cdot -1} \]
      2. associate-/l*76.1%

        \[\leadsto \color{blue}{\left(z \cdot \frac{x + y}{y}\right)} \cdot -1 \]
      3. associate-*r*76.1%

        \[\leadsto \color{blue}{z \cdot \left(\frac{x + y}{y} \cdot -1\right)} \]
      4. associate-*l/76.1%

        \[\leadsto z \cdot \color{blue}{\frac{\left(x + y\right) \cdot -1}{y}} \]
      5. *-commutative76.1%

        \[\leadsto z \cdot \frac{\color{blue}{-1 \cdot \left(x + y\right)}}{y} \]
      6. neg-mul-176.1%

        \[\leadsto z \cdot \frac{\color{blue}{-\left(x + y\right)}}{y} \]
      7. distribute-neg-in76.1%

        \[\leadsto z \cdot \frac{\color{blue}{\left(-x\right) + \left(-y\right)}}{y} \]
      8. unsub-neg76.1%

        \[\leadsto z \cdot \frac{\color{blue}{\left(-x\right) - y}}{y} \]
    5. Simplified76.1%

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

    if 4.9999999999999996e-72 < z < 6.2e81

    1. Initial program 95.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 80.1%

      \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-7}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-72}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 73.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-73}:\\ \;\;\;\;x \cdot \frac{z}{-y} - z\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -5.6e-10)
   (+ x y)
   (if (<= z 4.3e-73)
     (- (* x (/ z (- y))) z)
     (if (<= z 6.2e+81) (/ x (- 1.0 (/ y z))) (+ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.6e-10) {
		tmp = x + y;
	} else if (z <= 4.3e-73) {
		tmp = (x * (z / -y)) - z;
	} else if (z <= 6.2e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-5.6d-10)) then
        tmp = x + y
    else if (z <= 4.3d-73) then
        tmp = (x * (z / -y)) - z
    else if (z <= 6.2d+81) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.6e-10) {
		tmp = x + y;
	} else if (z <= 4.3e-73) {
		tmp = (x * (z / -y)) - z;
	} else if (z <= 6.2e+81) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -5.6e-10:
		tmp = x + y
	elif z <= 4.3e-73:
		tmp = (x * (z / -y)) - z
	elif z <= 6.2e+81:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = x + y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -5.6e-10)
		tmp = Float64(x + y);
	elseif (z <= 4.3e-73)
		tmp = Float64(Float64(x * Float64(z / Float64(-y))) - z);
	elseif (z <= 6.2e+81)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -5.6e-10)
		tmp = x + y;
	elseif (z <= 4.3e-73)
		tmp = (x * (z / -y)) - z;
	elseif (z <= 6.2e+81)
		tmp = x / (1.0 - (y / z));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -5.6e-10], N[(x + y), $MachinePrecision], If[LessEqual[z, 4.3e-73], N[(N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[z, 6.2e+81], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-10}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 4.3 \cdot 10^{-73}:\\
\;\;\;\;x \cdot \frac{z}{-y} - z\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.60000000000000031e-10 or 6.2e81 < z

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 80.5%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative80.5%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified80.5%

      \[\leadsto \color{blue}{y + x} \]

    if -5.60000000000000031e-10 < z < 4.2999999999999999e-73

    1. Initial program 77.5%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 78.5%

      \[\leadsto \color{blue}{\left(-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}\right) - \frac{{z}^{2}}{y}} \]
    4. Step-by-step derivation
      1. associate--l+78.5%

        \[\leadsto \color{blue}{-1 \cdot z + \left(-1 \cdot \frac{x \cdot z}{y} - \frac{{z}^{2}}{y}\right)} \]
      2. associate-*r/78.5%

        \[\leadsto -1 \cdot z + \left(\color{blue}{\frac{-1 \cdot \left(x \cdot z\right)}{y}} - \frac{{z}^{2}}{y}\right) \]
      3. div-sub78.5%

        \[\leadsto -1 \cdot z + \color{blue}{\frac{-1 \cdot \left(x \cdot z\right) - {z}^{2}}{y}} \]
      4. remove-double-neg78.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{\left(-\left(-{z}^{2}\right)\right)}}{y} \]
      5. mul-1-neg78.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \left(-\color{blue}{-1 \cdot {z}^{2}}\right)}{y} \]
      6. neg-mul-178.5%

        \[\leadsto -1 \cdot z + \frac{-1 \cdot \left(x \cdot z\right) - \color{blue}{-1 \cdot \left(-1 \cdot {z}^{2}\right)}}{y} \]
      7. distribute-lft-out--78.5%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-1 \cdot \left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      8. mul-1-neg78.5%

        \[\leadsto -1 \cdot z + \frac{\color{blue}{-\left(x \cdot z - -1 \cdot {z}^{2}\right)}}{y} \]
      9. distribute-neg-frac78.5%

        \[\leadsto -1 \cdot z + \color{blue}{\left(-\frac{x \cdot z - -1 \cdot {z}^{2}}{y}\right)} \]
      10. unsub-neg78.5%

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z - -1 \cdot {z}^{2}}{y}} \]
      11. mul-1-neg78.5%

        \[\leadsto \color{blue}{\left(-z\right)} - \frac{x \cdot z - -1 \cdot {z}^{2}}{y} \]
      12. sub-neg78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{x \cdot z + \left(--1 \cdot {z}^{2}\right)}}{y} \]
      13. mul-1-neg78.5%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \left(-\color{blue}{\left(-{z}^{2}\right)}\right)}{y} \]
      14. remove-double-neg78.5%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \color{blue}{{z}^{2}}}{y} \]
      15. +-commutative78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{{z}^{2} + x \cdot z}}{y} \]
      16. unpow278.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot z} + x \cdot z}{y} \]
      17. distribute-rgt-out78.5%

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot \left(z + x\right)}}{y} \]
    5. Simplified78.5%

      \[\leadsto \color{blue}{\left(-z\right) - \frac{z \cdot \left(z + x\right)}{y}} \]
    6. Taylor expanded in z around 0 78.6%

      \[\leadsto \left(-z\right) - \color{blue}{\frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. associate-/l*76.8%

        \[\leadsto \left(-z\right) - \color{blue}{x \cdot \frac{z}{y}} \]
    8. Simplified76.8%

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

    if 4.2999999999999999e-73 < z < 6.2e81

    1. Initial program 95.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 80.1%

      \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-73}:\\ \;\;\;\;x \cdot \frac{z}{-y} - z\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 67.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+80}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.55e+220)
   (- z)
   (if (<= y -4.5e-11) (* y (/ z (- z y))) (if (<= y 3.7e+80) (+ x y) (- z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.55e+220) {
		tmp = -z;
	} else if (y <= -4.5e-11) {
		tmp = y * (z / (z - y));
	} else if (y <= 3.7e+80) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.55d+220)) then
        tmp = -z
    else if (y <= (-4.5d-11)) then
        tmp = y * (z / (z - y))
    else if (y <= 3.7d+80) then
        tmp = x + y
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.55e+220) {
		tmp = -z;
	} else if (y <= -4.5e-11) {
		tmp = y * (z / (z - y));
	} else if (y <= 3.7e+80) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.55e+220:
		tmp = -z
	elif y <= -4.5e-11:
		tmp = y * (z / (z - y))
	elif y <= 3.7e+80:
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.55e+220)
		tmp = Float64(-z);
	elseif (y <= -4.5e-11)
		tmp = Float64(y * Float64(z / Float64(z - y)));
	elseif (y <= 3.7e+80)
		tmp = Float64(x + y);
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.55e+220)
		tmp = -z;
	elseif (y <= -4.5e-11)
		tmp = y * (z / (z - y));
	elseif (y <= 3.7e+80)
		tmp = x + y;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.55e+220], (-z), If[LessEqual[y, -4.5e-11], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e+80], N[(x + y), $MachinePrecision], (-z)]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -4.5 \cdot 10^{-11}:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq 3.7 \cdot 10^{+80}:\\
\;\;\;\;x + y\\

\mathbf{else}:\\
\;\;\;\;-z\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.55000000000000002e220 or 3.69999999999999996e80 < y

    1. Initial program 68.4%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 68.6%

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg68.6%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified68.6%

      \[\leadsto \color{blue}{-z} \]

    if -3.55000000000000002e220 < y < -4.5e-11

    1. Initial program 84.5%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 84.5%

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]
    4. Taylor expanded in x around 0 59.4%

      \[\leadsto \color{blue}{\frac{y \cdot z}{z - y}} \]
    5. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]
    6. Simplified71.4%

      \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]

    if -4.5e-11 < y < 3.69999999999999996e80

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 72.6%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative72.6%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified72.6%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.55 \cdot 10^{+220}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+80}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 40.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.08 \cdot 10^{-162}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.08e-162) x (if (<= x 4.5e-134) y x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.08e-162) {
		tmp = x;
	} else if (x <= 4.5e-134) {
		tmp = y;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.08d-162)) then
        tmp = x
    else if (x <= 4.5d-134) then
        tmp = y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.08e-162) {
		tmp = x;
	} else if (x <= 4.5e-134) {
		tmp = y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -1.08e-162:
		tmp = x
	elif x <= 4.5e-134:
		tmp = y
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.08e-162)
		tmp = x;
	elseif (x <= 4.5e-134)
		tmp = y;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.08e-162)
		tmp = x;
	elseif (x <= 4.5e-134)
		tmp = y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -1.08e-162], x, If[LessEqual[x, 4.5e-134], y, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{-162}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\
\;\;\;\;y\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.08000000000000006e-162 or 4.5000000000000005e-134 < x

    1. Initial program 88.3%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 44.1%

      \[\leadsto \color{blue}{x} \]

    if -1.08000000000000006e-162 < x < 4.5000000000000005e-134

    1. Initial program 93.6%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 84.9%

      \[\leadsto \color{blue}{\frac{y}{1 - \frac{y}{z}}} \]
    4. Taylor expanded in y around 0 50.0%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.08 \cdot 10^{-162}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 34.3% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 89.6%

    \[\frac{x + y}{1 - \frac{y}{z}} \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 35.8%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification35.8%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 93.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y + x}{-y} \cdot z\\ \mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (/ (+ y x) (- y)) z)))
   (if (< y -3.7429310762689856e+171)
     t_0
     (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) t_0))))
double code(double x, double y, double z) {
	double t_0 = ((y + x) / -y) * z;
	double tmp;
	if (y < -3.7429310762689856e+171) {
		tmp = t_0;
	} else if (y < 3.5534662456086734e+168) {
		tmp = (x + y) / (1.0 - (y / z));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((y + x) / -y) * z
    if (y < (-3.7429310762689856d+171)) then
        tmp = t_0
    else if (y < 3.5534662456086734d+168) then
        tmp = (x + y) / (1.0d0 - (y / z))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = ((y + x) / -y) * z;
	double tmp;
	if (y < -3.7429310762689856e+171) {
		tmp = t_0;
	} else if (y < 3.5534662456086734e+168) {
		tmp = (x + y) / (1.0 - (y / z));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = ((y + x) / -y) * z
	tmp = 0
	if y < -3.7429310762689856e+171:
		tmp = t_0
	elif y < 3.5534662456086734e+168:
		tmp = (x + y) / (1.0 - (y / z))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(y + x) / Float64(-y)) * z)
	tmp = 0.0
	if (y < -3.7429310762689856e+171)
		tmp = t_0;
	elseif (y < 3.5534662456086734e+168)
		tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = ((y + x) / -y) * z;
	tmp = 0.0;
	if (y < -3.7429310762689856e+171)
		tmp = t_0;
	elseif (y < 3.5534662456086734e+168)
		tmp = (x + y) / (1.0 - (y / z));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision] * z), $MachinePrecision]}, If[Less[y, -3.7429310762689856e+171], t$95$0, If[Less[y, 3.5534662456086734e+168], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y + x}{-y} \cdot z\\
\mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024095 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
  :precision binary64

  :alt
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1.0 (/ y z))))