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

Percentage Accurate: 87.9% → 99.0%
Time: 7.7s
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: 87.9% 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.0% accurate, 0.3× 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^{-229} \lor \neg \left(t_1 \leq 0\right):\\ \;\;\;\;\frac{y}{t_0} + \frac{x}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ (+ x y) t_0)))
   (if (or (<= t_1 -2e-229) (not (<= t_1 0.0)))
     (+ (/ y t_0) (/ x t_0))
     (- (- z) (/ (* x z) 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-229) || !(t_1 <= 0.0)) {
		tmp = (y / t_0) + (x / t_0);
	} else {
		tmp = -z - ((x * z) / y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = (x + y) / t_0
    if ((t_1 <= (-2d-229)) .or. (.not. (t_1 <= 0.0d0))) then
        tmp = (y / t_0) + (x / t_0)
    else
        tmp = -z - ((x * z) / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = (x + y) / t_0;
	double tmp;
	if ((t_1 <= -2e-229) || !(t_1 <= 0.0)) {
		tmp = (y / t_0) + (x / t_0);
	} else {
		tmp = -z - ((x * z) / 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-229) or not (t_1 <= 0.0):
		tmp = (y / t_0) + (x / t_0)
	else:
		tmp = -z - ((x * z) / 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-229) || !(t_1 <= 0.0))
		tmp = Float64(Float64(y / t_0) + Float64(x / t_0));
	else
		tmp = Float64(Float64(-z) - Float64(Float64(x * z) / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = (x + y) / t_0;
	tmp = 0.0;
	if ((t_1 <= -2e-229) || ~((t_1 <= 0.0)))
		tmp = (y / t_0) + (x / t_0);
	else
		tmp = -z - ((x * z) / 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-229], 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[(N[(x * z), $MachinePrecision] / y), $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^{-229} \lor \neg \left(t_1 \leq 0\right):\\
\;\;\;\;\frac{y}{t_0} + \frac{x}{t_0}\\

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


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

    1. Initial program 99.9%

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

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

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

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

    if -2.00000000000000014e-229 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0

    1. Initial program 6.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot z + -1 \cdot \color{blue}{\frac{x}{\frac{y}{z}}} \]
      2. mul-1-neg83.7%

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\left(z + \frac{x \cdot z}{y}\right)} \]
  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^{-229} \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}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \end{array} \]

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

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

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


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

    1. Initial program 6.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot z + -1 \cdot \color{blue}{\frac{x}{\frac{y}{z}}} \]
      2. mul-1-neg83.7%

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

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

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

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

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

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

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

Alternative 3: 74.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -270000000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-12}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-245}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-82}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{\frac{y}{x + y}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.7e+41)
   (* z (- -1.0 (/ x y)))
   (if (<= y -270000000000.0)
     (+ x y)
     (if (<= y -7e-12)
       (- (- z) (/ (* x z) y))
       (if (<= y -5e-245)
         (+ x y)
         (if (<= y 4.5e-82)
           (/ x (- 1.0 (/ y z)))
           (if (<= y 9.8e-51) (+ x y) (/ (- z) (/ y (+ x y))))))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.7e+41) {
		tmp = z * (-1.0 - (x / y));
	} else if (y <= -270000000000.0) {
		tmp = x + y;
	} else if (y <= -7e-12) {
		tmp = -z - ((x * z) / y);
	} else if (y <= -5e-245) {
		tmp = x + y;
	} else if (y <= 4.5e-82) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		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 (y <= (-2.7d+41)) then
        tmp = z * ((-1.0d0) - (x / y))
    else if (y <= (-270000000000.0d0)) then
        tmp = x + y
    else if (y <= (-7d-12)) then
        tmp = -z - ((x * z) / y)
    else if (y <= (-5d-245)) then
        tmp = x + y
    else if (y <= 4.5d-82) then
        tmp = x / (1.0d0 - (y / z))
    else if (y <= 9.8d-51) 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 (y <= -2.7e+41) {
		tmp = z * (-1.0 - (x / y));
	} else if (y <= -270000000000.0) {
		tmp = x + y;
	} else if (y <= -7e-12) {
		tmp = -z - ((x * z) / y);
	} else if (y <= -5e-245) {
		tmp = x + y;
	} else if (y <= 4.5e-82) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		tmp = x + y;
	} else {
		tmp = -z / (y / (x + y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.7e+41:
		tmp = z * (-1.0 - (x / y))
	elif y <= -270000000000.0:
		tmp = x + y
	elif y <= -7e-12:
		tmp = -z - ((x * z) / y)
	elif y <= -5e-245:
		tmp = x + y
	elif y <= 4.5e-82:
		tmp = x / (1.0 - (y / z))
	elif y <= 9.8e-51:
		tmp = x + y
	else:
		tmp = -z / (y / (x + y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.7e+41)
		tmp = Float64(z * Float64(-1.0 - Float64(x / y)));
	elseif (y <= -270000000000.0)
		tmp = Float64(x + y);
	elseif (y <= -7e-12)
		tmp = Float64(Float64(-z) - Float64(Float64(x * z) / y));
	elseif (y <= -5e-245)
		tmp = Float64(x + y);
	elseif (y <= 4.5e-82)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (y <= 9.8e-51)
		tmp = Float64(x + y);
	else
		tmp = Float64(Float64(-z) / Float64(y / Float64(x + y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.7e+41)
		tmp = z * (-1.0 - (x / y));
	elseif (y <= -270000000000.0)
		tmp = x + y;
	elseif (y <= -7e-12)
		tmp = -z - ((x * z) / y);
	elseif (y <= -5e-245)
		tmp = x + y;
	elseif (y <= 4.5e-82)
		tmp = x / (1.0 - (y / z));
	elseif (y <= 9.8e-51)
		tmp = x + y;
	else
		tmp = -z / (y / (x + y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+41], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -270000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[y, -7e-12], N[((-z) - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5e-245], N[(x + y), $MachinePrecision], If[LessEqual[y, 4.5e-82], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-51], N[(x + y), $MachinePrecision], N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+41}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\

\mathbf{elif}\;y \leq -270000000000:\\
\;\;\;\;x + y\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.7e41

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot z + -1 \cdot \color{blue}{\frac{x}{\frac{y}{z}}} \]
      2. mul-1-neg74.9%

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

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

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

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

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

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

    if -2.7e41 < y < -2.7e11 or -7.0000000000000001e-12 < y < -4.9999999999999997e-245 or 4.4999999999999998e-82 < y < 9.79999999999999948e-51

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified83.6%

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

    if -2.7e11 < y < -7.0000000000000001e-12

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999997e-245 < y < 4.4999999999999998e-82

    1. Initial program 100.0%

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

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

    if 9.79999999999999948e-51 < y

    1. Initial program 77.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -270000000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-12}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-245}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-82}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{\frac{y}{x + y}}\\ \end{array} \]

Alternative 4: 74.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{+22}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-10}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-238}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-79}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{\frac{y}{x + y}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))))
   (if (<= y -2.7e+41)
     t_0
     (if (<= y -6.2e+22)
       (* (+ x y) (+ 1.0 (/ y z)))
       (if (<= y -2.4e-10)
         t_0
         (if (<= y -6.2e-238)
           (+ x y)
           (if (<= y 2.65e-79)
             (/ x (- 1.0 (/ y z)))
             (if (<= y 9.8e-51) (+ x y) (/ (- z) (/ y (+ x y)))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -2.7e+41) {
		tmp = t_0;
	} else if (y <= -6.2e+22) {
		tmp = (x + y) * (1.0 + (y / z));
	} else if (y <= -2.4e-10) {
		tmp = t_0;
	} else if (y <= -6.2e-238) {
		tmp = x + y;
	} else if (y <= 2.65e-79) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		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) :: t_0
    real(8) :: tmp
    t_0 = z * ((-1.0d0) - (x / y))
    if (y <= (-2.7d+41)) then
        tmp = t_0
    else if (y <= (-6.2d+22)) then
        tmp = (x + y) * (1.0d0 + (y / z))
    else if (y <= (-2.4d-10)) then
        tmp = t_0
    else if (y <= (-6.2d-238)) then
        tmp = x + y
    else if (y <= 2.65d-79) then
        tmp = x / (1.0d0 - (y / z))
    else if (y <= 9.8d-51) 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 t_0 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -2.7e+41) {
		tmp = t_0;
	} else if (y <= -6.2e+22) {
		tmp = (x + y) * (1.0 + (y / z));
	} else if (y <= -2.4e-10) {
		tmp = t_0;
	} else if (y <= -6.2e-238) {
		tmp = x + y;
	} else if (y <= 2.65e-79) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		tmp = x + y;
	} else {
		tmp = -z / (y / (x + y));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	tmp = 0
	if y <= -2.7e+41:
		tmp = t_0
	elif y <= -6.2e+22:
		tmp = (x + y) * (1.0 + (y / z))
	elif y <= -2.4e-10:
		tmp = t_0
	elif y <= -6.2e-238:
		tmp = x + y
	elif y <= 2.65e-79:
		tmp = x / (1.0 - (y / z))
	elif y <= 9.8e-51:
		tmp = x + y
	else:
		tmp = -z / (y / (x + y))
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -2.7e+41)
		tmp = t_0;
	elseif (y <= -6.2e+22)
		tmp = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z)));
	elseif (y <= -2.4e-10)
		tmp = t_0;
	elseif (y <= -6.2e-238)
		tmp = Float64(x + y);
	elseif (y <= 2.65e-79)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (y <= 9.8e-51)
		tmp = Float64(x + y);
	else
		tmp = Float64(Float64(-z) / Float64(y / Float64(x + y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	tmp = 0.0;
	if (y <= -2.7e+41)
		tmp = t_0;
	elseif (y <= -6.2e+22)
		tmp = (x + y) * (1.0 + (y / z));
	elseif (y <= -2.4e-10)
		tmp = t_0;
	elseif (y <= -6.2e-238)
		tmp = x + y;
	elseif (y <= 2.65e-79)
		tmp = x / (1.0 - (y / z));
	elseif (y <= 9.8e-51)
		tmp = x + y;
	else
		tmp = -z / (y / (x + y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.7e+41], t$95$0, If[LessEqual[y, -6.2e+22], N[(N[(x + y), $MachinePrecision] * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.4e-10], t$95$0, If[LessEqual[y, -6.2e-238], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.65e-79], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-51], N[(x + y), $MachinePrecision], N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.7e41 or -6.2000000000000004e22 < y < -2.4e-10

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot z + -1 \cdot \color{blue}{\frac{x}{\frac{y}{z}}} \]
      2. mul-1-neg76.1%

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

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

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

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

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

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

    if -2.7e41 < y < -6.2000000000000004e22

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -2.4e-10 < y < -6.2000000000000002e-238 or 2.6499999999999999e-79 < y < 9.79999999999999948e-51

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified83.9%

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

    if -6.2000000000000002e-238 < y < 2.6499999999999999e-79

    1. Initial program 100.0%

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

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

    if 9.79999999999999948e-51 < y

    1. Initial program 77.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{+41}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{+22}:\\ \;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-10}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-238}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-79}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{\frac{y}{x + y}}\\ \end{array} \]

