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

Percentage Accurate: 87.7% → 99.8%
Time: 8.3s
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.7% 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.8% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{-\left(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))) < -1.99999999999999988e-278 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
    3. Taylor expanded in x around 0 99.8%

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

        \[\leadsto \color{blue}{\frac{y}{1 - \frac{y}{z}} + \frac{x}{1 - \frac{y}{z}}} \]
    5. Simplified99.8%

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

    if -1.99999999999999988e-278 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0

    1. Initial program 12.1%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in100.0%

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative100.0%

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

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

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

        \[\leadsto \color{blue}{-\frac{z \cdot \left(y + x\right)}{y}} \]
      3. add-sqr-sqrt53.7%

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt5.4%

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

        \[\leadsto -\color{blue}{z \cdot \frac{y + x}{-y}} \]
      9. clear-num5.4%

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv5.4%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt2.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod28.3%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg28.3%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod58.2%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt100.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{-\frac{z}{\frac{y}{y + x}}} \]
  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 -2 \cdot 10^{-278} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 0\right):\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}} + \frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 69.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ t_1 := \frac{x}{t\_0}\\ t_2 := \frac{y}{t\_0}\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{+197}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-146}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-197}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-259}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+32}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+61}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+65}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ x t_0)) (t_2 (/ y t_0)))
   (if (<= y -1.3e+197)
     (- z)
     (if (<= y -2.7e+41)
       t_2
       (if (<= y -2.5e-146)
         t_1
         (if (<= y -8.5e-197)
           (+ x y)
           (if (<= y -1.35e-259)
             t_1
             (if (<= y 1.3e+32)
               (+ x y)
               (if (<= y 2.15e+61) t_2 (if (<= y 1.05e+65) t_1 (- z)))))))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = x / t_0;
	double t_2 = y / t_0;
	double tmp;
	if (y <= -1.3e+197) {
		tmp = -z;
	} else if (y <= -2.7e+41) {
		tmp = t_2;
	} else if (y <= -2.5e-146) {
		tmp = t_1;
	} else if (y <= -8.5e-197) {
		tmp = x + y;
	} else if (y <= -1.35e-259) {
		tmp = t_1;
	} else if (y <= 1.3e+32) {
		tmp = x + y;
	} else if (y <= 2.15e+61) {
		tmp = t_2;
	} else if (y <= 1.05e+65) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = x / t_0
    t_2 = y / t_0
    if (y <= (-1.3d+197)) then
        tmp = -z
    else if (y <= (-2.7d+41)) then
        tmp = t_2
    else if (y <= (-2.5d-146)) then
        tmp = t_1
    else if (y <= (-8.5d-197)) then
        tmp = x + y
    else if (y <= (-1.35d-259)) then
        tmp = t_1
    else if (y <= 1.3d+32) then
        tmp = x + y
    else if (y <= 2.15d+61) then
        tmp = t_2
    else if (y <= 1.05d+65) then
        tmp = t_1
    else
        tmp = -z
    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 = x / t_0;
	double t_2 = y / t_0;
	double tmp;
	if (y <= -1.3e+197) {
		tmp = -z;
	} else if (y <= -2.7e+41) {
		tmp = t_2;
	} else if (y <= -2.5e-146) {
		tmp = t_1;
	} else if (y <= -8.5e-197) {
		tmp = x + y;
	} else if (y <= -1.35e-259) {
		tmp = t_1;
	} else if (y <= 1.3e+32) {
		tmp = x + y;
	} else if (y <= 2.15e+61) {
		tmp = t_2;
	} else if (y <= 1.05e+65) {
		tmp = t_1;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	t_1 = x / t_0
	t_2 = y / t_0
	tmp = 0
	if y <= -1.3e+197:
		tmp = -z
	elif y <= -2.7e+41:
		tmp = t_2
	elif y <= -2.5e-146:
		tmp = t_1
	elif y <= -8.5e-197:
		tmp = x + y
	elif y <= -1.35e-259:
		tmp = t_1
	elif y <= 1.3e+32:
		tmp = x + y
	elif y <= 2.15e+61:
		tmp = t_2
	elif y <= 1.05e+65:
		tmp = t_1
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	t_1 = Float64(x / t_0)
	t_2 = Float64(y / t_0)
	tmp = 0.0
	if (y <= -1.3e+197)
		tmp = Float64(-z);
	elseif (y <= -2.7e+41)
		tmp = t_2;
	elseif (y <= -2.5e-146)
		tmp = t_1;
	elseif (y <= -8.5e-197)
		tmp = Float64(x + y);
	elseif (y <= -1.35e-259)
		tmp = t_1;
	elseif (y <= 1.3e+32)
		tmp = Float64(x + y);
	elseif (y <= 2.15e+61)
		tmp = t_2;
	elseif (y <= 1.05e+65)
		tmp = t_1;
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = x / t_0;
	t_2 = y / t_0;
	tmp = 0.0;
	if (y <= -1.3e+197)
		tmp = -z;
	elseif (y <= -2.7e+41)
		tmp = t_2;
	elseif (y <= -2.5e-146)
		tmp = t_1;
	elseif (y <= -8.5e-197)
		tmp = x + y;
	elseif (y <= -1.35e-259)
		tmp = t_1;
	elseif (y <= 1.3e+32)
		tmp = x + y;
	elseif (y <= 2.15e+61)
		tmp = t_2;
	elseif (y <= 1.05e+65)
		tmp = t_1;
	else
		tmp = -z;
	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[(x / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(y / t$95$0), $MachinePrecision]}, If[LessEqual[y, -1.3e+197], (-z), If[LessEqual[y, -2.7e+41], t$95$2, If[LessEqual[y, -2.5e-146], t$95$1, If[LessEqual[y, -8.5e-197], N[(x + y), $MachinePrecision], If[LessEqual[y, -1.35e-259], t$95$1, If[LessEqual[y, 1.3e+32], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.15e+61], t$95$2, If[LessEqual[y, 1.05e+65], t$95$1, (-z)]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{x}{t\_0}\\
t_2 := \frac{y}{t\_0}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{+197}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq -2.7 \cdot 10^{+41}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -2.5 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -8.5 \cdot 10^{-197}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq -1.35 \cdot 10^{-259}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+32}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq 2.15 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.05 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.29999999999999994e197 or 1.04999999999999996e65 < y

    1. Initial program 64.0%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified74.0%

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

    if -1.29999999999999994e197 < y < -2.7e41 or 1.3000000000000001e32 < y < 2.1500000000000001e61

    1. Initial program 89.2%

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

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

    if -2.7e41 < y < -2.49999999999999979e-146 or -8.5e-197 < y < -1.34999999999999992e-259 or 2.1500000000000001e61 < y < 1.04999999999999996e65

    1. Initial program 98.4%

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

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

    if -2.49999999999999979e-146 < y < -8.5e-197 or -1.34999999999999992e-259 < y < 1.3000000000000001e32

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+197}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-146}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-197}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-259}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+32}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+61}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+65}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{if}\;z \leq -1.5 \cdot 10^{+32}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-289}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-199}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-45}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+79}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+112}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* z (+ x y)) (- y))))
   (if (<= z -1.5e+32)
     (+ x y)
     (if (<= z -1.5e-289)
       t_0
       (if (<= z 1.12e-199)
         (/ z (/ y (- (+ x y))))
         (if (<= z 1.06e-45)
           t_0
           (if (<= z 1.45e+79)
             (+ x y)
             (if (<= z 6.2e+112)
               (* z (/ (+ x y) (- y)))
               (* (+ x y) (+ 1.0 (/ y z)))))))))))
