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

Percentage Accurate: 87.9% → 99.1%
Time: 6.0s
Alternatives: 11
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 11 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.1% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 99.9%

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

    if -4.9999999999999998e-281 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 4.9999999999999998e-241

    1. Initial program 19.3%

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

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

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

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

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

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

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

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

Alternative 2: 66.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{y}{z}\\ t_1 := \frac{x}{t_0}\\ \mathbf{if}\;y \leq -4.9 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.3 \cdot 10^{+112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.42 \cdot 10^{+91}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -3.5 \cdot 10^{+74}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -5.9 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-21}:\\ \;\;\;\;\frac{y}{t_0}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ x t_0)))
   (if (<= y -4.9e+129)
     (- z)
     (if (<= y -4.3e+112)
       t_1
       (if (<= y -1.42e+91)
         (- z)
         (if (<= y -3.5e+74)
           (* (- z) (/ x y))
           (if (<= y -5.9e+62)
             t_1
             (if (<= y -1.05e-21)
               (/ y t_0)
               (if (<= y 1.2e+173) (+ x y) (- z))))))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (y / z);
	double t_1 = x / t_0;
	double tmp;
	if (y <= -4.9e+129) {
		tmp = -z;
	} else if (y <= -4.3e+112) {
		tmp = t_1;
	} else if (y <= -1.42e+91) {
		tmp = -z;
	} else if (y <= -3.5e+74) {
		tmp = -z * (x / y);
	} else if (y <= -5.9e+62) {
		tmp = t_1;
	} else if (y <= -1.05e-21) {
		tmp = y / t_0;
	} else if (y <= 1.2e+173) {
		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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (y / z)
    t_1 = x / t_0
    if (y <= (-4.9d+129)) then
        tmp = -z
    else if (y <= (-4.3d+112)) then
        tmp = t_1
    else if (y <= (-1.42d+91)) then
        tmp = -z
    else if (y <= (-3.5d+74)) then
        tmp = -z * (x / y)
    else if (y <= (-5.9d+62)) then
        tmp = t_1
    else if (y <= (-1.05d-21)) then
        tmp = y / t_0
    else if (y <= 1.2d+173) then
        tmp = x + y
    else
        tmp = -z
    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 / t_0;
	double tmp;
	if (y <= -4.9e+129) {
		tmp = -z;
	} else if (y <= -4.3e+112) {
		tmp = t_1;
	} else if (y <= -1.42e+91) {
		tmp = -z;
	} else if (y <= -3.5e+74) {
		tmp = -z * (x / y);
	} else if (y <= -5.9e+62) {
		tmp = t_1;
	} else if (y <= -1.05e-21) {
		tmp = y / t_0;
	} else if (y <= 1.2e+173) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (y / z)
	t_1 = x / t_0
	tmp = 0
	if y <= -4.9e+129:
		tmp = -z
	elif y <= -4.3e+112:
		tmp = t_1
	elif y <= -1.42e+91:
		tmp = -z
	elif y <= -3.5e+74:
		tmp = -z * (x / y)
	elif y <= -5.9e+62:
		tmp = t_1
	elif y <= -1.05e-21:
		tmp = y / t_0
	elif y <= 1.2e+173:
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(y / z))
	t_1 = Float64(x / t_0)
	tmp = 0.0
	if (y <= -4.9e+129)
		tmp = Float64(-z);
	elseif (y <= -4.3e+112)
		tmp = t_1;
	elseif (y <= -1.42e+91)
		tmp = Float64(-z);
	elseif (y <= -3.5e+74)
		tmp = Float64(Float64(-z) * Float64(x / y));
	elseif (y <= -5.9e+62)
		tmp = t_1;
	elseif (y <= -1.05e-21)
		tmp = Float64(y / t_0);
	elseif (y <= 1.2e+173)
		tmp = Float64(x + y);
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (y / z);
	t_1 = x / t_0;
	tmp = 0.0;
	if (y <= -4.9e+129)
		tmp = -z;
	elseif (y <= -4.3e+112)
		tmp = t_1;
	elseif (y <= -1.42e+91)
		tmp = -z;
	elseif (y <= -3.5e+74)
		tmp = -z * (x / y);
	elseif (y <= -5.9e+62)
		tmp = t_1;
	elseif (y <= -1.05e-21)
		tmp = y / t_0;
	elseif (y <= 1.2e+173)
		tmp = x + y;
	else
		tmp = -z;
	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[(x / t$95$0), $MachinePrecision]}, If[LessEqual[y, -4.9e+129], (-z), If[LessEqual[y, -4.3e+112], t$95$1, If[LessEqual[y, -1.42e+91], (-z), If[LessEqual[y, -3.5e+74], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.9e+62], t$95$1, If[LessEqual[y, -1.05e-21], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, 1.2e+173], N[(x + y), $MachinePrecision], (-z)]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.3 \cdot 10^{+112}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.42 \cdot 10^{+91}:\\
\;\;\;\;-z\\

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

\mathbf{elif}\;y \leq -5.9 \cdot 10^{+62}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.05 \cdot 10^{-21}:\\
\;\;\;\;\frac{y}{t_0}\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+173}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -4.9e129 or -4.29999999999999983e112 < y < -1.41999999999999995e91 or 1.2e173 < y

    1. Initial program 54.7%

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

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

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

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

    if -4.9e129 < y < -4.29999999999999983e112 or -3.50000000000000014e74 < y < -5.9000000000000003e62

    1. Initial program 99.8%

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

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

    if -1.41999999999999995e91 < y < -3.50000000000000014e74

    1. Initial program 52.3%

      \[\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}{\frac{z}{\frac{y}{x + y}}} \]
      3. distribute-neg-frac100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.9000000000000003e62 < y < -1.05000000000000006e-21

    1. Initial program 95.4%

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

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

    if -1.05000000000000006e-21 < y < 1.2e173

    1. Initial program 97.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.9 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.3 \cdot 10^{+112}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.42 \cdot 10^{+91}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -3.5 \cdot 10^{+74}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -5.9 \cdot 10^{+62}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-21}:\\ \;\;\;\;\frac{y}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 67.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.9 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{+87}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+81}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-23}:\\ \;\;\;\;\frac{z}{y} \cdot \left(\left(-x\right) - y\right)\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.9e+129)
   (- z)
   (if (<= y -3.6e+115)
     (/ x (- 1.0 (/ y z)))
     (if (<= y -1.6e+87)
       (- z)
       (if (<= y -4.5e+81)
         (* (- z) (/ x y))
         (if (<= y -2.1e-23)
           (* (/ z y) (- (- x) y))
           (if (<= y 6.5e+173) (+ x y) (- z))))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.9e+129) {
		tmp = -z;
	} else if (y <= -3.6e+115) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= -1.6e+87) {
		tmp = -z;
	} else if (y <= -4.5e+81) {
		tmp = -z * (x / y);
	} else if (y <= -2.1e-23) {
		tmp = (z / y) * (-x - y);
	} else if (y <= 6.5e+173) {
		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 <= (-4.9d+129)) then
        tmp = -z
    else if (y <= (-3.6d+115)) then
        tmp = x / (1.0d0 - (y / z))
    else if (y <= (-1.6d+87)) then
        tmp = -z
    else if (y <= (-4.5d+81)) then
        tmp = -z * (x / y)
    else if (y <= (-2.1d-23)) then
        tmp = (z / y) * (-x - y)
    else if (y <= 6.5d+173) 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 <= -4.9e+129) {
		tmp = -z;
	} else if (y <= -3.6e+115) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= -1.6e+87) {
		tmp = -z;
	} else if (y <= -4.5e+81) {
		tmp = -z * (x / y);
	} else if (y <= -2.1e-23) {
		tmp = (z / y) * (-x - y);
	} else if (y <= 6.5e+173) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4.9e+129:
		tmp = -z
	elif y <= -3.6e+115:
		tmp = x / (1.0 - (y / z))
	elif y <= -1.6e+87:
		tmp = -z
	elif y <= -4.5e+81:
		tmp = -z * (x / y)
	elif y <= -2.1e-23:
		tmp = (z / y) * (-x - y)
	elif y <= 6.5e+173:
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.9e+129)
		tmp = Float64(-z);
	elseif (y <= -3.6e+115)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (y <= -1.6e+87)
		tmp = Float64(-z);
	elseif (y <= -4.5e+81)
		tmp = Float64(Float64(-z) * Float64(x / y));
	elseif (y <= -2.1e-23)
		tmp = Float64(Float64(z / y) * Float64(Float64(-x) - y));
	elseif (y <= 6.5e+173)
		tmp = Float64(x + y);
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -4.9e+129)
		tmp = -z;
	elseif (y <= -3.6e+115)
		tmp = x / (1.0 - (y / z));
	elseif (y <= -1.6e+87)
		tmp = -z;
	elseif (y <= -4.5e+81)
		tmp = -z * (x / y);
	elseif (y <= -2.1e-23)
		tmp = (z / y) * (-x - y);
	elseif (y <= 6.5e+173)
		tmp = x + y;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4.9e+129], (-z), If[LessEqual[y, -3.6e+115], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.6e+87], (-z), If[LessEqual[y, -4.5e+81], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.1e-23], N[(N[(z / y), $MachinePrecision] * N[((-x) - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+173], N[(x + y), $MachinePrecision], (-z)]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -3.6 \cdot 10^{+115}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

\mathbf{elif}\;y \leq -1.6 \cdot 10^{+87}:\\
\;\;\;\;-z\\

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

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

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+173}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -4.9e129 or -3.6000000000000001e115 < y < -1.6e87 or 6.4999999999999997e173 < y

    1. Initial program 54.7%

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

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

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

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

    if -4.9e129 < y < -3.6000000000000001e115

    1. Initial program 99.7%

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

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

    if -1.6e87 < y < -4.50000000000000017e81

    1. Initial program 52.3%

      \[\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}{\frac{z}{\frac{y}{x + y}}} \]
      3. distribute-neg-frac100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.50000000000000017e81 < y < -2.1000000000000001e-23

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

    if -2.1000000000000001e-23 < y < 6.4999999999999997e173

    1. Initial program 97.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.9 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{+87}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+81}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-23}:\\ \;\;\;\;\frac{z}{y} \cdot \left(\left(-x\right) - y\right)\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{+87}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{+73}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -7 \cdot 10^{+39} \lor \neg \left(y \leq -1.55 \cdot 10^{-22}\right) \land y \leq 1.16 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.2e+129)
   (- z)
   (if (<= y -4.5e+122)
     (/ x (- 1.0 (/ y z)))
     (if (<= y -1.85e+87)
       (- z)
       (if (<= y -1.6e+73)
         (* (- z) (/ x y))
         (if (or (<= y -7e+39) (and (not (<= y -1.55e-22)) (<= y 1.16e+173)))
           (+ x y)
           (- z)))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.2e+129) {
		tmp = -z;
	} else if (y <= -4.5e+122) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= -1.85e+87) {
		tmp = -z;
	} else if (y <= -1.6e+73) {
		tmp = -z * (x / y);
	} else if ((y <= -7e+39) || (!(y <= -1.55e-22) && (y <= 1.16e+173))) {
		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.2d+129)) then
        tmp = -z
    else if (y <= (-4.5d+122)) then
        tmp = x / (1.0d0 - (y / z))
    else if (y <= (-1.85d+87)) then
        tmp = -z
    else if (y <= (-1.6d+73)) then
        tmp = -z * (x / y)
    else if ((y <= (-7d+39)) .or. (.not. (y <= (-1.55d-22))) .and. (y <= 1.16d+173)) 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.2e+129) {
		tmp = -z;
	} else if (y <= -4.5e+122) {
		tmp = x / (1.0 - (y / z));
	} else if (y <= -1.85e+87) {
		tmp = -z;
	} else if (y <= -1.6e+73) {
		tmp = -z * (x / y);
	} else if ((y <= -7e+39) || (!(y <= -1.55e-22) && (y <= 1.16e+173))) {
		tmp = x + y;
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -5.2e+129:
		tmp = -z
	elif y <= -4.5e+122:
		tmp = x / (1.0 - (y / z))
	elif y <= -1.85e+87:
		tmp = -z
	elif y <= -1.6e+73:
		tmp = -z * (x / y)
	elif (y <= -7e+39) or (not (y <= -1.55e-22) and (y <= 1.16e+173)):
		tmp = x + y
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.2e+129)
		tmp = Float64(-z);
	elseif (y <= -4.5e+122)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	elseif (y <= -1.85e+87)
		tmp = Float64(-z);
	elseif (y <= -1.6e+73)
		tmp = Float64(Float64(-z) * Float64(x / y));
	elseif ((y <= -7e+39) || (!(y <= -1.55e-22) && (y <= 1.16e+173)))
		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.2e+129)
		tmp = -z;
	elseif (y <= -4.5e+122)
		tmp = x / (1.0 - (y / z));
	elseif (y <= -1.85e+87)
		tmp = -z;
	elseif (y <= -1.6e+73)
		tmp = -z * (x / y);
	elseif ((y <= -7e+39) || (~((y <= -1.55e-22)) && (y <= 1.16e+173)))
		tmp = x + y;
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -5.2e+129], (-z), If[LessEqual[y, -4.5e+122], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.85e+87], (-z), If[LessEqual[y, -1.6e+73], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -7e+39], And[N[Not[LessEqual[y, -1.55e-22]], $MachinePrecision], LessEqual[y, 1.16e+173]]], N[(x + y), $MachinePrecision], (-z)]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -1.85 \cdot 10^{+87}:\\
\;\;\;\;-z\\

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

