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

Percentage Accurate: 87.6% → 99.6%
Time: 8.2s
Alternatives: 13
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 13 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.6% 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.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-272} \lor \neg \left(t\_0 \leq 0\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 -5e-272) (not (<= t_0 0.0)))
     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 <= -5e-272) || !(t_0 <= 0.0)) {
		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 <= (-5d-272)) .or. (.not. (t_0 <= 0.0d0))) 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 <= -5e-272) || !(t_0 <= 0.0)) {
		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 <= -5e-272) or not (t_0 <= 0.0):
		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 <= -5e-272) || !(t_0 <= 0.0))
		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 <= -5e-272) || ~((t_0 <= 0.0)))
		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, -5e-272], N[Not[LessEqual[t$95$0, 0.0]], $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 -5 \cdot 10^{-272} \lor \neg \left(t\_0 \leq 0\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))) < -4.99999999999999982e-272 or -0.0 < (/.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 -4.99999999999999982e-272 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0

    1. Initial program 13.3%

      \[\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. sub-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot z + \color{blue}{-1 \cdot \frac{x \cdot z - -1 \cdot {z}^{2}}{y}} \]
      10. +-commutative100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \leq -5 \cdot 10^{-272} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 0\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.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-272} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
   (if (or (<= t_0 -5e-272) (not (<= t_0 0.0))) t_0 (* z (- -1.0 (/ x y))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -5e-272) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = z * (-1.0 - (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) :: t_0
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    if ((t_0 <= (-5d-272)) .or. (.not. (t_0 <= 0.0d0))) then
        tmp = t_0
    else
        tmp = z * ((-1.0d0) - (x / 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 <= -5e-272) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = z * (-1.0 - (x / y));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if (t_0 <= -5e-272) or not (t_0 <= 0.0):
		tmp = t_0
	else:
		tmp = z * (-1.0 - (x / 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 <= -5e-272) || !(t_0 <= 0.0))
		tmp = t_0;
	else
		tmp = Float64(z * Float64(-1.0 - Float64(x / 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 <= -5e-272) || ~((t_0 <= 0.0)))
		tmp = t_0;
	else
		tmp = z * (-1.0 - (x / 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, -5e-272], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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))) < -4.99999999999999982e-272 or -0.0 < (/.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 -4.99999999999999982e-272 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0

    1. Initial program 13.3%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num13.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
      2. associate-/r/13.3%

        \[\leadsto \color{blue}{\frac{1}{1 - \frac{y}{z}} \cdot \left(x + y\right)} \]
    4. Applied egg-rr13.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{y + x}{0 - y}} \]
      8. +-commutative99.9%

        \[\leadsto z \cdot \frac{\color{blue}{x + y}}{0 - y} \]
      9. sub0-neg99.9%

        \[\leadsto z \cdot \frac{x + y}{\color{blue}{-y}} \]
    7. Simplified99.9%

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

      \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} - 1\right)} \]
    9. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} + \left(-1\right)\right)} \]
      2. metadata-eval99.9%

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

        \[\leadsto z \cdot \color{blue}{\left(-1 + -1 \cdot \frac{x}{y}\right)} \]
      4. mul-1-neg99.9%

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

        \[\leadsto z \cdot \left(-1 + \color{blue}{\frac{x}{-y}}\right) \]
    10. Simplified99.9%

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

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