Alternative 5: 74.7% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq -120000000:\\
\;\;\;\;x + y\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.54999999999999989e41 or -1.2e8 < y < -4.5e-11 or 9.3999999999999995e-51 < y

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.54999999999999989e41 < y < -1.2e8 or -4.5e-11 < y < -2.4999999999999999e-235 or 1.3999999999999999e-81 < y < 9.3999999999999995e-51

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified83.6%

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

    if -2.4999999999999999e-235 < y < 1.3999999999999999e-81

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{+41}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -120000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-11}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-235}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.4 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 6: 74.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -2.3 \cdot 10^{+41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2150000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-11}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-235}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- -1.0 (/ x y)))))
   (if (<= y -2.3e+41)
     t_0
     (if (<= y -2150000000.0)
       (+ x y)
       (if (<= y -3.7e-11)
         (- (- z) (/ (* x z) y))
         (if (<= y -3.3e-235)
           (+ x y)
           (if (<= y 3e-78)
             (/ x (- 1.0 (/ y z)))
             (if (<= y 9.8e-51) (+ x y) t_0))))))))
double code(double x, double y, double z) {
	double t_0 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -2.3e+41) {
		tmp = t_0;
	} else if (y <= -2150000000.0) {
		tmp = x + y;
	} else if (y <= -3.7e-11) {
		tmp = -z - ((x * z) / y);
	} else if (y <= -3.3e-235) {
		tmp = x + y;
	} else if (y <= 3e-78) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		tmp = 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 = z * ((-1.0d0) - (x / y))
    if (y <= (-2.3d+41)) then
        tmp = t_0
    else if (y <= (-2150000000.0d0)) then
        tmp = x + y
    else if (y <= (-3.7d-11)) then
        tmp = -z - ((x * z) / y)
    else if (y <= (-3.3d-235)) then
        tmp = x + y
    else if (y <= 3d-78) then
        tmp = x / (1.0d0 - (y / z))
    else if (y <= 9.8d-51) then
        tmp = 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 = z * (-1.0 - (x / y));
	double tmp;
	if (y <= -2.3e+41) {
		tmp = t_0;
	} else if (y <= -2150000000.0) {
		tmp = x + y;
	} else if (y <= -3.7e-11) {
		tmp = -z - ((x * z) / y);
	} else if (y <= -3.3e-235) {
		tmp = x + y;
	} else if (y <= 3e-78) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= 9.8e-51) {
		tmp = x + y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (-1.0 - (x / y))
	tmp = 0
	if y <= -2.3e+41:
		tmp = t_0
	elif y <= -2150000000.0:
		tmp = x + y
	elif y <= -3.7e-11:
		tmp = -z - ((x * z) / y)
	elif y <= -3.3e-235:
		tmp = x + y
	elif y <= 3e-78:
		tmp = x / (1.0 - (y / z))
	elif y <= 9.8e-51:
		tmp = x + y
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(-1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -2.3e+41)
		tmp = t_0;
	elseif (y <= -2150000000.0)
		tmp = Float64(x + y);
	elseif (y <= -3.7e-11)
		tmp = Float64(Float64(-z) - Float64(Float64(x * z) / y));
	elseif (y <= -3.3e-235)
		tmp = Float64(x + y);
	elseif (y <= 3e-78)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (y <= 9.8e-51)
		tmp = Float64(x + y);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (-1.0 - (x / y));
	tmp = 0.0;
	if (y <= -2.3e+41)
		tmp = t_0;
	elseif (y <= -2150000000.0)
		tmp = x + y;
	elseif (y <= -3.7e-11)
		tmp = -z - ((x * z) / y);
	elseif (y <= -3.3e-235)
		tmp = x + y;
	elseif (y <= 3e-78)
		tmp = x / (1.0 - (y / z));
	elseif (y <= 9.8e-51)
		tmp = x + y;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e+41], t$95$0, If[LessEqual[y, -2150000000.0], N[(x + y), $MachinePrecision], If[LessEqual[y, -3.7e-11], N[((-z) - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.3e-235], N[(x + y), $MachinePrecision], If[LessEqual[y, 3e-78], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-51], N[(x + y), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2150000000:\\
\;\;\;\;x + y\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.2999999999999998e41 or 9.79999999999999948e-51 < y

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2999999999999998e41 < y < -2.15e9 or -3.7000000000000001e-11 < y < -3.30000000000000028e-235 or 2.99999999999999988e-78 < y < 9.79999999999999948e-51

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{y + x} \]
    4. Simplified83.6%

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

    if -2.15e9 < y < -3.7000000000000001e-11

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.30000000000000028e-235 < y < 2.99999999999999988e-78

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+41}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2150000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-11}:\\ \;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-235}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 7: 67.0% accurate, 0.7× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.7999999999999994e45 or 9.79999999999999948e-51 < y

    1. Initial program 73.5%

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

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

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

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

    if -5.7999999999999994e45 < y < -5.6000000000000002e-233 or 4.50000000000000016e-84 < y < 9.79999999999999948e-51

    1. Initial program 99.9%

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

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

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

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

    if -5.6000000000000002e-233 < y < 4.50000000000000016e-84

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{+45}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-233}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-84}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-51}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]

Alternative 8: 66.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+45} \lor \neg \left(y \leq 9.8 \cdot 10^{-51}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.09999999999999995e45 or 9.79999999999999948e-51 < y

    1. Initial program 73.5%

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

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

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

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

    if -2.09999999999999995e45 < y < 9.79999999999999948e-51

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{+45} \lor \neg \left(y \leq 9.8 \cdot 10^{-51}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 9: 59.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-42} \lor \neg \left(y \leq 9.8 \cdot 10^{-51}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.4999999999999998e-42 or 9.79999999999999948e-51 < y

    1. Initial program 77.0%

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

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

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

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

    if -6.4999999999999998e-42 < y < 9.79999999999999948e-51

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{-42} \lor \neg \left(y \leq 9.8 \cdot 10^{-51}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 10: 35.0% accurate, 9.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification39.0%

    \[\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 2023301 
(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))))