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

Percentage Accurate: 88.2% → 99.5%
Time: 7.5s
Alternatives: 10
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 10 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: 88.2% 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.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^{-262} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
   (if (or (<= t_0 -2e-262) (not (<= t_0 0.0))) t_0 (- (- z) (/ (* x z) y)))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -2e-262) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = -z - ((x * 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 = (x + y) / (1.0d0 - (y / z))
    if ((t_0 <= (-2d-262)) .or. (.not. (t_0 <= 0.0d0))) then
        tmp = t_0
    else
        tmp = -z - ((x * z) / 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-262) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = -z - ((x * z) / y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if (t_0 <= -2e-262) or not (t_0 <= 0.0):
		tmp = t_0
	else:
		tmp = -z - ((x * z) / 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-262) || !(t_0 <= 0.0))
		tmp = t_0;
	else
		tmp = Float64(Float64(-z) - Float64(Float64(x * z) / 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-262) || ~((t_0 <= 0.0)))
		tmp = t_0;
	else
		tmp = -z - ((x * z) / 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-262], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) - N[(N[(x * z), $MachinePrecision] / y), $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^{-262} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 99.9%

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

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

    1. Initial program 12.9%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-112.9%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac212.9%

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

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

      \[\leadsto \color{blue}{-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg100.0%

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

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

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

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

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

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

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

Alternative 2: 73.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ t_1 := 1 - \frac{y}{z}\\ t_2 := \frac{x}{t\_1}\\ \mathbf{if}\;y \leq -1.4 \cdot 10^{+38}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -2.45 \cdot 10^{-54}:\\ \;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\ \mathbf{elif}\;y \leq -4.7 \cdot 10^{-200}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 18000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+41}:\\ \;\;\;\;\frac{y}{t\_1}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+56}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))) (t_1 (- 1.0 (/ y z))) (t_2 (/ x t_1)))
   (if (<= y -1.4e+38)
     t_0
     (if (<= y -5.8e-10)
       (+ x y)
       (if (<= y -2.45e-54)
         (- (- z) (* x (/ z y)))
         (if (<= y -4.7e-200)
           (+ x y)
           (if (<= y 18000000000.0)
             t_2
             (if (<= y 1.4e+41) (/ y t_1) (if (<= y 1.45e+56) t_2 t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double t_1 = 1.0 - (y / z);
	double t_2 = x / t_1;
	double tmp;
	if (y <= -1.4e+38) {
		tmp = t_0;
	} else if (y <= -5.8e-10) {
		tmp = x + y;
	} else if (y <= -2.45e-54) {
		tmp = -z - (x * (z / y));
	} else if (y <= -4.7e-200) {
		tmp = x + y;
	} else if (y <= 18000000000.0) {
		tmp = t_2;
	} else if (y <= 1.4e+41) {
		tmp = y / t_1;
	} else if (y <= 1.45e+56) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_0 = z * ((-1.0d0) - (x / y))
    t_1 = 1.0d0 - (y / z)
    t_2 = x / t_1
    if (y <= (-1.4d+38)) then
        tmp = t_0
    else if (y <= (-5.8d-10)) then
        tmp = x + y
    else if (y <= (-2.45d-54)) then
        tmp = -z - (x * (z / y))
    else if (y <= (-4.7d-200)) then
        tmp = x + y
    else if (y <= 18000000000.0d0) then
        tmp = t_2
    else if (y <= 1.4d+41) then
        tmp = y / t_1
    else if (y <= 1.45d+56) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double t_1 = 1.0 - (y / z);
	double t_2 = x / t_1;
	double tmp;
	if (y <= -1.4e+38) {
		tmp = t_0;
	} else if (y <= -5.8e-10) {
		tmp = x + y;
	} else if (y <= -2.45e-54) {
		tmp = -z - (x * (z / y));
	} else if (y <= -4.7e-200) {
		tmp = x + y;
	} else if (y <= 18000000000.0) {
		tmp = t_2;
	} else if (y <= 1.4e+41) {
		tmp = y / t_1;
	} else if (y <= 1.45e+56) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	t_1 = 1.0 - (y / z)
	t_2 = x / t_1
	tmp = 0
	if y <= -1.4e+38:
		tmp = t_0
	elif y <= -5.8e-10:
		tmp = x + y
	elif y <= -2.45e-54:
		tmp = -z - (x * (z / y))
	elif y <= -4.7e-200:
		tmp = x + y
	elif y <= 18000000000.0:
		tmp = t_2
	elif y <= 1.4e+41:
		tmp = y / t_1
	elif y <= 1.45e+56:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	t_1 = Float64(1.0 - Float64(y / z))
	t_2 = Float64(x / t_1)
	tmp = 0.0
	if (y <= -1.4e+38)
		tmp = t_0;
	elseif (y <= -5.8e-10)
		tmp = Float64(x + y);
	elseif (y <= -2.45e-54)
		tmp = Float64(Float64(-z) - Float64(x * Float64(z / y)));
	elseif (y <= -4.7e-200)
		tmp = Float64(x + y);
	elseif (y <= 18000000000.0)
		tmp = t_2;
	elseif (y <= 1.4e+41)
		tmp = Float64(y / t_1);
	elseif (y <= 1.45e+56)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	t_1 = 1.0 - (y / z);
	t_2 = x / t_1;
	tmp = 0.0;
	if (y <= -1.4e+38)
		tmp = t_0;
	elseif (y <= -5.8e-10)
		tmp = x + y;
	elseif (y <= -2.45e-54)
		tmp = -z - (x * (z / y));
	elseif (y <= -4.7e-200)
		tmp = x + y;
	elseif (y <= 18000000000.0)
		tmp = t_2;
	elseif (y <= 1.4e+41)
		tmp = y / t_1;
	elseif (y <= 1.45e+56)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$1), $MachinePrecision]}, If[LessEqual[y, -1.4e+38], t$95$0, If[LessEqual[y, -5.8e-10], N[(x + y), $MachinePrecision], If[LessEqual[y, -2.45e-54], N[((-z) - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.7e-200], N[(x + y), $MachinePrecision], If[LessEqual[y, 18000000000.0], t$95$2, If[LessEqual[y, 1.4e+41], N[(y / t$95$1), $MachinePrecision], If[LessEqual[y, 1.45e+56], t$95$2, t$95$0]]]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;y \leq -4.7 \cdot 10^{-200}:\\
\;\;\;\;x + y\\

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

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+41}:\\
\;\;\;\;\frac{y}{t\_1}\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.4e38 or 1.45000000000000004e56 < y

    1. Initial program 77.0%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-160.9%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac260.9%

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

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

      \[\leadsto \color{blue}{-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg79.0%

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e38 < y < -5.79999999999999962e-10 or -2.4500000000000001e-54 < y < -4.7000000000000001e-200

    1. Initial program 99.9%

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

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

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

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

    if -5.79999999999999962e-10 < y < -2.4500000000000001e-54

    1. Initial program 100.0%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-181.1%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac281.1%

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

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

      \[\leadsto \color{blue}{-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg81.0%

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg81.0%

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

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

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

    if -4.7000000000000001e-200 < y < 1.8e10 or 1.4e41 < y < 1.45000000000000004e56

    1. Initial program 99.9%

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

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

    if 1.8e10 < y < 1.4e41

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+38}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-10}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -2.45 \cdot 10^{-54}:\\ \;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\ \mathbf{elif}\;y \leq -4.7 \cdot 10^{-200}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 18000000000:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+41}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+56}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ t_1 := 1 - \frac{y}{z}\\ t_2 := \frac{x}{t\_1}\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{+38}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -3.5 \cdot 10^{-7}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-56}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-200}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 34000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+40}:\\ \;\;\;\;\frac{y}{t\_1}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+56}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))) (t_1 (- 1.0 (/ y z))) (t_2 (/ x t_1)))
   (if (<= y -1.3e+38)
     t_0
     (if (<= y -3.5e-7)
       (+ x y)
       (if (<= y -2.8e-56)
         t_0
         (if (<= y -1.6e-200)
           (+ x y)
           (if (<= y 34000000000.0)
             t_2
             (if (<= y 1.2e+40) (/ y t_1) (if (<= y 1.85e+56) t_2 t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double t_1 = 1.0 - (y / z);
	double t_2 = x / t_1;
	double tmp;
	if (y <= -1.3e+38) {
		tmp = t_0;
	} else if (y <= -3.5e-7) {
		tmp = x + y;
	} else if (y <= -2.8e-56) {
		tmp = t_0;
	} else if (y <= -1.6e-200) {
		tmp = x + y;
	} else if (y <= 34000000000.0) {
		tmp = t_2;
	} else if (y <= 1.2e+40) {
		tmp = y / t_1;
	} else if (y <= 1.85e+56) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_0 = z * ((-1.0d0) - (x / y))
    t_1 = 1.0d0 - (y / z)
    t_2 = x / t_1
    if (y <= (-1.3d+38)) then
        tmp = t_0
    else if (y <= (-3.5d-7)) then
        tmp = x + y
    else if (y <= (-2.8d-56)) then
        tmp = t_0
    else if (y <= (-1.6d-200)) then
        tmp = x + y
    else if (y <= 34000000000.0d0) then
        tmp = t_2
    else if (y <= 1.2d+40) then
        tmp = y / t_1
    else if (y <= 1.85d+56) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double t_1 = 1.0 - (y / z);
	double t_2 = x / t_1;
	double tmp;
	if (y <= -1.3e+38) {
		tmp = t_0;
	} else if (y <= -3.5e-7) {
		tmp = x + y;
	} else if (y <= -2.8e-56) {
		tmp = t_0;
	} else if (y <= -1.6e-200) {
		tmp = x + y;
	} else if (y <= 34000000000.0) {
		tmp = t_2;
	} else if (y <= 1.2e+40) {
		tmp = y / t_1;
	} else if (y <= 1.85e+56) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	t_1 = 1.0 - (y / z)
	t_2 = x / t_1
	tmp = 0
	if y <= -1.3e+38:
		tmp = t_0
	elif y <= -3.5e-7:
		tmp = x + y
	elif y <= -2.8e-56:
		tmp = t_0
	elif y <= -1.6e-200:
		tmp = x + y
	elif y <= 34000000000.0:
		tmp = t_2
	elif y <= 1.2e+40:
		tmp = y / t_1
	elif y <= 1.85e+56:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	t_1 = Float64(1.0 - Float64(y / z))
	t_2 = Float64(x / t_1)
	tmp = 0.0
	if (y <= -1.3e+38)
		tmp = t_0;
	elseif (y <= -3.5e-7)
		tmp = Float64(x + y);
	elseif (y <= -2.8e-56)
		tmp = t_0;
	elseif (y <= -1.6e-200)
		tmp = Float64(x + y);
	elseif (y <= 34000000000.0)
		tmp = t_2;
	elseif (y <= 1.2e+40)
		tmp = Float64(y / t_1);
	elseif (y <= 1.85e+56)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	t_1 = 1.0 - (y / z);
	t_2 = x / t_1;
	tmp = 0.0;
	if (y <= -1.3e+38)
		tmp = t_0;
	elseif (y <= -3.5e-7)
		tmp = x + y;
	elseif (y <= -2.8e-56)
		tmp = t_0;
	elseif (y <= -1.6e-200)
		tmp = x + y;
	elseif (y <= 34000000000.0)
		tmp = t_2;
	elseif (y <= 1.2e+40)
		tmp = y / t_1;
	elseif (y <= 1.85e+56)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$1), $MachinePrecision]}, If[LessEqual[y, -1.3e+38], t$95$0, If[LessEqual[y, -3.5e-7], N[(x + y), $MachinePrecision], If[LessEqual[y, -2.8e-56], t$95$0, If[LessEqual[y, -1.6e-200], N[(x + y), $MachinePrecision], If[LessEqual[y, 34000000000.0], t$95$2, If[LessEqual[y, 1.2e+40], N[(y / t$95$1), $MachinePrecision], If[LessEqual[y, 1.85e+56], t$95$2, t$95$0]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -3.5 \cdot 10^{-7}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;y \leq -2.8 \cdot 10^{-56}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -1.6 \cdot 10^{-200}:\\
\;\;\;\;x + y\\

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{y}{t\_1}\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.3e38 or -3.49999999999999984e-7 < y < -2.79999999999999993e-56 or 1.84999999999999998e56 < y

    1. Initial program 79.1%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-162.8%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac262.8%

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3e38 < y < -3.49999999999999984e-7 or -2.79999999999999993e-56 < y < -1.59999999999999991e-200

    1. Initial program 99.9%

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

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

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

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

    if -1.59999999999999991e-200 < y < 3.4e10 or 1.2e40 < y < 1.84999999999999998e56

    1. Initial program 99.9%

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

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

    if 3.4e10 < y < 1.2e40

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+38}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -3.5 \cdot 10^{-7}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-56}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-200}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 34000000000:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+40}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+56}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.7% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;y \leq -4.5 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -2.6 \cdot 10^{-200}:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.49999999999999985e38 or -1.00000000000000006e-9 < y < -4.4999999999999998e-54 or 8.00000000000000074e56 < y

    1. Initial program 79.1%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-162.8%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac262.8%

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.49999999999999985e38 < y < -1.00000000000000006e-9 or -4.4999999999999998e-54 < y < -2.5999999999999999e-200

    1. Initial program 99.9%

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

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

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

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

    if -2.5999999999999999e-200 < y < 8.00000000000000074e56

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+38}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-9}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-54}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-200}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+56}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+37} \lor \neg \left(y \leq -1.25 \cdot 10^{-8} \lor \neg \left(y \leq -9.5 \cdot 10^{-55}\right) \land y \leq 8 \cdot 10^{+39}\right):\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.99999999999999989e37 or -1.2499999999999999e-8 < y < -9.5000000000000006e-55 or 7.99999999999999952e39 < y

    1. Initial program 80.7%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-162.9%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac262.9%

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

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

      \[\leadsto \color{blue}{-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg77.6%

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999989e37 < y < -1.2499999999999999e-8 or -9.5000000000000006e-55 < y < 7.99999999999999952e39

    1. Initial program 99.9%

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

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

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

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

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

Alternative 6: 57.9% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;y \leq -2.1 \cdot 10^{-54} \lor \neg \left(y \leq 1.55 \cdot 10^{+56}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.79999999999999988e47 or -3.9e-10 < y < -2.1e-54 or 1.55000000000000002e56 < y

    1. Initial program 78.7%

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

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

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

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

    if -2.79999999999999988e47 < y < -3.9e-10

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{y + x} \]
    6. Taylor expanded in y around inf 52.0%

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

    if -2.1e-54 < y < 1.55000000000000002e56

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+47}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -3.9 \cdot 10^{-10}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-54} \lor \neg \left(y \leq 1.55 \cdot 10^{+56}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 74.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3200 \lor \neg \left(z \leq 2500000000\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3200 or 2.5e9 < z

    1. Initial program 100.0%

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

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

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

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

    if -3200 < z < 2.5e9

    1. Initial program 81.9%

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

      \[\leadsto \frac{x + y}{\color{blue}{-1 \cdot \frac{y}{z}}} \]
    4. Step-by-step derivation
      1. neg-mul-158.6%

        \[\leadsto \frac{x + y}{\color{blue}{-\frac{y}{z}}} \]
      2. distribute-neg-frac258.6%

        \[\leadsto \frac{x + y}{\color{blue}{\frac{y}{-z}}} \]
    5. Simplified58.6%

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

      \[\leadsto \color{blue}{-1 \cdot z + -1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg75.3%

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

        \[\leadsto \color{blue}{-1 \cdot z - \frac{x \cdot z}{y}} \]
      3. mul-1-neg75.3%

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

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

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

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

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

Alternative 8: 67.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.79999999999999998e91 or 1.4500000000000001e82 < y

    1. Initial program 72.4%

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

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

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

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

    if -8.79999999999999998e91 < y < 1.4500000000000001e82

    1. Initial program 99.4%

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

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

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

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

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

Alternative 9: 39.8% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 7 \cdot 10^{-123}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.1999999999999997e-9 or 6.9999999999999997e-123 < x

    1. Initial program 90.3%

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

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

    if -9.1999999999999997e-9 < x < 6.9999999999999997e-123

    1. Initial program 92.5%

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

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

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

      \[\leadsto \color{blue}{y + x} \]
    6. Taylor expanded in y around inf 39.5%

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

Alternative 10: 35.2% 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 91.1%

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

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

Developer target: 93.6% 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 2024110 
(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))))