Alternative 3: 75.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ t_1 := z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -4.2 \cdot 10^{+64}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -5.7 \cdot 10^{-18}:\\ \;\;\;\;\frac{y}{t\_0}\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-93}:\\ \;\;\;\;x \cdot \frac{1}{t\_0}\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{-147}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 120000:\\ \;\;\;\;\frac{x}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (* z (- -1.0 (/ x y)))))
   (if (<= y -4.2e+64)
     t_1
     (if (<= y -5.7e-18)
       (/ y t_0)
       (if (<= y -3.3e-93)
         (* x (/ 1.0 t_0))
         (if (<= y -1.08e-147) (+ x y) (if (<= y 120000.0) (/ x t_0) t_1)))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -4.2e+64) {
		tmp = t_1;
	} else if (y <= -5.7e-18) {
		tmp = y / t_0;
	} else if (y <= -3.3e-93) {
		tmp = x * (1.0 / t_0);
	} else if (y <= -1.08e-147) {
		tmp = x + y;
	} else if (y <= 120000.0) {
		tmp = x / t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = z * ((-1.0d0) - (x / y))
    if (y <= (-4.2d+64)) then
        tmp = t_1
    else if (y <= (-5.7d-18)) then
        tmp = y / t_0
    else if (y <= (-3.3d-93)) then
        tmp = x * (1.0d0 / t_0)
    else if (y <= (-1.08d-147)) then
        tmp = x + y
    else if (y <= 120000.0d0) then
        tmp = x / t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -4.2e+64) {
		tmp = t_1;
	} else if (y <= -5.7e-18) {
		tmp = y / t_0;
	} else if (y <= -3.3e-93) {
		tmp = x * (1.0 / t_0);
	} else if (y <= -1.08e-147) {
		tmp = x + y;
	} else if (y <= 120000.0) {
		tmp = x / t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	t_1 = z * (-1.0 - (x / y))
	tmp = 0
	if y <= -4.2e+64:
		tmp = t_1
	elif y <= -5.7e-18:
		tmp = y / t_0
	elif y <= -3.3e-93:
		tmp = x * (1.0 / t_0)
	elif y <= -1.08e-147:
		tmp = x + y
	elif y <= 120000.0:
		tmp = x / t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	t_1 = Float64(z * Float64(-1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -4.2e+64)
		tmp = t_1;
	elseif (y <= -5.7e-18)
		tmp = Float64(y / t_0);
	elseif (y <= -3.3e-93)
		tmp = Float64(x * Float64(1.0 / t_0));
	elseif (y <= -1.08e-147)
		tmp = Float64(x + y);
	elseif (y <= 120000.0)
		tmp = Float64(x / t_0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = z * (-1.0 - (x / y));
	tmp = 0.0;
	if (y <= -4.2e+64)
		tmp = t_1;
	elseif (y <= -5.7e-18)
		tmp = y / t_0;
	elseif (y <= -3.3e-93)
		tmp = x * (1.0 / t_0);
	elseif (y <= -1.08e-147)
		tmp = x + y;
	elseif (y <= 120000.0)
		tmp = x / t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e+64], t$95$1, If[LessEqual[y, -5.7e-18], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, -3.3e-93], N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.08e-147], N[(x + y), $MachinePrecision], If[LessEqual[y, 120000.0], N[(x / t$95$0), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;\frac{y}{t\_0}\\

\mathbf{elif}\;y \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;x \cdot \frac{1}{t\_0}\\

\mathbf{elif}\;y \leq -1.08 \cdot 10^{-147}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq 120000:\\
\;\;\;\;\frac{x}{t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -4.2000000000000001e64 or 1.2e5 < y

    1. Initial program 72.6%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num72.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
      2. associate-/r/72.5%

        \[\leadsto \color{blue}{\frac{1}{1 - \frac{y}{z}} \cdot \left(x + y\right)} \]
    4. Applied egg-rr72.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot \left(y + x\right)}{-y}} \]
      6. sub0-neg65.7%

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

        \[\leadsto \color{blue}{z \cdot \frac{y + x}{0 - y}} \]
      8. +-commutative77.9%

        \[\leadsto z \cdot \frac{\color{blue}{x + y}}{0 - y} \]
      9. sub0-neg77.9%

        \[\leadsto z \cdot \frac{x + y}{\color{blue}{-y}} \]
    7. Simplified77.9%

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

      \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} - 1\right)} \]
    9. Step-by-step derivation
      1. sub-neg77.9%

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} + \left(-1\right)\right)} \]
      2. metadata-eval77.9%

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

        \[\leadsto z \cdot \color{blue}{\left(-1 + -1 \cdot \frac{x}{y}\right)} \]
      4. mul-1-neg77.9%

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

        \[\leadsto z \cdot \left(-1 + \color{blue}{\frac{x}{-y}}\right) \]
    10. Simplified77.9%

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

    if -4.2000000000000001e64 < y < -5.69999999999999971e-18

    1. Initial program 99.7%

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

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

    if -5.69999999999999971e-18 < y < -3.3000000000000001e-93

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. *-un-lft-identity69.5%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{1 - \frac{y}{z}} \]
      2. associate-*l/69.5%

        \[\leadsto \color{blue}{\frac{1}{1 - \frac{y}{z}} \cdot x} \]
    5. Applied egg-rr69.5%

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

    if -3.3000000000000001e-93 < y < -1.07999999999999995e-147

    1. Initial program 99.8%

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

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

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

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

    if -1.07999999999999995e-147 < y < 1.2e5

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+64}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -5.7 \cdot 10^{-18}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-93}:\\ \;\;\;\;x \cdot \frac{1}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{-147}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 120000:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 75.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ t_1 := z \cdot \left(-1 - \frac{x}{y}\right)\\ t_2 := \frac{x}{t\_0}\\ \mathbf{if}\;y \leq -7 \cdot 10^{+64}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -6.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{y}{t\_0}\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-92}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -1.14 \cdot 10^{-147}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 750:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (* z (- -1.0 (/ x y)))) (t_2 (/ x t_0)))
   (if (<= y -7e+64)
     t_1
     (if (<= y -6.6e-15)
       (/ y t_0)
       (if (<= y -1.8e-92)
         t_2
         (if (<= y -1.14e-147) (+ x y) (if (<= y 750.0) t_2 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = z * (-1.0 - (x / y));
	double t_2 = x / t_0;
	double tmp;
	if (y <= -7e+64) {
		tmp = t_1;
	} else if (y <= -6.6e-15) {
		tmp = y / t_0;
	} else if (y <= -1.8e-92) {
		tmp = t_2;
	} else if (y <= -1.14e-147) {
		tmp = x + y;
	} else if (y <= 750.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = z * ((-1.0d0) - (x / y))
    t_2 = x / t_0
    if (y <= (-7d+64)) then
        tmp = t_1
    else if (y <= (-6.6d-15)) then
        tmp = y / t_0
    else if (y <= (-1.8d-92)) then
        tmp = t_2
    else if (y <= (-1.14d-147)) then
        tmp = x + y
    else if (y <= 750.0d0) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = z * (-1.0 - (x / y));
	double t_2 = x / t_0;
	double tmp;
	if (y <= -7e+64) {
		tmp = t_1;
	} else if (y <= -6.6e-15) {
		tmp = y / t_0;
	} else if (y <= -1.8e-92) {
		tmp = t_2;
	} else if (y <= -1.14e-147) {
		tmp = x + y;
	} else if (y <= 750.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	t_1 = z * (-1.0 - (x / y))
	t_2 = x / t_0
	tmp = 0
	if y <= -7e+64:
		tmp = t_1
	elif y <= -6.6e-15:
		tmp = y / t_0
	elif y <= -1.8e-92:
		tmp = t_2
	elif y <= -1.14e-147:
		tmp = x + y
	elif y <= 750.0:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	t_1 = Float64(z * Float64(-1.0 - Float64(x / y)))
	t_2 = Float64(x / t_0)
	tmp = 0.0
	if (y <= -7e+64)
		tmp = t_1;
	elseif (y <= -6.6e-15)
		tmp = Float64(y / t_0);
	elseif (y <= -1.8e-92)
		tmp = t_2;
	elseif (y <= -1.14e-147)
		tmp = Float64(x + y);
	elseif (y <= 750.0)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = z * (-1.0 - (x / y));
	t_2 = x / t_0;
	tmp = 0.0;
	if (y <= -7e+64)
		tmp = t_1;
	elseif (y <= -6.6e-15)
		tmp = y / t_0;
	elseif (y <= -1.8e-92)
		tmp = t_2;
	elseif (y <= -1.14e-147)
		tmp = x + y;
	elseif (y <= 750.0)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$0), $MachinePrecision]}, If[LessEqual[y, -7e+64], t$95$1, If[LessEqual[y, -6.6e-15], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, -1.8e-92], t$95$2, If[LessEqual[y, -1.14e-147], N[(x + y), $MachinePrecision], If[LessEqual[y, 750.0], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := z \cdot \left(-1 - \frac{x}{y}\right)\\
t_2 := \frac{x}{t\_0}\\
\mathbf{if}\;y \leq -7 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -6.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{t\_0}\\

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-92}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -1.14 \cdot 10^{-147}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq 750:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.9999999999999997e64 or 750 < y

    1. Initial program 72.6%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num72.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
      2. associate-/r/72.5%

        \[\leadsto \color{blue}{\frac{1}{1 - \frac{y}{z}} \cdot \left(x + y\right)} \]
    4. Applied egg-rr72.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot \left(y + x\right)}{-y}} \]
      6. sub0-neg65.7%

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

        \[\leadsto \color{blue}{z \cdot \frac{y + x}{0 - y}} \]
      8. +-commutative77.9%

        \[\leadsto z \cdot \frac{\color{blue}{x + y}}{0 - y} \]
      9. sub0-neg77.9%

        \[\leadsto z \cdot \frac{x + y}{\color{blue}{-y}} \]
    7. Simplified77.9%

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

      \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} - 1\right)} \]
    9. Step-by-step derivation
      1. sub-neg77.9%

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} + \left(-1\right)\right)} \]
      2. metadata-eval77.9%

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

        \[\leadsto z \cdot \color{blue}{\left(-1 + -1 \cdot \frac{x}{y}\right)} \]
      4. mul-1-neg77.9%

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

        \[\leadsto z \cdot \left(-1 + \color{blue}{\frac{x}{-y}}\right) \]
    10. Simplified77.9%

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

    if -6.9999999999999997e64 < y < -6.6e-15

    1. Initial program 99.7%

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

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

    if -6.6e-15 < y < -1.80000000000000008e-92 or -1.14e-147 < y < 750

    1. Initial program 99.9%

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

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

    if -1.80000000000000008e-92 < y < -1.14e-147

    1. Initial program 99.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+64}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -6.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-92}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.14 \cdot 10^{-147}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 750:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 65.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+50}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-177}:\\ \;\;\;\;x \cdot \frac{z}{-y}\\ \mathbf{elif}\;y \leq 16500:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -6.1e+50)
   (- z)
   (if (<= y -4.2e-148)
     (+ x y)
     (if (<= y -1.3e-177)
       (* x (/ z (- y)))
       (if (<= y 16500.0) (+ x y) (* y (/ z (- z y))))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.1e+50) {
		tmp = -z;
	} else if (y <= -4.2e-148) {
		tmp = x + y;
	} else if (y <= -1.3e-177) {
		tmp = x * (z / -y);
	} else if (y <= 16500.0) {
		tmp = x + y;
	} else {
		tmp = y * (z / (z - 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 <= (-6.1d+50)) then
        tmp = -z
    else if (y <= (-4.2d-148)) then
        tmp = x + y
    else if (y <= (-1.3d-177)) then
        tmp = x * (z / -y)
    else if (y <= 16500.0d0) then
        tmp = x + y
    else
        tmp = y * (z / (z - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.1e+50) {
		tmp = -z;
	} else if (y <= -4.2e-148) {
		tmp = x + y;
	} else if (y <= -1.3e-177) {
		tmp = x * (z / -y);
	} else if (y <= 16500.0) {
		tmp = x + y;
	} else {
		tmp = y * (z / (z - y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -6.1e+50:
		tmp = -z
	elif y <= -4.2e-148:
		tmp = x + y
	elif y <= -1.3e-177:
		tmp = x * (z / -y)
	elif y <= 16500.0:
		tmp = x + y
	else:
		tmp = y * (z / (z - y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -6.1e+50)
		tmp = Float64(-z);
	elseif (y <= -4.2e-148)
		tmp = Float64(x + y);
	elseif (y <= -1.3e-177)
		tmp = Float64(x * Float64(z / Float64(-y)));
	elseif (y <= 16500.0)
		tmp = Float64(x + y);
	else
		tmp = Float64(y * Float64(z / Float64(z - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -6.1e+50)
		tmp = -z;
	elseif (y <= -4.2e-148)
		tmp = x + y;
	elseif (y <= -1.3e-177)
		tmp = x * (z / -y);
	elseif (y <= 16500.0)
		tmp = x + y;
	else
		tmp = y * (z / (z - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -6.1e+50], (-z), If[LessEqual[y, -4.2e-148], N[(x + y), $MachinePrecision], If[LessEqual[y, -1.3e-177], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 16500.0], N[(x + y), $MachinePrecision], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\
\;\;\;\;x + y\\

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

\mathbf{elif}\;y \leq 16500:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.10000000000000026e50

    1. Initial program 65.7%

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

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

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

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

    if -6.10000000000000026e50 < y < -4.2e-148 or -1.3e-177 < y < 16500

    1. Initial program 99.9%

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

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

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

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

    if -4.2e-148 < y < -1.3e-177

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. mul-1-neg80.1%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      2. associate-/l*80.1%

        \[\leadsto -\color{blue}{x \cdot \frac{z}{y}} \]
      3. distribute-lft-neg-in80.1%

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

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

    if 16500 < y

    1. Initial program 80.6%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num80.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
    4. Applied egg-rr80.4%

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{y}{z}}{y}}} \]
    6. Taylor expanded in y around inf 80.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{y} - \frac{1}{z}}} \]
    7. Step-by-step derivation
      1. frac-sub58.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y \cdot 1}{y \cdot z}}} \]
      2. associate-/r/58.9%

        \[\leadsto \color{blue}{\frac{1}{1 \cdot z - y \cdot 1} \cdot \left(y \cdot z\right)} \]
      3. *-un-lft-identity58.9%

        \[\leadsto \frac{1}{\color{blue}{z} - y \cdot 1} \cdot \left(y \cdot z\right) \]
      4. *-rgt-identity58.9%

        \[\leadsto \frac{1}{z - \color{blue}{y}} \cdot \left(y \cdot z\right) \]
    8. Applied egg-rr58.9%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(y \cdot z\right)}{z - y}} \]
      2. *-lft-identity59.0%

        \[\leadsto \frac{\color{blue}{y \cdot z}}{z - y} \]
      3. associate-/l*66.7%

        \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]
    10. Simplified66.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+50}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-177}:\\ \;\;\;\;x \cdot \frac{z}{-y}\\ \mathbf{elif}\;y \leq 16500:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+89}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-5} \lor \neg \left(y \leq 4.8 \cdot 10^{+22}\right):\\ \;\;\;\;\frac{1}{\frac{1}{y} + \frac{-1}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -6.8e+89)
   (* z (- -1.0 (/ x y)))
   (if (or (<= y -5e-5) (not (<= y 4.8e+22)))
     (/ 1.0 (+ (/ 1.0 y) (/ -1.0 z)))
     (/ x (- 1.0 (/ y z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.8e+89) {
		tmp = z * (-1.0 - (x / y));
	} else if ((y <= -5e-5) || !(y <= 4.8e+22)) {
		tmp = 1.0 / ((1.0 / y) + (-1.0 / z));
	} else {
		tmp = x / (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 (y <= (-6.8d+89)) then
        tmp = z * ((-1.0d0) - (x / y))
    else if ((y <= (-5d-5)) .or. (.not. (y <= 4.8d+22))) then
        tmp = 1.0d0 / ((1.0d0 / y) + ((-1.0d0) / z))
    else
        tmp = x / (1.0d0 - (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.8e+89) {
		tmp = z * (-1.0 - (x / y));
	} else if ((y <= -5e-5) || !(y <= 4.8e+22)) {
		tmp = 1.0 / ((1.0 / y) + (-1.0 / z));
	} else {
		tmp = x / (1.0 - (y / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -6.8e+89:
		tmp = z * (-1.0 - (x / y))
	elif (y <= -5e-5) or not (y <= 4.8e+22):
		tmp = 1.0 / ((1.0 / y) + (-1.0 / z))
	else:
		tmp = x / (1.0 - (y / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -6.8e+89)
		tmp = Float64(z * Float64(-1.0 - Float64(x / y)));
	elseif ((y <= -5e-5) || !(y <= 4.8e+22))
		tmp = Float64(1.0 / Float64(Float64(1.0 / y) + Float64(-1.0 / z)));
	else
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -6.8e+89)
		tmp = z * (-1.0 - (x / y));
	elseif ((y <= -5e-5) || ~((y <= 4.8e+22)))
		tmp = 1.0 / ((1.0 / y) + (-1.0 / z));
	else
		tmp = x / (1.0 - (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -6.8e+89], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5e-5], N[Not[LessEqual[y, 4.8e+22]], $MachinePrecision]], N[(1.0 / N[(N[(1.0 / y), $MachinePrecision] + N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+89}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\

\mathbf{elif}\;y \leq -5 \cdot 10^{-5} \lor \neg \left(y \leq 4.8 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{1}{\frac{1}{y} + \frac{-1}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.8000000000000004e89

    1. Initial program 64.0%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num63.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
      2. associate-/r/64.0%

        \[\leadsto \color{blue}{\frac{1}{1 - \frac{y}{z}} \cdot \left(x + y\right)} \]
    4. Applied egg-rr64.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{y + x}{0 - y}} \]
      8. +-commutative91.4%

        \[\leadsto z \cdot \frac{\color{blue}{x + y}}{0 - y} \]
      9. sub0-neg91.4%

        \[\leadsto z \cdot \frac{x + y}{\color{blue}{-y}} \]
    7. Simplified91.4%

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

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

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \frac{x}{y} + \left(-1\right)\right)} \]
      2. metadata-eval91.4%

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

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

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

        \[\leadsto z \cdot \left(-1 + \color{blue}{\frac{x}{-y}}\right) \]
    10. Simplified91.4%

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

    if -6.8000000000000004e89 < y < -5.00000000000000024e-5 or 4.8e22 < y

    1. Initial program 82.4%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num82.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
    4. Applied egg-rr82.2%

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{y}{z}}{y}}} \]
    6. Taylor expanded in y around inf 81.2%

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

    if -5.00000000000000024e-5 < y < 4.8e22

    1. Initial program 99.9%

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

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

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

Alternative 7: 66.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.95 \cdot 10^{+51}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-177}:\\ \;\;\;\;x \cdot \frac{z}{-y}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+69}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.95e+51)
   (- z)
   (if (<= y -4.2e-148)
     (+ x y)
     (if (<= y -1.3e-177)
       (* x (/ z (- y)))
       (if (<= y 5.5e+69) (+ x y) (- z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.95e+51) {
		tmp = -z;
	} else if (y <= -4.2e-148) {
		tmp = x + y;
	} else if (y <= -1.3e-177) {
		tmp = x * (z / -y);
	} else if (y <= 5.5e+69) {
		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 <= (-2.95d+51)) then
        tmp = -z
    else if (y <= (-4.2d-148)) then
        tmp = x + y
    else if (y <= (-1.3d-177)) then
        tmp = x * (z / -y)
    else if (y <= 5.5d+69) 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 <= -2.95e+51) {
		tmp = -z;
	} else if (y <= -4.2e-148) {
		tmp = x + y;
	} else if (y <= -1.3e-177) {
		tmp = x * (z / -y);
	} else if (y <= 5.5e+69) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.95e+51:
		tmp = -z
	elif y <= -4.2e-148:
		tmp = x + y
	elif y <= -1.3e-177:
		tmp = x * (z / -y)
	elif y <= 5.5e+69:
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.95e+51)
		tmp = Float64(-z);
	elseif (y <= -4.2e-148)
		tmp = Float64(x + y);
	elseif (y <= -1.3e-177)
		tmp = Float64(x * Float64(z / Float64(-y)));
	elseif (y <= 5.5e+69)
		tmp = Float64(x + y);
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.95e+51)
		tmp = -z;
	elseif (y <= -4.2e-148)
		tmp = x + y;
	elseif (y <= -1.3e-177)
		tmp = x * (z / -y);
	elseif (y <= 5.5e+69)
		tmp = x + y;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.95e+51], (-z), If[LessEqual[y, -4.2e-148], N[(x + y), $MachinePrecision], If[LessEqual[y, -1.3e-177], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+69], N[(x + y), $MachinePrecision], (-z)]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\