double code(double x, double y, double z) {
	double t_0 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -1.5e+32) {
		tmp = x + y;
	} else if (z <= -1.5e-289) {
		tmp = t_0;
	} else if (z <= 1.12e-199) {
		tmp = z / (y / -(x + y));
	} else if (z <= 1.06e-45) {
		tmp = t_0;
	} else if (z <= 1.45e+79) {
		tmp = x + y;
	} else if (z <= 6.2e+112) {
		tmp = z * ((x + y) / -y);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = (z * (x + y)) / -y
    if (z <= (-1.5d+32)) then
        tmp = x + y
    else if (z <= (-1.5d-289)) then
        tmp = t_0
    else if (z <= 1.12d-199) then
        tmp = z / (y / -(x + y))
    else if (z <= 1.06d-45) then
        tmp = t_0
    else if (z <= 1.45d+79) then
        tmp = x + y
    else if (z <= 6.2d+112) then
        tmp = z * ((x + y) / -y)
    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 t_0 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -1.5e+32) {
		tmp = x + y;
	} else if (z <= -1.5e-289) {
		tmp = t_0;
	} else if (z <= 1.12e-199) {
		tmp = z / (y / -(x + y));
	} else if (z <= 1.06e-45) {
		tmp = t_0;
	} else if (z <= 1.45e+79) {
		tmp = x + y;
	} else if (z <= 6.2e+112) {
		tmp = z * ((x + y) / -y);
	} else {
		tmp = (x + y) * (1.0 + (y / z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z * (x + y)) / -y
	tmp = 0
	if z <= -1.5e+32:
		tmp = x + y
	elif z <= -1.5e-289:
		tmp = t_0
	elif z <= 1.12e-199:
		tmp = z / (y / -(x + y))
	elif z <= 1.06e-45:
		tmp = t_0
	elif z <= 1.45e+79:
		tmp = x + y
	elif z <= 6.2e+112:
		tmp = z * ((x + y) / -y)
	else:
		tmp = (x + y) * (1.0 + (y / z))
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z * Float64(x + y)) / Float64(-y))
	tmp = 0.0
	if (z <= -1.5e+32)
		tmp = Float64(x + y);
	elseif (z <= -1.5e-289)
		tmp = t_0;
	elseif (z <= 1.12e-199)
		tmp = Float64(z / Float64(y / Float64(-Float64(x + y))));
	elseif (z <= 1.06e-45)
		tmp = t_0;
	elseif (z <= 1.45e+79)
		tmp = Float64(x + y);
	elseif (z <= 6.2e+112)
		tmp = Float64(z * Float64(Float64(x + y) / Float64(-y)));
	else
		tmp = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z * (x + y)) / -y;
	tmp = 0.0;
	if (z <= -1.5e+32)
		tmp = x + y;
	elseif (z <= -1.5e-289)
		tmp = t_0;
	elseif (z <= 1.12e-199)
		tmp = z / (y / -(x + y));
	elseif (z <= 1.06e-45)
		tmp = t_0;
	elseif (z <= 1.45e+79)
		tmp = x + y;
	elseif (z <= 6.2e+112)
		tmp = z * ((x + y) / -y);
	else
		tmp = (x + y) * (1.0 + (y / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision]}, If[LessEqual[z, -1.5e+32], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.5e-289], t$95$0, If[LessEqual[z, 1.12e-199], N[(z / N[(y / (-N[(x + y), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e-45], t$95$0, If[LessEqual[z, 1.45e+79], N[(x + y), $MachinePrecision], If[LessEqual[z, 6.2e+112], N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{z \cdot \left(x + y\right)}{-y}\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{+32}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq -1.5 \cdot 10^{-289}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.12 \cdot 10^{-199}:\\
\;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\

\mathbf{elif}\;z \leq 1.06 \cdot 10^{-45}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.45 \cdot 10^{+79}:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.5e32 or 1.06000000000000004e-45 < z < 1.44999999999999996e79

    1. Initial program 99.9%

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

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

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

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

    if -1.5e32 < z < -1.4999999999999999e-289 or 1.12000000000000003e-199 < z < 1.06000000000000004e-45

    1. Initial program 79.7%

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

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

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

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

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

    if -1.4999999999999999e-289 < z < 1.12000000000000003e-199

    1. Initial program 58.1%

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative91.1%

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

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

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

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

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt6.1%

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv5.7%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt2.8%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod27.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg27.0%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod44.7%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt91.2%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr91.2%

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

    if 1.44999999999999996e79 < z < 6.19999999999999965e112

    1. Initial program 99.8%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in86.3%

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative86.3%

        \[\leadsto z \cdot \frac{\color{blue}{y + x}}{-y} \]
    5. Simplified86.3%

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

    if 6.19999999999999965e112 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+32}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-289}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-199}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-45}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+79}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+112}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 72.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{if}\;z \leq -9 \cdot 10^{+30}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-289}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-199}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-39}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* z (+ x y)) (- y))))
   (if (<= z -9e+30)
     (+ x y)
     (if (<= z -1.4e-289)
       t_0
       (if (<= z 4.8e-199)
         (/ z (/ y (- (+ x y))))
         (if (<= z 8.2e-39)
           t_0
           (if (or (<= z 2.15e+83) (not (<= z 6.2e+112)))
             (+ x y)
             (* z (/ (+ x y) (- y))))))))))
