Statistics.Sample:$swelfordMean from math-functions-0.1.5.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.3s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \frac{y - x}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
	return x + ((y - x) / 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 - x) / z)
end function
public static double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
def code(x, y, z):
	return x + ((y - x) / z)
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) / z))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) / z);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y - x}{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 7 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y - x}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
	return x + ((y - x) / 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 - x) / z)
end function
public static double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
def code(x, y, z):
	return x + ((y - x) / z)
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) / z))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) / z);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y - x}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
	return x + ((y - x) / 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 - x) / z)
end function
public static double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
def code(x, y, z):
	return x + ((y - x) / z)
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) / z))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) / z);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y - x}{z}
\end{array}
Derivation
  1. Initial program 100.0%

    \[x + \frac{y - x}{z} \]
  2. Add Preprocessing
  3. Final simplification100.0%

    \[\leadsto x + \frac{y - x}{z} \]
  4. Add Preprocessing

Alternative 2: 60.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x}{z}\\ \mathbf{if}\;z \leq -4500000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-193}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-296}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-80}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (- x) z)))
   (if (<= z -4500000000000.0)
     x
     (if (<= z -9e-193)
       (/ y z)
       (if (<= z -7.8e-296)
         t_0
         (if (<= z 7.2e-80) (/ y z) (if (<= z 5.2e-24) t_0 x)))))))
double code(double x, double y, double z) {
	double t_0 = -x / z;
	double tmp;
	if (z <= -4500000000000.0) {
		tmp = x;
	} else if (z <= -9e-193) {
		tmp = y / z;
	} else if (z <= -7.8e-296) {
		tmp = t_0;
	} else if (z <= 7.2e-80) {
		tmp = y / z;
	} else if (z <= 5.2e-24) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = -x / z
    if (z <= (-4500000000000.0d0)) then
        tmp = x
    else if (z <= (-9d-193)) then
        tmp = y / z
    else if (z <= (-7.8d-296)) then
        tmp = t_0
    else if (z <= 7.2d-80) then
        tmp = y / z
    else if (z <= 5.2d-24) then
        tmp = t_0
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -x / z;
	double tmp;
	if (z <= -4500000000000.0) {
		tmp = x;
	} else if (z <= -9e-193) {
		tmp = y / z;
	} else if (z <= -7.8e-296) {
		tmp = t_0;
	} else if (z <= 7.2e-80) {
		tmp = y / z;
	} else if (z <= 5.2e-24) {
		tmp = t_0;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -x / z
	tmp = 0
	if z <= -4500000000000.0:
		tmp = x
	elif z <= -9e-193:
		tmp = y / z
	elif z <= -7.8e-296:
		tmp = t_0
	elif z <= 7.2e-80:
		tmp = y / z
	elif z <= 5.2e-24:
		tmp = t_0
	else:
		tmp = x
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(-x) / z)
	tmp = 0.0
	if (z <= -4500000000000.0)
		tmp = x;
	elseif (z <= -9e-193)
		tmp = Float64(y / z);
	elseif (z <= -7.8e-296)
		tmp = t_0;
	elseif (z <= 7.2e-80)
		tmp = Float64(y / z);
	elseif (z <= 5.2e-24)
		tmp = t_0;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -x / z;
	tmp = 0.0;
	if (z <= -4500000000000.0)
		tmp = x;
	elseif (z <= -9e-193)
		tmp = y / z;
	elseif (z <= -7.8e-296)
		tmp = t_0;
	elseif (z <= 7.2e-80)
		tmp = y / z;
	elseif (z <= 5.2e-24)
		tmp = t_0;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) / z), $MachinePrecision]}, If[LessEqual[z, -4500000000000.0], x, If[LessEqual[z, -9e-193], N[(y / z), $MachinePrecision], If[LessEqual[z, -7.8e-296], t$95$0, If[LessEqual[z, 7.2e-80], N[(y / z), $MachinePrecision], If[LessEqual[z, 5.2e-24], t$95$0, x]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x}{z}\\
\mathbf{if}\;z \leq -4500000000000:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq -9 \cdot 10^{-193}:\\
\;\;\;\;\frac{y}{z}\\

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-296}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-80}:\\
\;\;\;\;\frac{y}{z}\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.5e12 or 5.2e-24 < z

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 77.0%

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

    if -4.5e12 < z < -8.9999999999999997e-193 or -7.80000000000000021e-296 < z < 7.2e-80

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
      3. remove-double-neg97.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 65.0%

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

    if -8.9999999999999997e-193 < z < -7.80000000000000021e-296 or 7.2e-80 < z < 5.2e-24

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 100.0%

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

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

        \[\leadsto \color{blue}{-\frac{x}{z}} \]
      2. distribute-neg-frac76.2%

        \[\leadsto \color{blue}{\frac{-x}{z}} \]
    8. Simplified76.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4500000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-193}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-296}:\\ \;\;\;\;\frac{-x}{z}\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-80}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\ \;\;\;\;\frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-165} \lor \neg \left(y \leq -8 \cdot 10^{-278}\right):\\
