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

Percentage Accurate: 88.1% → 99.2%
Time: 7.8s
Alternatives: 14
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 14 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.1% 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.2% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -4.00000000000000019e-230 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z)))

    1. Initial program 99.9%

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

    if -4.00000000000000019e-230 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0

    1. Initial program 20.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -4.00000000000000019e-230 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z)))

    1. Initial program 99.9%

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

    if -4.00000000000000019e-230 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0

    1. Initial program 20.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-z\right)} - \left(\frac{z \cdot x}{y} - \left(-\frac{{z}^{2}}{y}\right)\right) \]
      6. distribute-frac-neg99.9%

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

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

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

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

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

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

        \[\leadsto \left(-z\right) - \frac{z \cdot x + \color{blue}{z \cdot z}}{y} \]
      13. distribute-lft-out99.9%

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

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

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

Alternative 3: 99.2% 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^{-252} \lor \neg \left(t_0 \leq 0\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{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-252) (not (<= t_0 0.0))) t_0 (/ (* z (- (- y) x)) y))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -2e-252) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = (z * (-y - x)) / y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    if ((t_0 <= (-2d-252)) .or. (.not. (t_0 <= 0.0d0))) then
        tmp = t_0
    else
        tmp = (z * (-y - x)) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if ((t_0 <= -2e-252) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = (z * (-y - x)) / y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if (t_0 <= -2e-252) or not (t_0 <= 0.0):
		tmp = t_0
	else:
		tmp = (z * (-y - x)) / y
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	tmp = 0.0
	if ((t_0 <= -2e-252) || !(t_0 <= 0.0))
		tmp = t_0;
	else
		tmp = Float64(Float64(z * Float64(Float64(-y) - x)) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) / (1.0 - (y / z));
	tmp = 0.0;
	if ((t_0 <= -2e-252) || ~((t_0 <= 0.0)))
		tmp = t_0;
	else
		tmp = (z * (-y - x)) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-252], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -1.99999999999999989e-252 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z)))

    1. Initial program 99.8%

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

    if -1.99999999999999989e-252 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0

    1. Initial program 8.8%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 68.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+160}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{-61}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 96000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+92}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+109}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+143}:\\ \;\;\;\;\left(x \cdot z\right) \cdot \frac{1}{-y}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (+ x y) (- (/ z y)))))
   (if (<= y -4.4e+160)
     (- z)
     (if (<= y -1.85e-61)
       t_0
       (if (<= y 96000000.0)
         (+ x y)
         (if (<= y 1.2e+92)
           t_0
           (if (<= y 5.2e+109)
             (+ x y)
             (if (<= y 1.5e+143) (* (* x z) (/ 1.0 (- y))) (- z)))))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) * -(z / y);
	double tmp;
	if (y <= -4.4e+160) {
		tmp = -z;
	} else if (y <= -1.85e-61) {
		tmp = t_0;
	} else if (y <= 96000000.0) {
		tmp = x + y;
	} else if (y <= 1.2e+92) {
		tmp = t_0;
	} else if (y <= 5.2e+109) {
		tmp = x + y;
	} else if (y <= 1.5e+143) {
		tmp = (x * z) * (1.0 / -y);
	} else {
		tmp = -z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + y) * -(z / y)
    if (y <= (-4.4d+160)) then
        tmp = -z
    else if (y <= (-1.85d-61)) then
        tmp = t_0
    else if (y <= 96000000.0d0) then
        tmp = x + y
    else if (y <= 1.2d+92) then
        tmp = t_0
    else if (y <= 5.2d+109) then
        tmp = x + y
    else if (y <= 1.5d+143) then
        tmp = (x * z) * (1.0d0 / -y)
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) * -(z / y);
	double tmp;
	if (y <= -4.4e+160) {
		tmp = -z;
	} else if (y <= -1.85e-61) {
		tmp = t_0;
	} else if (y <= 96000000.0) {
		tmp = x + y;
	} else if (y <= 1.2e+92) {
		tmp = t_0;
	} else if (y <= 5.2e+109) {
		tmp = x + y;
	} else if (y <= 1.5e+143) {
		tmp = (x * z) * (1.0 / -y);
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) * -(z / y)
	tmp = 0
	if y <= -4.4e+160:
		tmp = -z
	elif y <= -1.85e-61:
		tmp = t_0
	elif y <= 96000000.0:
		tmp = x + y
	elif y <= 1.2e+92:
		tmp = t_0
	elif y <= 5.2e+109:
		tmp = x + y
	elif y <= 1.5e+143:
		tmp = (x * z) * (1.0 / -y)
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) * Float64(-Float64(z / y)))
	tmp = 0.0
	if (y <= -4.4e+160)
		tmp = Float64(-z);
	elseif (y <= -1.85e-61)
		tmp = t_0;
	elseif (y <= 96000000.0)
		tmp = Float64(x + y);
	elseif (y <= 1.2e+92)
		tmp = t_0;
	elseif (y <= 5.2e+109)
		tmp = Float64(x + y);
	elseif (y <= 1.5e+143)
		tmp = Float64(Float64(x * z) * Float64(1.0 / Float64(-y)));
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) * -(z / y);
	tmp = 0.0;
	if (y <= -4.4e+160)
		tmp = -z;
	elseif (y <= -1.85e-61)
		tmp = t_0;
	elseif (y <= 96000000.0)
		tmp = x + y;
	elseif (y <= 1.2e+92)
		tmp = t_0;
	elseif (y <= 5.2e+109)
		tmp = x + y;
	elseif (y <= 1.5e+143)
		tmp = (x * z) * (1.0 / -y);
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] * (-N[(z / y), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[y, -4.4e+160], (-z), If[LessEqual[y, -1.85e-61], t$95$0, If[LessEqual[y, 96000000.0], N[(x + y), $MachinePrecision], If[LessEqual[y, 1.2e+92], t$95$0, If[LessEqual[y, 5.2e+109], N[(x + y), $MachinePrecision], If[LessEqual[y, 1.5e+143], N[(N[(x * z), $MachinePrecision] * N[(1.0 / (-y)), $MachinePrecision]), $MachinePrecision], (-z)]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.85 \cdot 10^{-61}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+92}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{+109}:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.39999999999999984e160 or 1.5e143 < y

    1. Initial program 68.6%

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

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

        \[\leadsto \color{blue}{-z} \]
    4. Simplified78.6%

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

    if -4.39999999999999984e160 < y < -1.85e-61 or 9.6e7 < y < 1.20000000000000002e92

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

    if -1.85e-61 < y < 9.6e7 or 1.20000000000000002e92 < y < 5.1999999999999997e109

    1. Initial program 100.0%

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

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

    if 5.1999999999999997e109 < y < 1.5e143

    1. Initial program 42.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-z\right) \cdot x}{y}} \]
    6. Step-by-step derivation
      1. frac-2neg70.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{+160}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{-61}:\\ \;\;\;\;\left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 96000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+92}:\\ \;\;\;\;\left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+109}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+143}:\\ \;\;\;\;\left(x \cdot z\right) \cdot \frac{1}{-y}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 5: 67.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{1 - \frac{y}{z}}\\ \mathbf{if}\;y \leq -3.1 \cdot 10^{+33}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 16000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+125}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+143}:\\ \;\;\;\;\frac{-z}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ x (- 1.0 (/ y z)))))
   (if (<= y -3.1e+33)
     (- z)
     (if (<= y -4.5e-77)
       t_0
       (if (<= y 16000000.0)
         (+ x y)
         (if (<= y 7.2e+41)
           t_0
           (if (<= y 2.5e+125)
             (+ x y)
             (if (<= y 1.5e+143) (/ (- z) (/ y x)) (- z)))))))))
