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

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

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


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

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-z\right) - \color{blue}{\frac{z}{\frac{y}{x}}} \]
    10. Applied egg-rr100.0%

      \[\leadsto \left(-z\right) - \color{blue}{\frac{z}{\frac{y}{x}}} \]
  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^{-281} \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{z}{\frac{y}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 73.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -9.6 \cdot 10^{+205}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+86}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -5.1 \cdot 10^{-11}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-55}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - \frac{z}{\frac{y}{x}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))))
   (if (<= y -9.6e+205)
     t_0
     (if (<= y -3.1e+86)
       (* y (/ z (- z y)))
       (if (<= y -5.1e-11)
         t_0
         (if (<= y 1.5e-55) (/ x (- 1.0 (/ y z))) (- (- z) (/ z (/ y x)))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -9.6e+205) {
		tmp = t_0;
	} else if (y <= -3.1e+86) {
		tmp = y * (z / (z - y));
	} else if (y <= -5.1e-11) {
		tmp = t_0;
	} else if (y <= 1.5e-55) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z - (z / (y / 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) :: t_0
    real(8) :: tmp
    t_0 = z * ((-1.0d0) - (x / y))
    if (y <= (-9.6d+205)) then
        tmp = t_0
    else if (y <= (-3.1d+86)) then
        tmp = y * (z / (z - y))
    else if (y <= (-5.1d-11)) then
        tmp = t_0
    else if (y <= 1.5d-55) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = -z - (z / (y / x))
    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 <= -9.6e+205) {
		tmp = t_0;
	} else if (y <= -3.1e+86) {
		tmp = y * (z / (z - y));
	} else if (y <= -5.1e-11) {
		tmp = t_0;
	} else if (y <= 1.5e-55) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z - (z / (y / x));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	tmp = 0
	if y <= -9.6e+205:
		tmp = t_0
	elif y <= -3.1e+86:
		tmp = y * (z / (z - y))
	elif y <= -5.1e-11:
		tmp = t_0
	elif y <= 1.5e-55:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = -z - (z / (y / x))
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -9.6e+205)
		tmp = t_0;
	elseif (y <= -3.1e+86)
		tmp = Float64(y * Float64(z / Float64(z - y)));
	elseif (y <= -5.1e-11)
		tmp = t_0;
	elseif (y <= 1.5e-55)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(Float64(-z) - Float64(z / Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	tmp = 0.0;
	if (y <= -9.6e+205)
		tmp = t_0;
	elseif (y <= -3.1e+86)
		tmp = y * (z / (z - y));
	elseif (y <= -5.1e-11)
		tmp = t_0;
	elseif (y <= 1.5e-55)
		tmp = x / (1.0 - (y / z));
	else
		tmp = -z - (z / (y / x));
	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, -9.6e+205], t$95$0, If[LessEqual[y, -3.1e+86], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.1e-11], t$95$0, If[LessEqual[y, 1.5e-55], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z) - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -3.1 \cdot 10^{+86}:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq -5.1 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -9.59999999999999945e205 or -3.1000000000000002e86 < y < -5.09999999999999984e-11

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.59999999999999945e205 < y < -3.1000000000000002e86

    1. Initial program 84.2%

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

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

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

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

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

    if -5.09999999999999984e-11 < y < 1.50000000000000008e-55

    1. Initial program 99.9%

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

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

    if 1.50000000000000008e-55 < y

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-z\right) - \color{blue}{\frac{z}{\frac{y}{x}}} \]
    10. Applied egg-rr74.5%

      \[\leadsto \left(-z\right) - \color{blue}{\frac{z}{\frac{y}{x}}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 73.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -9.5 \cdot 10^{+205}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{+86}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -1.04 \cdot 10^{-19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-55}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - z \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))))
   (if (<= y -9.5e+205)
     t_0
     (if (<= y -2.1e+86)
       (* y (/ z (- z y)))
       (if (<= y -1.04e-19)
         t_0
         (if (<= y 1.5e-55) (/ x (- 1.0 (/ y z))) (- (- z) (* z (/ x y)))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -9.5e+205) {
		tmp = t_0;
	} else if (y <= -2.1e+86) {
		tmp = y * (z / (z - y));
	} else if (y <= -1.04e-19) {
		tmp = t_0;
	} else if (y <= 1.5e-55) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z - (z * (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 = z * ((-1.0d0) - (x / y))
    if (y <= (-9.5d+205)) then
        tmp = t_0
    else if (y <= (-2.1d+86)) then
        tmp = y * (z / (z - y))
    else if (y <= (-1.04d-19)) then
        tmp = t_0
    else if (y <= 1.5d-55) then
        tmp = x / (1.0d0 - (y / z))
    else
        tmp = -z - (z * (x / y))
    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 <= -9.5e+205) {
		tmp = t_0;
	} else if (y <= -2.1e+86) {
		tmp = y * (z / (z - y));
	} else if (y <= -1.04e-19) {
		tmp = t_0;
	} else if (y <= 1.5e-55) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -z - (z * (x / y));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	tmp = 0
	if y <= -9.5e+205:
		tmp = t_0
	elif y <= -2.1e+86:
		tmp = y * (z / (z - y))
	elif y <= -1.04e-19:
		tmp = t_0
	elif y <= 1.5e-55:
		tmp = x / (1.0 - (y / z))
	else:
		tmp = -z - (z * (x / y))
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -9.5e+205)
		tmp = t_0;
	elseif (y <= -2.1e+86)
		tmp = Float64(y * Float64(z / Float64(z - y)));
	elseif (y <= -1.04e-19)
		tmp = t_0;
	elseif (y <= 1.5e-55)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(Float64(-z) - Float64(z * Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	tmp = 0.0;
	if (y <= -9.5e+205)
		tmp = t_0;
	elseif (y <= -2.1e+86)
		tmp = y * (z / (z - y));
	elseif (y <= -1.04e-19)
		tmp = t_0;
	elseif (y <= 1.5e-55)
		tmp = x / (1.0 - (y / z));
	else
		tmp = -z - (z * (x / y));
	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, -9.5e+205], t$95$0, If[LessEqual[y, -2.1e+86], N[(y * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.04e-19], t$95$0, If[LessEqual[y, 1.5e-55], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.1 \cdot 10^{+86}:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq -1.04 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -9.4999999999999997e205 or -2.0999999999999999e86 < y < -1.03999999999999998e-19

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999997e205 < y < -2.0999999999999999e86

    1. Initial program 84.2%

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

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

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

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

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

    if -1.03999999999999998e-19 < y < 1.50000000000000008e-55

    1. Initial program 99.9%

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

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

    if 1.50000000000000008e-55 < y

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 73.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq -8.2 \cdot 10^{+85}:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-14} \lor \neg \left(y \leq 1.5 \cdot 10^{-55}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.4999999999999997e205 or -8.19999999999999957e85 < y < -1.1e-14 or 1.50000000000000008e-55 < y

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999997e205 < y < -8.19999999999999957e85

    1. Initial program 84.2%

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

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

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

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

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

    if -1.1e-14 < y < 1.50000000000000008e-55

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+205}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -8.2 \cdot 10^{+85}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-14} \lor \neg \left(y \leq 1.5 \cdot 10^{-55}\right):\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq -2.1 \cdot 10^{+86}:\\
\;\;\;\;y \cdot \frac{z}{z - y}\\

\mathbf{elif}\;y \leq -1.05 \cdot 10^{-37} \lor \neg \left(y \leq 1.8 \cdot 10^{-51}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.4999999999999997e205 or -2.0999999999999999e86 < y < -1.05e-37 or 1.8e-51 < y

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999997e205 < y < -2.0999999999999999e86

    1. Initial program 84.2%

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

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

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

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

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

    if -1.05e-37 < y < 1.8e-51

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+205}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{+86}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-37} \lor \neg \left(y \leq 1.8 \cdot 10^{-51}\right):\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 69.7% accurate, 0.3× speedup?

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

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

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

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

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1e206 or 6.5000000000000001e158 < y

    1. Initial program 59.2%

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

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

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

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

    if -1e206 < y < -6.99999999999999961e-10 or 1.50000000000000008e-55 < y < 6.5000000000000001e158

    1. Initial program 89.1%

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

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

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

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

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

    if -6.99999999999999961e-10 < y < 1.50000000000000008e-55

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+206}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-10}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-55}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+158}:\\ \;\;\;\;y \cdot \frac{z}{z - y}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 65.2% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.90000000000000008e118 or 1.99999999999999989e72 < y

    1. Initial program 70.6%

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

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

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

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

    if -1.90000000000000008e118 < y < 1.8e-51

    1. Initial program 99.2%

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

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

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

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

    if 1.8e-51 < y < 1.99999999999999989e72

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+118}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+72}:\\ \;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.2% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35e118 or 2.7999999999999999e70 < y

    1. Initial program 70.6%

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

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

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

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

    if -1.35e118 < y < 3.0499999999999998e-50

    1. Initial program 99.2%

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

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

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

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

    if 3.0499999999999998e-50 < y < 2.7999999999999999e70

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{x}{-y}} \]
    6. Simplified52.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+118}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 3.05 \cdot 10^{-50}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+70}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 57.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-5}:\\
\;\;\;\;-z\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{-91}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 6 \cdot 10^{+30}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.69999999999999981e-5 or 5.99999999999999956e30 < y

    1. Initial program 75.0%

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

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

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

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

    if -3.69999999999999981e-5 < y < 1.30000000000000007e-91

    1. Initial program 99.9%

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

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

    if 1.30000000000000007e-91 < y < 5.99999999999999956e30

    1. Initial program 99.6%

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

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

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

Alternative 10: 67.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+117} \lor \neg \left(y \leq 4.3 \cdot 10^{+105}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.59999999999999976e117 or 4.3000000000000002e105 < y

    1. Initial program 67.9%

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

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

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

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

    if -4.59999999999999976e117 < y < 4.3000000000000002e105

    1. Initial program 98.3%

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

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

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

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

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

Alternative 11: 40.3% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 6.8 \cdot 10^{-224}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.39999999999999995e-70 or 6.79999999999999984e-224 < x

    1. Initial program 88.0%

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

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

    if -3.39999999999999995e-70 < x < 6.79999999999999984e-224

    1. Initial program 90.0%

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

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

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

Alternative 12: 35.0% 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.4%

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

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

Developer target: 93.9% 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 2024107 
(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))))