double code(double x, double y, double z) {
	double t_0 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -9e+30) {
		tmp = x + y;
	} else if (z <= -1.4e-289) {
		tmp = t_0;
	} else if (z <= 4.8e-199) {
		tmp = z / (y / -(x + y));
	} else if (z <= 8.2e-39) {
		tmp = t_0;
	} else if ((z <= 2.15e+83) || !(z <= 6.2e+112)) {
		tmp = x + y;
	} 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 = (z * (x + y)) / -y
    if (z <= (-9d+30)) then
        tmp = x + y
    else if (z <= (-1.4d-289)) then
        tmp = t_0
    else if (z <= 4.8d-199) then
        tmp = z / (y / -(x + y))
    else if (z <= 8.2d-39) then
        tmp = t_0
    else if ((z <= 2.15d+83) .or. (.not. (z <= 6.2d+112))) then
        tmp = x + y
    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 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -9e+30) {
		tmp = x + y;
	} else if (z <= -1.4e-289) {
		tmp = t_0;
	} else if (z <= 4.8e-199) {
		tmp = z / (y / -(x + y));
	} else if (z <= 8.2e-39) {
		tmp = t_0;
	} else if ((z <= 2.15e+83) || !(z <= 6.2e+112)) {
		tmp = x + y;
	} else {
		tmp = z * ((x + y) / -y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z * (x + y)) / -y
	tmp = 0
	if z <= -9e+30:
		tmp = x + y
	elif z <= -1.4e-289:
		tmp = t_0
	elif z <= 4.8e-199:
		tmp = z / (y / -(x + y))
	elif z <= 8.2e-39:
		tmp = t_0
	elif (z <= 2.15e+83) or not (z <= 6.2e+112):
		tmp = x + y
	else:
		tmp = z * ((x + y) / -y)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z * Float64(x + y)) / Float64(-y))
	tmp = 0.0
	if (z <= -9e+30)
		tmp = Float64(x + y);
	elseif (z <= -1.4e-289)
		tmp = t_0;
	elseif (z <= 4.8e-199)
		tmp = Float64(z / Float64(y / Float64(-Float64(x + y))));
	elseif (z <= 8.2e-39)
		tmp = t_0;
	elseif ((z <= 2.15e+83) || !(z <= 6.2e+112))
		tmp = Float64(x + y);
	else
		tmp = Float64(z * Float64(Float64(x + y) / Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z * (x + y)) / -y;
	tmp = 0.0;
	if (z <= -9e+30)
		tmp = x + y;
	elseif (z <= -1.4e-289)
		tmp = t_0;
	elseif (z <= 4.8e-199)
		tmp = z / (y / -(x + y));
	elseif (z <= 8.2e-39)
		tmp = t_0;
	elseif ((z <= 2.15e+83) || ~((z <= 6.2e+112)))
		tmp = x + y;
	else
		tmp = z * ((x + y) / -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision]}, If[LessEqual[z, -9e+30], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.4e-289], t$95$0, If[LessEqual[z, 4.8e-199], N[(z / N[(y / (-N[(x + y), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e-39], t$95$0, If[Or[LessEqual[z, 2.15e+83], N[Not[LessEqual[z, 6.2e+112]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{z \cdot \left(x + y\right)}{-y}\\
\mathbf{if}\;z \leq -9 \cdot 10^{+30}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq -1.4 \cdot 10^{-289}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-199}:\\
\;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{-39}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -8.9999999999999999e30 or 8.2e-39 < z < 2.15e83 or 6.19999999999999965e112 < z

    1. Initial program 99.9%

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

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

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

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

    if -8.9999999999999999e30 < z < -1.39999999999999993e-289 or 4.79999999999999991e-199 < z < 8.2e-39

    1. Initial program 79.7%

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

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

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

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

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

    if -1.39999999999999993e-289 < z < 4.79999999999999991e-199

    1. Initial program 58.1%

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative91.1%

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

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

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

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

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt6.1%

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv5.7%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt2.8%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod27.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg27.0%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod44.7%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt91.2%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr91.2%

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

    if 2.15e83 < z < 6.19999999999999965e112

    1. Initial program 99.8%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in86.3%

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative86.3%

        \[\leadsto z \cdot \frac{\color{blue}{y + x}}{-y} \]
    5. Simplified86.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+30}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-289}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-199}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x + y}{-y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{z}{\frac{y}{-\left(x + y\right)}}\\ t_1 := \frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{if}\;z \leq -3.1 \cdot 10^{+31}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-287}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 10^{-198}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-39}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ z (/ y (- (+ x y))))) (t_1 (/ (* z (+ x y)) (- y))))
   (if (<= z -3.1e+31)
     (+ x y)
     (if (<= z -1.75e-287)
       t_1
       (if (<= z 1e-198)
         t_0
         (if (<= z 2.35e-39)
           t_1
           (if (or (<= z 2.15e+83) (not (<= z 6.2e+112))) (+ x y) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = z / (y / -(x + y));
	double t_1 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -3.1e+31) {
		tmp = x + y;
	} else if (z <= -1.75e-287) {
		tmp = t_1;
	} else if (z <= 1e-198) {
		tmp = t_0;
	} else if (z <= 2.35e-39) {
		tmp = t_1;
	} else if ((z <= 2.15e+83) || !(z <= 6.2e+112)) {
		tmp = x + y;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = z / (y / -(x + y))
    t_1 = (z * (x + y)) / -y
    if (z <= (-3.1d+31)) then
        tmp = x + y
    else if (z <= (-1.75d-287)) then
        tmp = t_1
    else if (z <= 1d-198) then
        tmp = t_0
    else if (z <= 2.35d-39) then
        tmp = t_1
    else if ((z <= 2.15d+83) .or. (.not. (z <= 6.2d+112))) then
        tmp = x + y
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z / (y / -(x + y));
	double t_1 = (z * (x + y)) / -y;
	double tmp;
	if (z <= -3.1e+31) {
		tmp = x + y;
	} else if (z <= -1.75e-287) {
		tmp = t_1;
	} else if (z <= 1e-198) {
		tmp = t_0;
	} else if (z <= 2.35e-39) {
		tmp = t_1;
	} else if ((z <= 2.15e+83) || !(z <= 6.2e+112)) {
		tmp = x + y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z / (y / -(x + y))
	t_1 = (z * (x + y)) / -y
	tmp = 0
	if z <= -3.1e+31:
		tmp = x + y
	elif z <= -1.75e-287:
		tmp = t_1
	elif z <= 1e-198:
		tmp = t_0
	elif z <= 2.35e-39:
		tmp = t_1
	elif (z <= 2.15e+83) or not (z <= 6.2e+112):
		tmp = x + y
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z / Float64(y / Float64(-Float64(x + y))))
	t_1 = Float64(Float64(z * Float64(x + y)) / Float64(-y))
	tmp = 0.0
	if (z <= -3.1e+31)
		tmp = Float64(x + y);
	elseif (z <= -1.75e-287)
		tmp = t_1;
	elseif (z <= 1e-198)
		tmp = t_0;
	elseif (z <= 2.35e-39)
		tmp = t_1;
	elseif ((z <= 2.15e+83) || !(z <= 6.2e+112))
		tmp = Float64(x + y);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z / (y / -(x + y));
	t_1 = (z * (x + y)) / -y;
	tmp = 0.0;
	if (z <= -3.1e+31)
		tmp = x + y;
	elseif (z <= -1.75e-287)
		tmp = t_1;
	elseif (z <= 1e-198)
		tmp = t_0;
	elseif (z <= 2.35e-39)
		tmp = t_1;
	elseif ((z <= 2.15e+83) || ~((z <= 6.2e+112)))
		tmp = x + y;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(y / (-N[(x + y), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision]}, If[LessEqual[z, -3.1e+31], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.75e-287], t$95$1, If[LessEqual[z, 1e-198], t$95$0, If[LessEqual[z, 2.35e-39], t$95$1, If[Or[LessEqual[z, 2.15e+83], N[Not[LessEqual[z, 6.2e+112]], $MachinePrecision]], N[(x + y), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y}{-\left(x + y\right)}}\\
t_1 := \frac{z \cdot \left(x + y\right)}{-y}\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-287}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 10^{-198}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.35 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.1000000000000002e31 or 2.3500000000000001e-39 < z < 2.15e83 or 6.19999999999999965e112 < z

    1. Initial program 99.9%

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

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

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

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

    if -3.1000000000000002e31 < z < -1.75e-287 or 9.9999999999999991e-199 < z < 2.3500000000000001e-39

    1. Initial program 79.7%

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

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

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

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

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

    if -1.75e-287 < z < 9.9999999999999991e-199 or 2.15e83 < z < 6.19999999999999965e112

    1. Initial program 65.8%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in90.2%

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative90.2%

        \[\leadsto z \cdot \frac{\color{blue}{y + x}}{-y} \]
    5. Simplified90.2%

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

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

        \[\leadsto \color{blue}{-\frac{z \cdot \left(y + x\right)}{y}} \]
      3. add-sqr-sqrt30.2%

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt5.1%

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv4.9%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt2.5%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod22.4%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg22.4%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod39.1%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt90.2%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr90.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{+31}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-287}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 10^{-198}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-39}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+83} \lor \neg \left(z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.5% accurate, 0.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{-\left(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))) < -1.99999999999999988e-278 or 1.99999999999999993e-271 < (/.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 -1.99999999999999988e-278 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 1.99999999999999993e-271

    1. Initial program 21.3%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{z \cdot \left(y + x\right)}{y}} \]
      3. add-sqr-sqrt48.3%

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt6.0%

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv5.8%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt2.6%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod26.1%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg26.1%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod54.7%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt100.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{-\frac{z}{\frac{y}{y + x}}} \]
  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 -2 \cdot 10^{-278} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 2 \cdot 10^{-271}\right):\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 72.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+32} \lor \neg \left(z \leq 1.06 \cdot 10^{-41} \lor \neg \left(z \leq 1.6 \cdot 10^{+83}\right) \land z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.8e+32)
         (not (or (<= z 1.06e-41) (and (not (<= z 1.6e+83)) (<= z 6.2e+112)))))
   (+ x y)
   (/ z (/ y (- (+ x y))))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.8e+32) || !((z <= 1.06e-41) || (!(z <= 1.6e+83) && (z <= 6.2e+112)))) {
		tmp = x + y;
	} else {
		tmp = z / (y / -(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 <= (-1.8d+32)) .or. (.not. (z <= 1.06d-41) .or. (.not. (z <= 1.6d+83)) .and. (z <= 6.2d+112))) then
        tmp = x + y
    else
        tmp = z / (y / -(x + y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.8e+32) || !((z <= 1.06e-41) || (!(z <= 1.6e+83) && (z <= 6.2e+112)))) {
		tmp = x + y;
	} else {
		tmp = z / (y / -(x + y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.8e+32) or not ((z <= 1.06e-41) or (not (z <= 1.6e+83) and (z <= 6.2e+112))):
		tmp = x + y
	else:
		tmp = z / (y / -(x + y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.8e+32) || !((z <= 1.06e-41) || (!(z <= 1.6e+83) && (z <= 6.2e+112))))
		tmp = Float64(x + y);
	else
		tmp = Float64(z / Float64(y / Float64(-Float64(x + y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.8e+32) || ~(((z <= 1.06e-41) || (~((z <= 1.6e+83)) && (z <= 6.2e+112)))))
		tmp = x + y;
	else
		tmp = z / (y / -(x + y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+32], N[Not[Or[LessEqual[z, 1.06e-41], And[N[Not[LessEqual[z, 1.6e+83]], $MachinePrecision], LessEqual[z, 6.2e+112]]]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z / N[(y / (-N[(x + y), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+32} \lor \neg \left(z \leq 1.06 \cdot 10^{-41} \lor \neg \left(z \leq 1.6 \cdot 10^{+83}\right) \land z \leq 6.2 \cdot 10^{+112}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7999999999999998e32 or 1.06e-41 < z < 1.5999999999999999e83 or 6.19999999999999965e112 < z

    1. Initial program 99.9%

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

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

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

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

    if -1.7999999999999998e32 < z < 1.06e-41 or 1.5999999999999999e83 < z < 6.19999999999999965e112

    1. Initial program 75.4%

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x + y}{y}} \]
      3. distribute-rgt-neg-in76.8%

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

        \[\leadsto z \cdot \color{blue}{\frac{x + y}{-y}} \]
      5. +-commutative76.8%

        \[\leadsto z \cdot \frac{\color{blue}{y + x}}{-y} \]
    5. Simplified76.8%

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

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

        \[\leadsto \color{blue}{-\frac{z \cdot \left(y + x\right)}{y}} \]
      3. add-sqr-sqrt33.8%

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

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

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

        \[\leadsto -\frac{z \cdot \left(y + x\right)}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      7. add-sqr-sqrt3.5%

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

        \[\leadsto -\color{blue}{z \cdot \frac{y + x}{-y}} \]
      9. clear-num3.3%

        \[\leadsto -z \cdot \color{blue}{\frac{1}{\frac{-y}{y + x}}} \]
      10. un-div-inv3.3%

        \[\leadsto -\color{blue}{\frac{z}{\frac{-y}{y + x}}} \]
      11. add-sqr-sqrt1.8%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y + x}} \]
      12. sqrt-unprod24.0%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y + x}} \]
      13. sqr-neg24.0%

        \[\leadsto -\frac{z}{\frac{\sqrt{\color{blue}{y \cdot y}}}{y + x}} \]
      14. sqrt-unprod35.8%

        \[\leadsto -\frac{z}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y + x}} \]
      15. add-sqr-sqrt76.9%

        \[\leadsto -\frac{z}{\frac{\color{blue}{y}}{y + x}} \]
    7. Applied egg-rr76.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+32} \lor \neg \left(z \leq 1.06 \cdot 10^{-41} \lor \neg \left(z \leq 1.6 \cdot 10^{+83}\right) \land z \leq 6.2 \cdot 10^{+112}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{-\left(x + y\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 69.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq -1.12 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -8.8 \cdot 10^{-197}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq -2.4 \cdot 10^{-257}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+35}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.29999999999999996e71 or 4.80000000000000029e35 < y

    1. Initial program 72.4%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified65.2%

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

    if -1.29999999999999996e71 < y < -1.12e-147 or -8.8000000000000001e-197 < y < -2.40000000000000017e-257

    1. Initial program 98.5%

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

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

    if -1.12e-147 < y < -8.8000000000000001e-197 or -2.40000000000000017e-257 < y < 4.80000000000000029e35

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+71}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.12 \cdot 10^{-147}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -8.8 \cdot 10^{-197}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-257}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+35}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 68.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+72} \lor \neg \left(y \leq 4 \cdot 10^{+35}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.19999999999999963e72 or 3.9999999999999999e35 < y

    1. Initial program 72.4%

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

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

        \[\leadsto \color{blue}{-z} \]
    5. Simplified65.2%

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

    if -5.19999999999999963e72 < y < 3.9999999999999999e35

    1. Initial program 99.2%

      \[\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 simplification68.8%

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

Alternative 10: 59.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+18} \lor \neg \left(y \leq 0.000155\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.2e18 or 1.55e-4 < y

    1. Initial program 76.4%

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

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

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

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

    if -3.2e18 < y < 1.55e-4

    1. Initial program 99.9%

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

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

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

Alternative 11: 35.6% 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 88.1%

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

    \[\leadsto \color{blue}{x} \]
  4. 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 2024101 
(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))))