double code(double x, double y, double z) {
	double t_0 = x / (1.0 - (y / z));
	double tmp;
	if (y <= -3.1e+33) {
		tmp = -z;
	} else if (y <= -4.5e-77) {
		tmp = t_0;
	} else if (y <= 16000000.0) {
		tmp = x + y;
	} else if (y <= 7.2e+41) {
		tmp = t_0;
	} else if (y <= 2.5e+125) {
		tmp = x + y;
	} else if (y <= 1.5e+143) {
		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) :: t_0
    real(8) :: tmp
    t_0 = x / (1.0d0 - (y / z))
    if (y <= (-3.1d+33)) then
        tmp = -z
    else if (y <= (-4.5d-77)) then
        tmp = t_0
    else if (y <= 16000000.0d0) then
        tmp = x + y
    else if (y <= 7.2d+41) then
        tmp = t_0
    else if (y <= 2.5d+125) then
        tmp = x + y
    else if (y <= 1.5d+143) 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 t_0 = x / (1.0 - (y / z));
	double tmp;
	if (y <= -3.1e+33) {
		tmp = -z;
	} else if (y <= -4.5e-77) {
		tmp = t_0;
	} else if (y <= 16000000.0) {
		tmp = x + y;
	} else if (y <= 7.2e+41) {
		tmp = t_0;
	} else if (y <= 2.5e+125) {
		tmp = x + y;
	} else if (y <= 1.5e+143) {
		tmp = -z / (y / x);
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x / (1.0 - (y / z))
	tmp = 0
	if y <= -3.1e+33:
		tmp = -z
	elif y <= -4.5e-77:
		tmp = t_0
	elif y <= 16000000.0:
		tmp = x + y
	elif y <= 7.2e+41:
		tmp = t_0
	elif y <= 2.5e+125:
		tmp = x + y
	elif y <= 1.5e+143:
		tmp = -z / (y / x)
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	t_0 = Float64(x / Float64(1.0 - Float64(y / z)))
	tmp = 0.0
	if (y <= -3.1e+33)
		tmp = Float64(-z);
	elseif (y <= -4.5e-77)
		tmp = t_0;
	elseif (y <= 16000000.0)
		tmp = Float64(x + y);
	elseif (y <= 7.2e+41)
		tmp = t_0;
	elseif (y <= 2.5e+125)
		tmp = Float64(x + y);
	elseif (y <= 1.5e+143)
		tmp = Float64(Float64(-z) / Float64(y / x));
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x / (1.0 - (y / z));
	tmp = 0.0;
	if (y <= -3.1e+33)
		tmp = -z;
	elseif (y <= -4.5e-77)
		tmp = t_0;
	elseif (y <= 16000000.0)
		tmp = x + y;
	elseif (y <= 7.2e+41)
		tmp = t_0;
	elseif (y <= 2.5e+125)
		tmp = x + y;
	elseif (y <= 1.5e+143)
		tmp = -z / (y / x);
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+33], (-z), If[LessEqual[y, -4.5e-77], t$95$0, If[LessEqual[y, 16000000.0], N[(x + y), $MachinePrecision], If[LessEqual[y, 7.2e+41], t$95$0, If[LessEqual[y, 2.5e+125], N[(x + y), $MachinePrecision], If[LessEqual[y, 1.5e+143], N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision], (-z)]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.5 \cdot 10^{-77}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+41}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.5 \cdot 10^{+125}:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.1e33 or 1.5e143 < y

    1. Initial program 75.2%

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

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

        \[\leadsto \color{blue}{-z} \]
    4. Simplified67.2%

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

    if -3.1e33 < y < -4.5000000000000001e-77 or 1.6e7 < y < 7.20000000000000051e41

    1. Initial program 97.4%

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

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

    if -4.5000000000000001e-77 < y < 1.6e7 or 7.20000000000000051e41 < y < 2.49999999999999981e125

    1. Initial program 99.9%

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

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

    if 2.49999999999999981e125 < y < 1.5e143

    1. Initial program 18.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+33}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-77}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 16000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+125}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+143}:\\ \;\;\;\;\frac{-z}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 6: 73.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{-61} \lor \neg \left(y \leq 1.8 \cdot 10^{-35}\right):\\