\;\;\;\;x + y\\

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

\mathbf{elif}\;y \leq 5.5 \cdot 10^{+69}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.94999999999999991e51 or 5.50000000000000002e69 < y

    1. Initial program 70.1%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified67.1%

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

    if -2.94999999999999991e51 < y < -4.2e-148 or -1.3e-177 < y < 5.50000000000000002e69

    1. Initial program 99.2%

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

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

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

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

    if -4.2e-148 < y < -1.3e-177

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. mul-1-neg80.1%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      2. associate-/l*80.1%

        \[\leadsto -\color{blue}{x \cdot \frac{z}{y}} \]
      3. distribute-lft-neg-in80.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.95 \cdot 10^{+51}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-148}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-177}:\\ \;\;\;\;x \cdot \frac{z}{-y}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+69}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 68.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+67}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-6} \lor \neg \left(y \leq 8.5 \cdot 10^{+22}\right):\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.8e+67)
   (- z)
   (if (or (<= y -8.5e-6) (not (<= y 8.5e+22)))
     (* y (/ z (- z y)))
     (/ x (- 1.0 (/ y z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.8e+67) {
		tmp = -z;
	} else if ((y <= -8.5e-6) || !(y <= 8.5e+22)) {
		tmp = y * (z / (z - y));
	} else {
		tmp = x / (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 (y <= (-1.8d+67)) then
        tmp = -z
    else if ((y <= (-8.5d-6)) .or. (.not. (y <= 8.5d+22))) then
        tmp = y * (z / (z - y))
    else
        tmp = x / (1.0d0 - (y / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.8e+67) {
		tmp = -z;
	} else if ((y <= -8.5e-6) || !(y <= 8.5e+22)) {
		tmp = y * (z / (z - y));
	} else {
		tmp = x / (1.0 - (y / z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.8e+67:
		tmp = -z
	elif (y <= -8.5e-6) or not (y <= 8.5e+22):
		tmp = y * (z / (z - y))
	else:
		tmp = x / (1.0 - (y / z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.8e+67)
		tmp = Float64(-z);
	elseif ((y <= -8.5e-6) || !(y <= 8.5e+22))
		tmp = Float64(y * Float64(z / Float64(z - y)));
	else
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.8e+67)
		tmp = -z;
	elseif ((y <= -8.5e-6) || ~((y <= 8.5e+22)))
		tmp = y * (z / (z - y));
	else
		tmp = x / (1.0 - (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.8e+67], (-z), If[Or[LessEqual[y, -8.5e-6], N[Not[LessEqual[y, 8.5e+22]], $MachinePrecision]], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -8.5 \cdot 10^{-6} \lor \neg \left(y \leq 8.5 \cdot 10^{+22}\right):\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.7999999999999999e67

    1. Initial program 63.9%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified70.8%

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

    if -1.7999999999999999e67 < y < -8.4999999999999999e-6 or 8.49999999999999979e22 < y

    1. Initial program 83.6%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num83.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
    4. Applied egg-rr83.5%

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{y}{z}}{y}}} \]
    6. Taylor expanded in y around inf 81.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{y} - \frac{1}{z}}} \]
    7. Step-by-step derivation
      1. frac-sub62.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y \cdot 1}{y \cdot z}}} \]
      2. associate-/r/62.8%

        \[\leadsto \color{blue}{\frac{1}{1 \cdot z - y \cdot 1} \cdot \left(y \cdot z\right)} \]
      3. *-un-lft-identity62.8%

        \[\leadsto \frac{1}{\color{blue}{z} - y \cdot 1} \cdot \left(y \cdot z\right) \]
      4. *-rgt-identity62.8%

        \[\leadsto \frac{1}{z - \color{blue}{y}} \cdot \left(y \cdot z\right) \]
    8. Applied egg-rr62.8%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(y \cdot z\right)}{z - y}} \]
      2. *-lft-identity62.9%

        \[\leadsto \frac{\color{blue}{y \cdot z}}{z - y} \]
      3. associate-/l*69.4%

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

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

    if -8.4999999999999999e-6 < y < 8.49999999999999979e22

    1. Initial program 99.9%

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

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

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

