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

Percentage Accurate: 88.2% → 99.7%
Time: 7.9s
Alternatives: 9
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 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 88.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Alternative 1: 99.7% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.99999999999999992e-268 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
    3. Taylor expanded in x around 0 99.9%

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

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

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

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

    1. Initial program 8.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 65.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ t_1 := \frac{y}{t\_0}\\ t_2 := \frac{x}{t\_0}\\ \mathbf{if}\;x \leq -2.25 \cdot 10^{-12}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-63}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-91}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-218}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-71}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ y t_0)) (t_2 (/ x t_0)))
   (if (<= x -2.25e-12)
     t_2
     (if (<= x -3.8e-25)
       t_1
       (if (<= x -5e-63)
         (+ x y)
         (if (<= x -5.2e-91)
           (- z)
           (if (<= x -6.3e-218) (+ x y) (if (<= x 2.6e-71) t_1 t_2))))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = y / t_0;
	double t_2 = x / t_0;
	double tmp;
	if (x <= -2.25e-12) {
		tmp = t_2;
	} else if (x <= -3.8e-25) {
		tmp = t_1;
	} else if (x <= -5e-63) {
		tmp = x + y;
	} else if (x <= -5.2e-91) {
		tmp = -z;
	} else if (x <= -6.3e-218) {
		tmp = x + y;
	} else if (x <= 2.6e-71) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = y / t_0
    t_2 = x / t_0
    if (x <= (-2.25d-12)) then
        tmp = t_2
    else if (x <= (-3.8d-25)) then
        tmp = t_1
    else if (x <= (-5d-63)) then
        tmp = x + y
    else if (x <= (-5.2d-91)) then
        tmp = -z
    else if (x <= (-6.3d-218)) then
        tmp = x + y
    else if (x <= 2.6d-71) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = y / t_0;
	double t_2 = x / t_0;
	double tmp;
	if (x <= -2.25e-12) {
		tmp = t_2;
	} else if (x <= -3.8e-25) {
		tmp = t_1;
	} else if (x <= -5e-63) {
		tmp = x + y;
	} else if (x <= -5.2e-91) {
		tmp = -z;
	} else if (x <= -6.3e-218) {
		tmp = x + y;
	} else if (x <= 2.6e-71) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	t_1 = y / t_0
	t_2 = x / t_0
	tmp = 0
	if x <= -2.25e-12:
		tmp = t_2
	elif x <= -3.8e-25:
		tmp = t_1
	elif x <= -5e-63:
		tmp = x + y
	elif x <= -5.2e-91:
		tmp = -z
	elif x <= -6.3e-218:
		tmp = x + y
	elif x <= 2.6e-71:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	t_1 = Float64(y / t_0)
	t_2 = Float64(x / t_0)
	tmp = 0.0
	if (x <= -2.25e-12)
		tmp = t_2;
	elseif (x <= -3.8e-25)
		tmp = t_1;
	elseif (x <= -5e-63)
		tmp = Float64(x + y);
	elseif (x <= -5.2e-91)
		tmp = Float64(-z);
	elseif (x <= -6.3e-218)
		tmp = Float64(x + y);
	elseif (x <= 2.6e-71)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = y / t_0;
	t_2 = x / t_0;
	tmp = 0.0;
	if (x <= -2.25e-12)
		tmp = t_2;
	elseif (x <= -3.8e-25)
		tmp = t_1;
	elseif (x <= -5e-63)
		tmp = x + y;
	elseif (x <= -5.2e-91)
		tmp = -z;
	elseif (x <= -6.3e-218)
		tmp = x + y;
	elseif (x <= 2.6e-71)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$0), $MachinePrecision]}, If[LessEqual[x, -2.25e-12], t$95$2, If[LessEqual[x, -3.8e-25], t$95$1, If[LessEqual[x, -5e-63], N[(x + y), $MachinePrecision], If[LessEqual[x, -5.2e-91], (-z), If[LessEqual[x, -6.3e-218], N[(x + y), $MachinePrecision], If[LessEqual[x, 2.6e-71], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -3.8 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq -5.2 \cdot 10^{-91}:\\
\;\;\;\;-z\\

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

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.2499999999999999e-12 or 2.5999999999999999e-71 < x

    1. Initial program 89.2%

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

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

    if -2.2499999999999999e-12 < x < -3.7999999999999998e-25 or -6.2999999999999996e-218 < x < 2.5999999999999999e-71

    1. Initial program 95.4%

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

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

    if -3.7999999999999998e-25 < x < -5.0000000000000002e-63 or -5.20000000000000028e-91 < x < -6.2999999999999996e-218

    1. Initial program 89.6%

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

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

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

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

    if -5.0000000000000002e-63 < x < -5.20000000000000028e-91

    1. Initial program 56.7%

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

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

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

      \[\leadsto \color{blue}{-z} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-63}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-91}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-218}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-71}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.7% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -1.99999999999999992e-268 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 -1.99999999999999992e-268 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0

    1. Initial program 8.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 59.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{-54}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-168}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-137}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-27}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -3.3e-54)
   (+ x y)
   (if (<= z -1.5e-168)
     (- z)
     (if (<= z 2.5e-137)
       (/ x (- 1.0 (/ y z)))
       (if (<= z 3.5e-27) (- z) (+ x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -3.3e-54) {
		tmp = x + y;
	} else if (z <= -1.5e-168) {
		tmp = -z;
	} else if (z <= 2.5e-137) {
		tmp = x / (1.0 - (y / z));
	} else if (z <= 3.5e-27) {
		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 (z <= (-3.3d-54)) then
        tmp = x + y
    else if (z <= (-1.5d-168)) then
        tmp = -z
    else if (z <= 2.5d-137) then
        tmp = x / (1.0d0 - (y / z))
    else if (z <= 3.5d-27) 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 (z <= -3.3e-54) {
		tmp = x + y;
	} else if (z <= -1.5e-168) {
		tmp = -z;
	} else if (z <= 2.5e-137) {
		tmp = x / (1.0 - (y / z));
	} else if (z <= 3.5e-27) {
		tmp = -z;
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -3.3e-54:
		tmp = x + y
	elif z <= -1.5e-168:
		tmp = -z
	elif z <= 2.5e-137:
		tmp = x / (1.0 - (y / z))
	elif z <= 3.5e-27:
		tmp = -z
	else:
		tmp = x + y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -3.3e-54)
		tmp = Float64(x + y);
	elseif (z <= -1.5e-168)
		tmp = Float64(-z);
	elseif (z <= 2.5e-137)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (z <= 3.5e-27)
		tmp = Float64(-z);
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -3.3e-54)
		tmp = x + y;
	elseif (z <= -1.5e-168)
		tmp = -z;
	elseif (z <= 2.5e-137)
		tmp = x / (1.0 - (y / z));
	elseif (z <= 3.5e-27)
		tmp = -z;
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -3.3e-54], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.5e-168], (-z), If[LessEqual[z, 2.5e-137], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-27], (-z), N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-54}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq -1.5 \cdot 10^{-168}:\\
\;\;\;\;-z\\

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