\;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e-61 or 1.80000000000000009e-35 < y

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.25e-61 < y < 1.80000000000000009e-35

    1. Initial program 100.0%

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

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

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

        \[\leadsto \frac{y}{\frac{z}{\color{blue}{x + y}}} + \left(y + x\right) \]
      3. associate-/r/86.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.25 \cdot 10^{-61} \lor \neg \left(y \leq 1.8 \cdot 10^{-35}\right):\\ \;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \]

Alternative 7: 73.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-61} \lor \neg \left(y \leq 2200000\right):\\
\;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.29999999999999992e-61 or 2.2e6 < y

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.29999999999999992e-61 < y < 2.2e6

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{-61} \lor \neg \left(y \leq 2200000\right):\\ \;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 8: 66.2% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;y \leq -2.7 \cdot 10^{-61}:\\
\;\;\;\;-z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.7999999999999998e32 or -9.00000000000000081e-37 < y < -2.69999999999999993e-61 or 9.5e7 < y

    1. Initial program 76.3%

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

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

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

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

    if -1.7999999999999998e32 < y < -9.00000000000000081e-37

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-z}{y}} \]
    8. Simplified54.1%

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

    if -2.69999999999999993e-61 < y < 9.5e7

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+32}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -9 \cdot 10^{-37}:\\ \;\;\;\;x \cdot \left(-\frac{z}{y}\right)\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-61}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 95000000:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 9: 66.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+37}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-38}:\\ \;\;\;\;\frac{-z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-61}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 150000000:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.8e+37)
   (- z)
   (if (<= y -1.6e-38)
     (/ (- z) (/ y x))
     (if (<= y -2.7e-61) (- z) (if (<= y 150000000.0) (+ x y) (- z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.8e+37) {
		tmp = -z;
	} else if (y <= -1.6e-38) {
		tmp = -z / (y / x);
	} else if (y <= -2.7e-61) {
		tmp = -z;
	} else if (y <= 150000000.0) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-3.8d+37)) then
        tmp = -z
    else if (y <= (-1.6d-38)) then
        tmp = -z / (y / x)
    else if (y <= (-2.7d-61)) then
        tmp = -z
    else if (y <= 150000000.0d0) then
        tmp = x + y
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.8e+37) {
		tmp = -z;
	} else if (y <= -1.6e-38) {
		tmp = -z / (y / x);
	} else if (y <= -2.7e-61) {
		tmp = -z;
	} else if (y <= 150000000.0) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.8e+37:
		tmp = -z
	elif y <= -1.6e-38:
		tmp = -z / (y / x)
	elif y <= -2.7e-61:
		tmp = -z
	elif y <= 150000000.0:
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.8e+37)
		tmp = Float64(-z);
	elseif (y <= -1.6e-38)
		tmp = Float64(Float64(-z) / Float64(y / x));
	elseif (y <= -2.7e-61)
		tmp = Float64(-z);
	elseif (y <= 150000000.0)
		tmp = Float64(x + y);
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.8e+37)
		tmp = -z;
	elseif (y <= -1.6e-38)
		tmp = -z / (y / x);
	elseif (y <= -2.7e-61)
		tmp = -z;
	elseif (y <= 150000000.0)
		tmp = x + y;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+37], (-z), If[LessEqual[y, -1.6e-38], N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.7e-61], (-z), If[LessEqual[y, 150000000.0], N[(x + y), $MachinePrecision], (-z)]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -2.7 \cdot 10^{-61}:\\