\mathbf{elif}\;y \leq -7 \cdot 10^{+39} \lor \neg \left(y \leq -1.55 \cdot 10^{-22}\right) \land y \leq 1.16 \cdot 10^{+173}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.20000000000000024e129 or -4.49999999999999997e122 < y < -1.85000000000000001e87 or -7.0000000000000003e39 < y < -1.55000000000000006e-22 or 1.16e173 < y

    1. Initial program 62.9%

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

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

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

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

    if -5.20000000000000024e129 < y < -4.49999999999999997e122

    1. Initial program 99.7%

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

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

    if -1.85000000000000001e87 < y < -1.59999999999999991e73

    1. Initial program 52.3%

      \[\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}{\frac{z}{\frac{y}{x + y}}} \]
      3. distribute-neg-frac100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999991e73 < y < -7.0000000000000003e39 or -1.55000000000000006e-22 < y < 1.16e173

    1. Initial program 97.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+129}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{+87}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{+73}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -7 \cdot 10^{+39} \lor \neg \left(y \leq -1.55 \cdot 10^{-22}\right) \land y \leq 1.16 \cdot 10^{+173}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-24} \lor \neg \left(y \leq 1.16 \cdot 10^{+173}\right):\\
\;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.10000000000000015e-24 or 1.16e173 < y

    1. Initial program 65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.10000000000000015e-24 < y < 1.16e173

    1. Initial program 97.5%

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

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

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

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

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