Alternative 9: 68.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ \mathbf{if}\;y \leq -1.8 \cdot 10^{+67}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -0.0007:\\ \;\;\;\;\frac{y}{t\_0}\\ \mathbf{elif}\;y \leq 7.4 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))))
   (if (<= y -1.8e+67)
     (- z)
     (if (<= y -0.0007)
       (/ y t_0)
       (if (<= y 7.4e+22) (/ x t_0) (* y (/ z (- z y))))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double tmp;
	if (y <= -1.8e+67) {
		tmp = -z;
	} else if (y <= -0.0007) {
		tmp = y / t_0;
	} else if (y <= 7.4e+22) {
		tmp = x / t_0;
	} else {
		tmp = y * (z / (z - 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 = 1.0d0 - (y / z)
    if (y <= (-1.8d+67)) then
        tmp = -z
    else if (y <= (-0.0007d0)) then
        tmp = y / t_0
    else if (y <= 7.4d+22) then
        tmp = x / t_0
    else
        tmp = y * (z / (z - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double tmp;
	if (y <= -1.8e+67) {
		tmp = -z;
	} else if (y <= -0.0007) {
		tmp = y / t_0;
	} else if (y <= 7.4e+22) {
		tmp = x / t_0;
	} else {
		tmp = y * (z / (z - y));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	tmp = 0
	if y <= -1.8e+67:
		tmp = -z
	elif y <= -0.0007:
		tmp = y / t_0
	elif y <= 7.4e+22:
		tmp = x / t_0
	else:
		tmp = y * (z / (z - y))
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	tmp = 0.0
	if (y <= -1.8e+67)
		tmp = Float64(-z);
	elseif (y <= -0.0007)
		tmp = Float64(y / t_0);
	elseif (y <= 7.4e+22)
		tmp = Float64(x / t_0);
	else
		tmp = Float64(y * Float64(z / Float64(z - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	tmp = 0.0;
	if (y <= -1.8e+67)
		tmp = -z;
	elseif (y <= -0.0007)
		tmp = y / t_0;
	elseif (y <= 7.4e+22)
		tmp = x / t_0;
	else
		tmp = y * (z / (z - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+67], (-z), If[LessEqual[y, -0.0007], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, 7.4e+22], N[(x / t$95$0), $MachinePrecision], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+67}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -0.0007:\\
\;\;\;\;\frac{y}{t\_0}\\

\mathbf{elif}\;y \leq 7.4 \cdot 10^{+22}:\\
\;\;\;\;\frac{x}{t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.7999999999999999e67

    1. Initial program 63.9%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified70.8%

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

    if -1.7999999999999999e67 < y < -6.99999999999999993e-4

    1. Initial program 99.7%

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

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

    if -6.99999999999999993e-4 < y < 7.3999999999999996e22

    1. Initial program 99.9%

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

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

    if 7.3999999999999996e22 < y

    1. Initial program 80.0%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num79.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
    4. Applied egg-rr79.8%

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 - \frac{y}{z}}{y}}} \]
    6. Taylor expanded in y around inf 81.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{y} - \frac{1}{z}}} \]
    7. Step-by-step derivation
      1. frac-sub59.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y \cdot 1}{y \cdot z}}} \]
      2. associate-/r/59.1%

        \[\leadsto \color{blue}{\frac{1}{1 \cdot z - y \cdot 1} \cdot \left(y \cdot z\right)} \]
      3. *-un-lft-identity59.1%

        \[\leadsto \frac{1}{\color{blue}{z} - y \cdot 1} \cdot \left(y \cdot z\right) \]
      4. *-rgt-identity59.1%

        \[\leadsto \frac{1}{z - \color{blue}{y}} \cdot \left(y \cdot z\right) \]
    8. Applied egg-rr59.1%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(y \cdot z\right)}{z - y}} \]
      2. *-lft-identity59.3%

        \[\leadsto \frac{\color{blue}{y \cdot z}}{z - y} \]
      3. associate-/l*67.2%

        \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]
    10. Simplified67.2%

      \[\leadsto \color{blue}{y \cdot \frac{z}{z - y}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 10: 56.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+46}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -6 \cdot 10^{-119}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 25000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.75e+46) (- z) (if (<= y -6e-119) y (if (<= y 25000.0) x (- z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.75e+46) {
		tmp = -z;
	} else if (y <= -6e-119) {
		tmp = y;
	} else if (y <= 25000.0) {
		tmp = x;
	} 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 <= (-1.75d+46)) then
        tmp = -z
    else if (y <= (-6d-119)) then
        tmp = y
    else if (y <= 25000.0d0) then
        tmp = x
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.75e+46) {
		tmp = -z;
	} else if (y <= -6e-119) {
		tmp = y;
	} else if (y <= 25000.0) {
		tmp = x;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.75e+46:
		tmp = -z
	elif y <= -6e-119:
		tmp = y
	elif y <= 25000.0:
		tmp = x
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.75e+46)
		tmp = Float64(-z);
	elseif (y <= -6e-119)
		tmp = y;
	elseif (y <= 25000.0)
		tmp = x;
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.75e+46)
		tmp = -z;
	elseif (y <= -6e-119)
		tmp = y;
	elseif (y <= 25000.0)
		tmp = x;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.75e+46], (-z), If[LessEqual[y, -6e-119], y, If[LessEqual[y, 25000.0], x, (-z)]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -6 \cdot 10^{-119}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 25000:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.74999999999999992e46 or 25000 < y

    1. Initial program 73.5%

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

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

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

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

    if -1.74999999999999992e46 < y < -6.0000000000000004e-119

    1. Initial program 99.7%

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

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

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

    if -6.0000000000000004e-119 < y < 25000

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 67.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+52} \lor \neg \left(y \leq 6 \cdot 10^{+69}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.45e+52) (not (<= y 6e+69))) (- z) (+ x y)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.45e+52) || !(y <= 6e+69)) {
		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 <= (-1.45d+52)) .or. (.not. (y <= 6d+69))) 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 <= -1.45e+52) || !(y <= 6e+69)) {
		tmp = -z;
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.45e+52) or not (y <= 6e+69):
		tmp = -z
	else:
		tmp = x + y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.45e+52) || !(y <= 6e+69))
		tmp = Float64(-z);
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.45e+52) || ~((y <= 6e+69)))
		tmp = -z;
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+52], N[Not[LessEqual[y, 6e+69]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+52} \lor \neg \left(y \leq 6 \cdot 10^{+69}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.45e52 or 5.99999999999999967e69 < y

    1. Initial program 70.1%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified67.1%

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

    if -1.45e52 < y < 5.99999999999999967e69

    1. Initial program 99.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+52} \lor \neg \left(y \leq 6 \cdot 10^{+69}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 36.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{-118}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+43}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.95e-118) y (if (<= y 9e+43) x y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.95e-118) {
		tmp = y;
	} else if (y <= 9e+43) {
		tmp = x;
	} else {
		tmp = 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 <= (-1.95d-118)) then
        tmp = y
    else if (y <= 9d+43) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.95e-118) {
		tmp = y;
	} else if (y <= 9e+43) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.95e-118:
		tmp = y
	elif y <= 9e+43:
		tmp = x
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.95e-118)
		tmp = y;
	elseif (y <= 9e+43)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.95e-118)
		tmp = y;
	elseif (y <= 9e+43)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.95e-118], y, If[LessEqual[y, 9e+43], x, y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-118}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 9 \cdot 10^{+43}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.95e-118 or 9e43 < y

    1. Initial program 78.0%

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

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

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

    if -1.95e-118 < y < 9e43

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 34.7% 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 87.0%

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

    \[\leadsto \color{blue}{x} \]
  4. Add Preprocessing

Developer target: 93.2% 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 2024097 
(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))))