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

Percentage Accurate: 88.7% → 98.8%
Time: 5.6s
Alternatives: 10
Speedup: 0.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 88.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.8% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(-z\right) - \frac{z \cdot \left(x + z\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))) < -5.00000000000000024e-223 or 4.99999999999999981e-292 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.8%

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

    if -5.00000000000000024e-223 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 4.99999999999999981e-292

    1. Initial program 17.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-z\right)} - \frac{x \cdot z - -1 \cdot {z}^{2}}{y} \]
      12. cancel-sign-sub-inv100.0%

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

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \color{blue}{1} \cdot {z}^{2}}{y} \]
      14. *-lft-identity100.0%

        \[\leadsto \left(-z\right) - \frac{x \cdot z + \color{blue}{{z}^{2}}}{y} \]
      15. +-commutative100.0%

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

        \[\leadsto \left(-z\right) - \frac{\color{blue}{z \cdot z} + x \cdot z}{y} \]
      17. distribute-rgt-out100.0%

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

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

Alternative 2: 99.0% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x + y}{-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))) < -5.00000000000000024e-223 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.8%

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

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

    1. Initial program 14.7%

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

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

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

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

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

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

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

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

Alternative 3: 60.0% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 9.2 \cdot 10^{-86}:\\
\;\;\;\;-z\\

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

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+32}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.60000000000000004e-31 or 9.50000000000000006e32 < x

    1. Initial program 90.2%

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

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

    if -3.60000000000000004e-31 < x < 2.9999999999999999e-192 or 9.19999999999999985e-86 < x < 5.2e11

    1. Initial program 90.9%

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

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

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

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

    if 2.9999999999999999e-192 < x < 9.19999999999999985e-86 or 5.2e11 < x < 9.50000000000000006e32

    1. Initial program 68.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-31}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-192}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{-86}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 520000000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+32}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 71.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \mathbf{if}\;z \leq -2.55 \cdot 10^{+45}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -6.3 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-33}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-24}:\\ \;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (+ x y) (+ 1.0 (/ y z)))))
   (if (<= z -2.55e+45)
     t_0
     (if (<= z -6.3e-24)
       (/ x (- 1.0 (/ y z)))
       (if (<= z -5e-33)
         (+ x y)
         (if (<= z 5.7e-24) (/ (* z (- (- y) x)) y) t_0))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) * (1.0 + (y / z));
	double tmp;
	if (z <= -2.55e+45) {
		tmp = t_0;
	} else if (z <= -6.3e-24) {
		tmp = x / (1.0 - (y / z));
	} else if (z <= -5e-33) {
		tmp = x + y;
	} else if (z <= 5.7e-24) {
		tmp = (z * (-y - x)) / y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + y) * (1.0d0 + (y / z))
    if (z <= (-2.55d+45)) then
        tmp = t_0
    else if (z <= (-6.3d-24)) then
        tmp = x / (1.0d0 - (y / z))
    else if (z <= (-5d-33)) then
        tmp = x + y
    else if (z <= 5.7d-24) then
        tmp = (z * (-y - x)) / y
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) * (1.0 + (y / z));
	double tmp;
	if (z <= -2.55e+45) {
		tmp = t_0;
	} else if (z <= -6.3e-24) {
		tmp = x / (1.0 - (y / z));
	} else if (z <= -5e-33) {
		tmp = x + y;
	} else if (z <= 5.7e-24) {
		tmp = (z * (-y - x)) / y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) * (1.0 + (y / z))
	tmp = 0
	if z <= -2.55e+45:
		tmp = t_0
	elif z <= -6.3e-24:
		tmp = x / (1.0 - (y / z))
	elif z <= -5e-33:
		tmp = x + y
	elif z <= 5.7e-24:
		tmp = (z * (-y - x)) / y
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z)))
	tmp = 0.0
	if (z <= -2.55e+45)
		tmp = t_0;
	elseif (z <= -6.3e-24)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (z <= -5e-33)
		tmp = Float64(x + y);
	elseif (z <= 5.7e-24)
		tmp = Float64(Float64(z * Float64(Float64(-y) - x)) / y);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) * (1.0 + (y / z));
	tmp = 0.0;
	if (z <= -2.55e+45)
		tmp = t_0;
	elseif (z <= -6.3e-24)
		tmp = x / (1.0 - (y / z));
	elseif (z <= -5e-33)
		tmp = x + y;
	elseif (z <= 5.7e-24)
		tmp = (z * (-y - x)) / y;
	else
		tmp = t_0;
	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[LessEqual[z, -2.55e+45], t$95$0, If[LessEqual[z, -6.3e-24], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5e-33], N[(x + y), $MachinePrecision], If[LessEqual[z, 5.7e-24], N[(N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.5499999999999999e45 or 5.70000000000000002e-24 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    if -2.5499999999999999e45 < z < -6.29999999999999979e-24

    1. Initial program 100.0%

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

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

    if -6.29999999999999979e-24 < z < -5.00000000000000028e-33

    1. Initial program 100.0%

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

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

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

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

    if -5.00000000000000028e-33 < z < 5.70000000000000002e-24

    1. Initial program 71.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{+45}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq -6.3 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-33}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-24}:\\ \;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.2% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-33} \lor \neg \left(z \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.4999999999999995e38 or -3.35000000000000016e-25 < z < -3.60000000000000034e-33 or 9.00000000000000057e-5 < z

    1. Initial program 99.9%

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

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

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

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

    if -9.4999999999999995e38 < z < -3.35000000000000016e-25

    1. Initial program 100.0%

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

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

    if -3.60000000000000034e-33 < z < 9.00000000000000057e-5

    1. Initial program 72.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+38}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -3.35 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-33} \lor \neg \left(z \leq 9 \cdot 10^{-5}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 57.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -1.05 \cdot 10^{+16}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -52000 \lor \neg \left(y \leq 3 \cdot 10^{+94}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.80000000000000022e75 or -1.05e16 < y < -52000 or 3.0000000000000001e94 < y

    1. Initial program 72.1%

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

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

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

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

    if -6.80000000000000022e75 < y < -1.05e16

    1. Initial program 93.3%

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

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

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

    if -52000 < y < 3.0000000000000001e94

    1. Initial program 98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+75}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{+16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -52000 \lor \neg \left(y \leq 3 \cdot 10^{+94}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ \mathbf{if}\;x \leq -3.3 \cdot 10^{-34} \lor \neg \left(x \leq 3.65 \cdot 10^{-72}\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 -3.3e-34) (not (<= x 3.65e-72))) (/ 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 <= -3.3e-34) || !(x <= 3.65e-72)) {
		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 <= (-3.3d-34)) .or. (.not. (x <= 3.65d-72))) 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 <= -3.3e-34) || !(x <= 3.65e-72)) {
		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 <= -3.3e-34) or not (x <= 3.65e-72):
		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 <= -3.3e-34) || !(x <= 3.65e-72))
		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 <= -3.3e-34) || ~((x <= 3.65e-72)))
		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, -3.3e-34], N[Not[LessEqual[x, 3.65e-72]], $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 -3.3 \cdot 10^{-34} \lor \neg \left(x \leq 3.65 \cdot 10^{-72}\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 < -3.29999999999999983e-34 or 3.65000000000000001e-72 < x

    1. Initial program 88.7%

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

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

    if -3.29999999999999983e-34 < x < 3.65000000000000001e-72

    1. Initial program 87.3%

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

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

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

Alternative 8: 60.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-34} \lor \neg \left(z \leq 1.3 \cdot 10^{-24}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.99999999999999971e-34 or 1.3e-24 < z

    1. Initial program 99.9%

      \[\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.99999999999999971e-34 < z < 1.3e-24

    1. Initial program 71.7%

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

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

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

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

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

Alternative 9: 40.6% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.08000000000000004e-152 or 4.9999999999999996e-72 < x

    1. Initial program 87.8%

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

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

    if -1.08000000000000004e-152 < x < 4.9999999999999996e-72

    1. Initial program 89.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.08 \cdot 10^{-152}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-72}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 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.2%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification36.0%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 93.8% 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 2024076 
(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))))