\;\;\;\;x + \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e-165 or -7.9999999999999995e-278 < y

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub98.7%

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

        \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
      3. remove-double-neg98.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 82.0%

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

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

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

      \[\leadsto x - \color{blue}{\frac{-y}{z}} \]
    8. Step-by-step derivation
      1. div-inv81.9%

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

        \[\leadsto \color{blue}{x + y \cdot \frac{1}{z}} \]
      3. div-inv82.0%

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

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

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

    if -1.15e-165 < y < -7.9999999999999995e-278

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 69.9%

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

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

        \[\leadsto \color{blue}{-\frac{x}{z}} \]
      2. distribute-neg-frac67.5%

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

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

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

Alternative 4: 84.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-103} \lor \neg \left(y \leq 1.8 \cdot 10^{-194}\right):\\
\;\;\;\;x + \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.6999999999999999e-103 or 1.8e-194 < y

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub98.4%

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

        \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
      3. remove-double-neg98.4%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 87.0%

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

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

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

      \[\leadsto x - \color{blue}{\frac{-y}{z}} \]
    8. Step-by-step derivation
      1. div-inv86.9%

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

        \[\leadsto \color{blue}{x + y \cdot \frac{1}{z}} \]
      3. div-inv87.0%

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

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

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

    if -3.6999999999999999e-103 < y < 1.8e-194

    1. Initial program 99.9%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

        \[\leadsto x - \color{blue}{\left(\frac{x}{z} - \frac{y}{z}\right)} \]
      10. div-sub99.9%

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 91.9%

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

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

Alternative 5: 98.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 98.7%

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

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

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

      \[\leadsto x - \color{blue}{\frac{-y}{z}} \]
    8. Step-by-step derivation
      1. div-inv98.6%

        \[\leadsto x - \color{blue}{\left(-y\right) \cdot \frac{1}{z}} \]
      2. cancel-sign-sub98.6%

        \[\leadsto \color{blue}{x + y \cdot \frac{1}{z}} \]
      3. div-inv98.7%

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

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

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

    if -2.10000000000000009 < z < 5.2e-24

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
      3. remove-double-neg97.8%

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

        \[\leadsto \left(x + \left(-\color{blue}{\frac{-y}{z}}\right)\right) - \frac{x}{z} \]
      5. unsub-neg97.8%

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg97.8%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 100.0%

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

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

Alternative 6: 61.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -66000000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 55000000000000:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -66000000000000.0) x (if (<= z 55000000000000.0) (/ y z) x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -66000000000000.0) {
		tmp = x;
	} else if (z <= 55000000000000.0) {
		tmp = y / 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 (z <= (-66000000000000.0d0)) then
        tmp = x
    else if (z <= 55000000000000.0d0) then
        tmp = y / z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -66000000000000.0) {
		tmp = x;
	} else if (z <= 55000000000000.0) {
		tmp = y / z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -66000000000000.0:
		tmp = x
	elif z <= 55000000000000.0:
		tmp = y / z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -66000000000000.0)
		tmp = x;
	elseif (z <= 55000000000000.0)
		tmp = Float64(y / z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -66000000000000.0)
		tmp = x;
	elseif (z <= 55000000000000.0)
		tmp = y / z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -66000000000000.0], x, If[LessEqual[z, 55000000000000.0], N[(y / z), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -66000000000000:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 55000000000000:\\
\;\;\;\;\frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.6e13 or 5.5e13 < z

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

        \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      9. sub-neg100.0%

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 78.3%

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

    if -6.6e13 < z < 5.5e13

    1. Initial program 100.0%

      \[x + \frac{y - x}{z} \]
    2. Step-by-step derivation
      1. div-sub97.9%

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

        \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
      3. remove-double-neg97.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 58.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -66000000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 55000000000000:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 37.0% accurate, 7.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 100.0%

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

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

      \[\leadsto \color{blue}{\left(x + \frac{y}{z}\right) - \frac{x}{z}} \]
    3. remove-double-neg98.8%

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

      \[\leadsto \left(x + \left(-\color{blue}{\frac{-y}{z}}\right)\right) - \frac{x}{z} \]
    5. unsub-neg98.8%

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

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

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

      \[\leadsto x - \left(\frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
    9. sub-neg98.8%

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

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

    \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
  4. Add Preprocessing
  5. Taylor expanded in z around inf 37.2%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification37.2%

    \[\leadsto x \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024029 
(FPCore (x y z)
  :name "Statistics.Sample:$swelfordMean from math-functions-0.1.5.2"
  :precision binary64
  (+ x (/ (- y x) z)))