Alternative 6: 71.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-24} \lor \neg \left(y \leq 1.16 \cdot 10^{+173}\right):\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.50000000000000007e-24 or 1.16e173 < y

    1. Initial program 65.9%

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

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

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

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

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

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

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

    if -7.50000000000000007e-24 < y < 1.16e173

    1. Initial program 97.5%

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

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

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

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

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

Alternative 7: 62.6% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-21} \lor \neg \left(y \leq 1.16 \cdot 10^{+173}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.9e192 or -5.4999999999999997e39 < y < -1.1e-21 or 1.16e173 < y

    1. Initial program 65.7%

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

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

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

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

    if -1.9e192 < y < -5.4999999999999997e39

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{z \cdot \frac{x}{y}} \]
      4. distribute-lft-neg-in47.6%

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

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

    if -1.1e-21 < y < 1.16e173

    1. Initial program 97.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+192}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{+39}:\\ \;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-21} \lor \neg \left(y \leq 1.16 \cdot 10^{+173}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 56.5% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;y \leq 1.82 \cdot 10^{-9}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.16 \cdot 10^{+173}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.4999999999999994e-22 or 1.16e173 < y

    1. Initial program 65.9%

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

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

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

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

    if -9.4999999999999994e-22 < y < 1.8199999999999999e-9

    1. Initial program 99.9%

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

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

    if 1.8199999999999999e-9 < y < 1.16e173

    1. Initial program 88.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-22}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 1.82 \cdot 10^{-9}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.16 \cdot 10^{+173}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-21} \lor \neg \left(y \leq 1.16 \cdot 10^{+173}\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.1e-21 or 1.16e173 < y

    1. Initial program 65.9%

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

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

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

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

    if -1.1e-21 < y < 1.16e173

    1. Initial program 97.5%

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

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

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

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

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

Alternative 10: 38.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.38 \cdot 10^{+25}:\\
\;\;\;\;y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3800000000000001e25 or 4.9999999999999998e-8 < y

    1. Initial program 67.7%

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

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

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

    if -1.3800000000000001e25 < y < 4.9999999999999998e-8

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.38 \cdot 10^{+25}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-8}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 34.8% 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 84.2%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification34.8%

    \[\leadsto x \]
  5. Add Preprocessing

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 2024010 
(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))))