\mathbf{elif}\;z \leq 3.5 \cdot 10^{-27}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.29999999999999993e-54 or 3.5000000000000001e-27 < z

    1. Initial program 99.3%

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

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

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

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

    if -3.29999999999999993e-54 < z < -1.49999999999999996e-168 or 2.5e-137 < z < 3.5000000000000001e-27

    1. Initial program 73.0%

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

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

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

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

    if -1.49999999999999996e-168 < z < 2.5e-137

    1. Initial program 81.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{-54}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-168}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-137}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-27}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.3 \cdot 10^{-31} \lor \neg \left(z \leq 1.85 \cdot 10^{-6}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.3000000000000003e-31 or 1.8500000000000001e-6 < z

    1. Initial program 99.2%

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

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

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

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

    if -7.3000000000000003e-31 < z < 1.8500000000000001e-6

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 67.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.5e52 or 5.2000000000000001e67 < y

    1. Initial program 72.0%

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

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

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

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

    if -2.5e52 < y < 5.2000000000000001e67

    1. Initial program 99.9%

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

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

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

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

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

Alternative 7: 58.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-10} \lor \neg \left(y \leq 1.05 \cdot 10^{-22}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4999999999999998e-10 or 1.05000000000000004e-22 < y

    1. Initial program 79.0%

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

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

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

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

    if -3.4999999999999998e-10 < y < 1.05000000000000004e-22

    1. Initial program 99.9%

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

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

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

Alternative 8: 39.2% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 1.7 \cdot 10^{-77}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.5000000000000002e-203 or 1.69999999999999991e-77 < x

    1. Initial program 87.8%

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

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

    if -5.5000000000000002e-203 < x < 1.69999999999999991e-77

    1. Initial program 94.2%

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

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

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

Alternative 9: 34.2% accurate, 9.0× speedup?

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

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

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

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

Developer target: 93.7% 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 2024084 
(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))))