\;\;\;\;-z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.7999999999999999e37 or -1.59999999999999989e-38 < y < -2.69999999999999993e-61 or 1.5e8 < y

    1. Initial program 76.1%

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

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

        \[\leadsto \color{blue}{-z} \]
    4. Simplified60.3%

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

    if -3.7999999999999999e37 < y < -1.59999999999999989e-38

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      3. distribute-neg-frac51.7%

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

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

    if -2.69999999999999993e-61 < y < 1.5e8

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+37}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-38}:\\ \;\;\;\;\frac{-z}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-61}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 150000000:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 10: 67.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;x \leq -1.46 \cdot 10^{-37} \lor \neg \left(x \leq 1.4 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{x}{t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.46e-37 or 1.3999999999999999e-32 < x

    1. Initial program 86.7%

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

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

    if -1.46e-37 < x < 1.3999999999999999e-32

    1. Initial program 90.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.46 \cdot 10^{-37} \lor \neg \left(x \leq 1.4 \cdot 10^{-32}\right):\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \end{array} \]

Alternative 11: 66.1% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.32000000000000002e-61 or 7e7 < y

    1. Initial program 79.3%

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

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

        \[\leadsto \color{blue}{-z} \]
    4. Simplified55.8%

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

    if -1.32000000000000002e-61 < y < 7e7

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.32 \cdot 10^{-61}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 70000000:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 12: 59.1% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;y \leq 1.4 \cdot 10^{-33}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.8999999999999999e-61 or 1.4e-33 < y

    1. Initial program 80.0%

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

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

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

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

    if -1.8999999999999999e-61 < y < 1.4e-33

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-61}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-33}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 13: 40.7% accurate, 1.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.5e-102 or 1.06000000000000003e-148 < x

    1. Initial program 87.6%

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

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

    if -1.5e-102 < x < 1.06000000000000003e-148

    1. Initial program 89.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{-148}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 14: 34.6% accurate, 9.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification33.9%

    \[\leadsto x \]

Developer target: 93.9% accurate, 0.7× 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 2023252 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
  :precision binary64

  :herbie-target
  (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))))