fabs fraction 1

Percentage Accurate: 91.7% → 99.8%
Time: 11.5s
Alternatives: 16
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \end{array} \]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
	return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
	return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z):
	return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z)
	return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
function tmp = code(x, y, z)
	tmp = abs((((x + 4.0) / y) - ((x / y) * z)));
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\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 16 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: 91.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \end{array} \]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
	return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
	return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z):
	return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z)
	return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
function tmp = code(x, y, z)
	tmp = abs((((x + 4.0) / y) - ((x / y) * z)));
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}

Alternative 1: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 5 \cdot 10^{-36}:\\ \;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= y_m 5e-36)
   (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x))))
   (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (y_m <= 5e-36) {
		tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
	} else {
		tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
	}
	return tmp;
}
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (y_m <= 5e-36)
		tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x))));
	else
		tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z))));
	end
	return tmp
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 5e-36], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 5.00000000000000004e-36

    1. Initial program 87.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Simplified96.7%

      \[\leadsto \color{blue}{\left|\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|} \]
    3. Add Preprocessing

    if 5.00000000000000004e-36 < y

    1. Initial program 95.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/90.7%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right| \]
      2. associate-*r/99.7%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}}\right| \]
      3. clear-num99.7%

        \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}}\right| \]
      4. un-div-inv99.7%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    4. Applied egg-rr99.7%

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.0% accurate, 0.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \frac{x + 4}{y\_m}\\ t_1 := \left|t\_0 - z \cdot \frac{x}{y\_m}\right|\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{-84}:\\ \;\;\;\;\left|t\_0 - \frac{x}{\frac{y\_m}{z}}\right|\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (let* ((t_0 (/ (+ x 4.0) y_m)) (t_1 (fabs (- t_0 (* z (/ x y_m))))))
   (if (<= t_1 2e-84)
     (fabs (- t_0 (/ x (/ y_m z))))
     (if (<= t_1 INFINITY) t_1 (/ x y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = (x + 4.0) / y_m;
	double t_1 = fabs((t_0 - (z * (x / y_m))));
	double tmp;
	if (t_1 <= 2e-84) {
		tmp = fabs((t_0 - (x / (y_m / z))));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double t_0 = (x + 4.0) / y_m;
	double t_1 = Math.abs((t_0 - (z * (x / y_m))));
	double tmp;
	if (t_1 <= 2e-84) {
		tmp = Math.abs((t_0 - (x / (y_m / z))));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	t_0 = (x + 4.0) / y_m
	t_1 = math.fabs((t_0 - (z * (x / y_m))))
	tmp = 0
	if t_1 <= 2e-84:
		tmp = math.fabs((t_0 - (x / (y_m / z))))
	elif t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	t_0 = Float64(Float64(x + 4.0) / y_m)
	t_1 = abs(Float64(t_0 - Float64(z * Float64(x / y_m))))
	tmp = 0.0
	if (t_1 <= 2e-84)
		tmp = abs(Float64(t_0 - Float64(x / Float64(y_m / z))));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	t_0 = (x + 4.0) / y_m;
	t_1 = abs((t_0 - (z * (x / y_m))));
	tmp = 0.0;
	if (t_1 <= 2e-84)
		tmp = abs((t_0 - (x / (y_m / z))));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 2e-84], N[Abs[N[(t$95$0 - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(x / y$95$m), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
t_1 := \left|t\_0 - z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-84}:\\
\;\;\;\;\left|t\_0 - \frac{x}{\frac{y\_m}{z}}\right|\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 2.0000000000000001e-84

    1. Initial program 87.3%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/99.8%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}}\right| \]
      3. clear-num99.8%

        \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}}\right| \]
      4. un-div-inv99.8%

        \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}}\right| \]

    if 2.0000000000000001e-84 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < +inf.0

    1. Initial program 99.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing

    if +inf.0 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)))

    1. Initial program 0.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub0.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/26.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def57.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified57.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine26.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/26.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/0.0%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv0.0%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv0.0%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub0.0%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt0.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr0.0%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg0.0%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative21.1%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval21.1%

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

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 21.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right| \leq 2 \cdot 10^{-84}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right| \leq \infty:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.2% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \left|\frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\right|\\ \mathbf{if}\;t\_0 \leq \infty:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (let* ((t_0 (fabs (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))))
   (if (<= t_0 INFINITY) t_0 (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = fabs((((x + 4.0) / y_m) - (z * (x / y_m))));
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double t_0 = Math.abs((((x + 4.0) / y_m) - (z * (x / y_m))));
	double tmp;
	if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	t_0 = math.fabs((((x + 4.0) / y_m) - (z * (x / y_m))))
	tmp = 0
	if t_0 <= math.inf:
		tmp = t_0
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	t_0 = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m))))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = t_0;
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	t_0 = abs((((x + 4.0) / y_m) - (z * (x / y_m))));
	tmp = 0.0;
	if (t_0 <= Inf)
		tmp = t_0;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(x / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < +inf.0

    1. Initial program 97.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing

    if +inf.0 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)))

    1. Initial program 0.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub0.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/26.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def57.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval57.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified57.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine26.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/26.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/0.0%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv0.0%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv0.0%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub0.0%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt0.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr0.0%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg0.0%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative21.1%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval21.1%

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

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 21.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right| \leq \infty:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 76.1% accurate, 4.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4 - x \cdot z}{y\_m}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+251}:\\ \;\;\;\;x \cdot \frac{-1 + z}{-y\_m}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.45e-41)
   (/ x (/ y_m (+ -1.0 z)))
   (if (<= x 4.0)
     (/ (- 4.0 (* x z)) y_m)
     (if (<= x 5.8e+251) (* x (/ (+ -1.0 z) (- y_m))) (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 4.0) {
		tmp = (4.0 - (x * z)) / y_m;
	} else if (x <= 5.8e+251) {
		tmp = x * ((-1.0 + z) / -y_m);
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.45d-41)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else if (x <= 4.0d0) then
        tmp = (4.0d0 - (x * z)) / y_m
    else if (x <= 5.8d+251) then
        tmp = x * (((-1.0d0) + z) / -y_m)
    else
        tmp = z * (x / y_m)
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 4.0) {
		tmp = (4.0 - (x * z)) / y_m;
	} else if (x <= 5.8e+251) {
		tmp = x * ((-1.0 + z) / -y_m);
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.45e-41:
		tmp = x / (y_m / (-1.0 + z))
	elif x <= 4.0:
		tmp = (4.0 - (x * z)) / y_m
	elif x <= 5.8e+251:
		tmp = x * ((-1.0 + z) / -y_m)
	else:
		tmp = z * (x / y_m)
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.45e-41)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	elseif (x <= 4.0)
		tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m);
	elseif (x <= 5.8e+251)
		tmp = Float64(x * Float64(Float64(-1.0 + z) / Float64(-y_m)));
	else
		tmp = Float64(z * Float64(x / y_m));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.45e-41)
		tmp = x / (y_m / (-1.0 + z));
	elseif (x <= 4.0)
		tmp = (4.0 - (x * z)) / y_m;
	elseif (x <= 5.8e+251)
		tmp = x * ((-1.0 + z) / -y_m);
	else
		tmp = z * (x / y_m);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-41], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 5.8e+251], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / (-y$95$m)), $MachinePrecision]), $MachinePrecision], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\

\mathbf{elif}\;x \leq 5.8 \cdot 10^{+251}:\\
\;\;\;\;x \cdot \frac{-1 + z}{-y\_m}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.44999999999999989e-41

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -1.44999999999999989e-41 < x < 4

    1. Initial program 94.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def89.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt48.4%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt49.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/52.6%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div52.6%

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

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

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

    if 4 < x < 5.7999999999999999e251

    1. Initial program 88.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub88.2%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/92.1%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine92.1%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/88.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/88.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv88.0%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv88.0%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub88.2%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt42.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr42.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt43.7%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg43.7%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 46.9%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in41.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub45.2%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg45.2%

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

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in45.2%

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

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

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub46.9%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub046.9%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative46.9%

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in46.9%

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

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

    if 5.7999999999999999e251 < x

    1. Initial program 66.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub66.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def91.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative91.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified91.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/51.0%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/66.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv66.7%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv66.7%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub66.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt25.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr25.0%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt25.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg25.2%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.2%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in25.2%

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity17.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub42.1%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg42.1%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative42.1%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in42.1%

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

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg42.1%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.2%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.2%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in50.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt0.0%

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{\frac{y}{z + -1}} \]
      7. sqrt-unprod49.9%

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z + -1}}} \]
    12. Taylor expanded in z around inf 25.9%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative41.9%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    14. Simplified41.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4 - x \cdot z}{y}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+251}:\\ \;\;\;\;x \cdot \frac{-1 + z}{-y}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 75.3% accurate, 5.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4 - x \cdot z}{y\_m}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\ \;\;\;\;\frac{x - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.45e-41)
   (/ x (/ y_m (+ -1.0 z)))
   (if (<= x 4.0)
     (/ (- 4.0 (* x z)) y_m)
     (if (<= x 3.3e+251) (/ (- x (* x z)) y_m) (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 4.0) {
		tmp = (4.0 - (x * z)) / y_m;
	} else if (x <= 3.3e+251) {
		tmp = (x - (x * z)) / y_m;
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.45d-41)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else if (x <= 4.0d0) then
        tmp = (4.0d0 - (x * z)) / y_m
    else if (x <= 3.3d+251) then
        tmp = (x - (x * z)) / y_m
    else
        tmp = z * (x / y_m)
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 4.0) {
		tmp = (4.0 - (x * z)) / y_m;
	} else if (x <= 3.3e+251) {
		tmp = (x - (x * z)) / y_m;
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.45e-41:
		tmp = x / (y_m / (-1.0 + z))
	elif x <= 4.0:
		tmp = (4.0 - (x * z)) / y_m
	elif x <= 3.3e+251:
		tmp = (x - (x * z)) / y_m
	else:
		tmp = z * (x / y_m)
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.45e-41)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	elseif (x <= 4.0)
		tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m);
	elseif (x <= 3.3e+251)
		tmp = Float64(Float64(x - Float64(x * z)) / y_m);
	else
		tmp = Float64(z * Float64(x / y_m));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.45e-41)
		tmp = x / (y_m / (-1.0 + z));
	elseif (x <= 4.0)
		tmp = (4.0 - (x * z)) / y_m;
	elseif (x <= 3.3e+251)
		tmp = (x - (x * z)) / y_m;
	else
		tmp = z * (x / y_m);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-41], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 3.3e+251], N[(N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\
\;\;\;\;\frac{x - x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.44999999999999989e-41

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -1.44999999999999989e-41 < x < 4

    1. Initial program 94.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def89.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt48.4%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt49.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/52.6%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div52.6%

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

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

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

    if 4 < x < 3.30000000000000018e251

    1. Initial program 88.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub88.2%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/92.1%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine92.1%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/88.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/88.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv88.0%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv88.0%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub88.2%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt42.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr42.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt43.7%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/41.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div47.7%

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

      \[\leadsto \color{blue}{\frac{\left(x + 4\right) - x \cdot z}{y}} \]
    7. Taylor expanded in x around inf 45.2%

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

    if 3.30000000000000018e251 < x

    1. Initial program 66.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub66.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def91.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative91.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified91.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/51.0%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/66.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv66.7%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv66.7%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub66.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt25.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr25.0%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt25.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg25.2%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.2%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in25.2%

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity17.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub42.1%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg42.1%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative42.1%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in42.1%

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

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg42.1%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.2%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.2%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in50.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt0.0%

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{\frac{y}{z + -1}} \]
      7. sqrt-unprod49.9%

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z + -1}}} \]
    12. Taylor expanded in z around inf 25.9%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative41.9%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    14. Simplified41.9%

      \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification49.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4 - x \cdot z}{y}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\ \;\;\;\;\frac{x - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 76.9% accurate, 5.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+202}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y\_m} + z \cdot \frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.45e-41)
   (/ x (/ y_m (+ -1.0 z)))
   (if (<= x 2.4e+202)
     (/ (- (+ x 4.0) (* x z)) y_m)
     (+ (/ (+ x 4.0) y_m) (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 2.4e+202) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = ((x + 4.0) / y_m) + (z * (x / y_m));
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.45d-41)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else if (x <= 2.4d+202) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else
        tmp = ((x + 4.0d0) / y_m) + (z * (x / y_m))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 2.4e+202) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = ((x + 4.0) / y_m) + (z * (x / y_m));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.45e-41:
		tmp = x / (y_m / (-1.0 + z))
	elif x <= 2.4e+202:
		tmp = ((x + 4.0) - (x * z)) / y_m
	else:
		tmp = ((x + 4.0) / y_m) + (z * (x / y_m))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.45e-41)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	elseif (x <= 2.4e+202)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	else
		tmp = Float64(Float64(Float64(x + 4.0) / y_m) + Float64(z * Float64(x / y_m)));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.45e-41)
		tmp = x / (y_m / (-1.0 + z));
	elseif (x <= 2.4e+202)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	else
		tmp = ((x + 4.0) / y_m) + (z * (x / y_m));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-41], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e+202], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] + N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{+202}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m} + z \cdot \frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.44999999999999989e-41

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -1.44999999999999989e-41 < x < 2.4000000000000002e202

    1. Initial program 93.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub93.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.9%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.9%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/98.0%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/93.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv93.6%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv93.6%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub93.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt49.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr49.0%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt50.3%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/51.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div53.0%

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

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

    if 2.4000000000000002e202 < x

    1. Initial program 72.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub72.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/77.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine77.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/60.0%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/72.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv72.7%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv72.7%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub72.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt18.2%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr18.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + 4}{y} + \frac{x}{y} \cdot \color{blue}{z} \]
      6. *-un-lft-identity32.1%

        \[\leadsto \frac{x + 4}{y} + \frac{x}{y} \cdot \color{blue}{\left(1 \cdot z\right)} \]
    8. Applied egg-rr32.1%

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

        \[\leadsto \frac{x + 4}{y} + \frac{x}{y} \cdot \color{blue}{z} \]
    10. Simplified32.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+202}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y} + z \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.8% accurate, 5.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.45e-41)
   (/ x (/ y_m (+ -1.0 z)))
   (if (<= x 3.3e+251) (/ (- (+ x 4.0) (* x z)) y_m) (* z (/ x y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 3.3e+251) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.45d-41)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else if (x <= 3.3d+251) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else
        tmp = z * (x / y_m)
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 3.3e+251) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = z * (x / y_m);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.45e-41:
		tmp = x / (y_m / (-1.0 + z))
	elif x <= 3.3e+251:
		tmp = ((x + 4.0) - (x * z)) / y_m
	else:
		tmp = z * (x / y_m)
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.45e-41)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	elseif (x <= 3.3e+251)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	else
		tmp = Float64(z * Float64(x / y_m));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.45e-41)
		tmp = x / (y_m / (-1.0 + z));
	elseif (x <= 3.3e+251)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	else
		tmp = z * (x / y_m);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-41], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e+251], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.44999999999999989e-41

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -1.44999999999999989e-41 < x < 3.30000000000000018e251

    1. Initial program 92.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub92.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/96.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/92.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv92.8%

        \[\leadsto \left|\frac{x}{y} \cdot z + \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}}\right| \]
      5. sub-neg92.8%

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv92.8%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub92.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.7%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.7%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/49.3%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div51.1%

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

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

    if 3.30000000000000018e251 < x

    1. Initial program 66.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub66.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def91.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative91.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval91.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified91.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine75.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/51.0%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/66.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv66.7%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv66.7%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub66.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt25.0%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr25.0%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt25.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg25.2%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.2%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in25.2%

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity17.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub42.1%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg42.1%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative42.1%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in42.1%

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

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg42.1%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.2%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.2%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in50.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt0.0%

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{\frac{y}{z + -1}} \]
      7. sqrt-unprod49.9%

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z + -1}}} \]
    12. Taylor expanded in z around inf 25.9%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative41.9%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    14. Simplified41.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+251}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 67.3% accurate, 6.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -9.8 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y\_m}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -9.8e-14)
   (/ x (- y_m))
   (if (<= x -1.45e-41)
     (/ (* x z) y_m)
     (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -9.8e-14) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-9.8d-14)) then
        tmp = x / -y_m
    else if (x <= (-1.45d-41)) then
        tmp = (x * z) / y_m
    else if (x <= 4.0d0) then
        tmp = 4.0d0 / y_m
    else
        tmp = x / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -9.8e-14) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -9.8e-14:
		tmp = x / -y_m
	elif x <= -1.45e-41:
		tmp = (x * z) / y_m
	elif x <= 4.0:
		tmp = 4.0 / y_m
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -9.8e-14)
		tmp = Float64(x / Float64(-y_m));
	elseif (x <= -1.45e-41)
		tmp = Float64(Float64(x * z) / y_m);
	elseif (x <= 4.0)
		tmp = Float64(4.0 / y_m);
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -9.8e-14)
		tmp = x / -y_m;
	elseif (x <= -1.45e-41)
		tmp = (x * z) / y_m;
	elseif (x <= 4.0)
		tmp = 4.0 / y_m;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -9.8e-14], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, -1.45e-41], N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{-y\_m}\\

\mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x \cdot z}{y\_m}\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -9.79999999999999989e-14

    1. Initial program 87.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub87.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/79.1%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/87.0%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub87.0%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt47.3%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg47.3%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 51.0%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in46.8%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{z}{y}\right)} + x \cdot \frac{1}{y} \]
      3. distribute-rgt-neg-in46.8%

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity44.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub48.3%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg48.3%

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

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in48.3%

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

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

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub51.0%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub051.0%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in51.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt50.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr48.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{y} \]
    14. Simplified31.2%

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

    if -9.79999999999999989e-14 < x < -1.44999999999999989e-41

    1. Initial program 80.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub80.8%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/99.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def99.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative99.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt60.0%

        \[\leadsto \left|\color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}}\right| \]
      2. fabs-sqr60.0%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}} \]
      3. add-sqr-sqrt59.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      4. fma-undefine59.8%

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      5. associate-*r/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y} \]
      6. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      7. div-inv40.8%

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y} \]
      12. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}} \]
      13. div-inv40.8%

        \[\leadsto \frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}} \]
      14. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y} \]
      15. sub-div60.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot z - \left(x + 4\right)}{y}} \]
    7. Taylor expanded in z around inf 60.1%

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

    if -1.44999999999999989e-41 < x < 4

    1. Initial program 94.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def89.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt48.4%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt49.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg49.8%

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

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

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

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

    if 4 < x

    1. Initial program 84.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub84.1%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def93.6%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/81.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/84.1%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv83.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv83.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv84.1%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub84.1%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt39.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr39.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg40.2%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative26.8%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval26.8%

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{4}}{y} \]
    9. Simplified26.8%

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 24.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.8 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{-y}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 67.3% accurate, 6.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;x \cdot \frac{z}{y\_m}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.5e-13)
   (/ x (- y_m))
   (if (<= x -1.45e-41)
     (* x (/ z y_m))
     (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = x * (z / y_m);
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.5d-13)) then
        tmp = x / -y_m
    else if (x <= (-1.45d-41)) then
        tmp = x * (z / y_m)
    else if (x <= 4.0d0) then
        tmp = 4.0d0 / y_m
    else
        tmp = x / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = x * (z / y_m);
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.5e-13:
		tmp = x / -y_m
	elif x <= -1.45e-41:
		tmp = x * (z / y_m)
	elif x <= 4.0:
		tmp = 4.0 / y_m
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.5e-13)
		tmp = Float64(x / Float64(-y_m));
	elseif (x <= -1.45e-41)
		tmp = Float64(x * Float64(z / y_m));
	elseif (x <= 4.0)
		tmp = Float64(4.0 / y_m);
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.5e-13)
		tmp = x / -y_m;
	elseif (x <= -1.45e-41)
		tmp = x * (z / y_m);
	elseif (x <= 4.0)
		tmp = 4.0 / y_m;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.5e-13], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, -1.45e-41], N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{-y\_m}\\

\mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;x \cdot \frac{z}{y\_m}\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.49999999999999992e-13

    1. Initial program 87.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub87.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/79.1%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/87.0%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub87.0%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt47.3%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg47.3%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 51.0%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in46.8%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{z}{y}\right)} + x \cdot \frac{1}{y} \]
      3. distribute-rgt-neg-in46.8%

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity44.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub48.3%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg48.3%

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

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in48.3%

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

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

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub51.0%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub051.0%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in51.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt50.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr48.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{y} \]
    14. Simplified31.2%

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

    if -1.49999999999999992e-13 < x < -1.44999999999999989e-41

    1. Initial program 80.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub80.8%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/99.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def99.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative99.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt60.0%

        \[\leadsto \left|\color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}}\right| \]
      2. fabs-sqr60.0%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}} \]
      3. add-sqr-sqrt59.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      4. fma-undefine59.8%

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      5. associate-*r/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y} \]
      6. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      7. div-inv40.8%

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y} \]
      12. cancel-sign-sub-inv40.8%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y}} - \left(x + 4\right) \cdot \frac{1}{y} \]
      15. div-inv59.8%

        \[\leadsto x \cdot \frac{z}{y} - \color{blue}{\frac{x + 4}{y}} \]
    6. Applied egg-rr59.8%

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y} \]
      2. div-sub60.1%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x \cdot z - \left(x + 4\right)}}} \]
    8. Applied egg-rr60.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x \cdot z - \left(x + 4\right)}}} \]
    9. Taylor expanded in z around inf 60.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y}} \]
    11. Simplified59.8%

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

    if -1.44999999999999989e-41 < x < 4

    1. Initial program 94.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def89.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt48.4%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt49.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg49.8%

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

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

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

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

    if 4 < x

    1. Initial program 84.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub84.1%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def93.6%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/81.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/84.1%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv83.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv83.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv84.1%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub84.1%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt39.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr39.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg40.2%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative26.8%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval26.8%

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{4}}{y} \]
    9. Simplified26.8%

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 24.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{-y}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 76.0% accurate, 6.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{elif}\;x \leq 0.088:\\ \;\;\;\;\frac{4 - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.45e-41)
   (/ x (/ y_m (+ -1.0 z)))
   (if (<= x 0.088) (/ (- 4.0 (* x z)) y_m) (/ (+ x 4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 0.088) {
		tmp = (4.0 - (x * z)) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.45d-41)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else if (x <= 0.088d0) then
        tmp = (4.0d0 - (x * z)) / y_m
    else
        tmp = (x + 4.0d0) / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.45e-41) {
		tmp = x / (y_m / (-1.0 + z));
	} else if (x <= 0.088) {
		tmp = (4.0 - (x * z)) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.45e-41:
		tmp = x / (y_m / (-1.0 + z))
	elif x <= 0.088:
		tmp = (4.0 - (x * z)) / y_m
	else:
		tmp = (x + 4.0) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.45e-41)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	elseif (x <= 0.088)
		tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m);
	else
		tmp = Float64(Float64(x + 4.0) / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.45e-41)
		tmp = x / (y_m / (-1.0 + z));
	elseif (x <= 0.088)
		tmp = (4.0 - (x * z)) / y_m;
	else
		tmp = (x + 4.0) / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-41], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.088], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{elif}\;x \leq 0.088:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.44999999999999989e-41

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -1.44999999999999989e-41 < x < 0.087999999999999995

    1. Initial program 94.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.9%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def89.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval89.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.9%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt48.4%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt49.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. associate-*l/52.6%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      16. sub-div52.6%

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

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

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

    if 0.087999999999999995 < x

    1. Initial program 84.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub84.1%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def93.6%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/81.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/84.1%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv83.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv83.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv84.1%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub84.1%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt39.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr39.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg40.2%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-rgt-identity26.8%

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

        \[\leadsto 4 \cdot \frac{1}{y} + \color{blue}{x \cdot \frac{1}{y}} \]
      3. distribute-rgt-in26.7%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x + 4\right)}{y}} \]
      6. *-lft-identity26.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{elif}\;x \leq 0.088:\\ \;\;\;\;\frac{4 - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 68.0% accurate, 7.4× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{-4 - x}{y\_m}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.5e-13)
   (/ (- -4.0 x) y_m)
   (if (<= x -1.45e-41) (/ (* x z) y_m) (/ (+ x 4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = (-4.0 - x) / y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.5d-13)) then
        tmp = ((-4.0d0) - x) / y_m
    else if (x <= (-1.45d-41)) then
        tmp = (x * z) / y_m
    else
        tmp = (x + 4.0d0) / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = (-4.0 - x) / y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.5e-13:
		tmp = (-4.0 - x) / y_m
	elif x <= -1.45e-41:
		tmp = (x * z) / y_m
	else:
		tmp = (x + 4.0) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.5e-13)
		tmp = Float64(Float64(-4.0 - x) / y_m);
	elseif (x <= -1.45e-41)
		tmp = Float64(Float64(x * z) / y_m);
	else
		tmp = Float64(Float64(x + 4.0) / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.5e-13)
		tmp = (-4.0 - x) / y_m;
	elseif (x <= -1.45e-41)
		tmp = (x * z) / y_m;
	else
		tmp = (x + 4.0) / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.5e-13], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, -1.45e-41], N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\

\mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999992e-13

    1. Initial program 87.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub87.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt45.4%

        \[\leadsto \left|\color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}}\right| \]
      2. fabs-sqr45.4%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}} \]
      3. add-sqr-sqrt46.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      4. fma-undefine43.2%

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      5. associate-*r/35.2%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y} \]
      6. associate-*l/40.3%

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

        \[\leadsto \frac{x}{y} \cdot z + \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
      8. sub-neg40.3%

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y} \]
      12. cancel-sign-sub-inv40.3%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}} \]
      13. div-inv40.3%

        \[\leadsto \frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}} \]
      14. associate-*l/35.2%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y} \]
      15. sub-div40.9%

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(4 + x\right)}}{y} \]
    8. Step-by-step derivation
      1. distribute-lft-in31.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y} \]
      2. metadata-eval31.3%

        \[\leadsto \frac{\color{blue}{-4} + -1 \cdot x}{y} \]
      3. mul-1-neg31.3%

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

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

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

    if -1.49999999999999992e-13 < x < -1.44999999999999989e-41

    1. Initial program 80.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub80.8%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/99.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def99.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative99.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt60.0%

        \[\leadsto \left|\color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}}\right| \]
      2. fabs-sqr60.0%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}} \]
      3. add-sqr-sqrt59.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      4. fma-undefine59.8%

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      5. associate-*r/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y} \]
      6. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      7. div-inv40.8%

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y} \]
      12. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}} \]
      13. div-inv40.8%

        \[\leadsto \frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}} \]
      14. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y} \]
      15. sub-div60.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot z - \left(x + 4\right)}{y}} \]
    7. Taylor expanded in z around inf 60.1%

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

    if -1.44999999999999989e-41 < x

    1. Initial program 91.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub91.2%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/93.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/91.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv91.1%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv91.1%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub91.2%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt45.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr45.3%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.4%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.4%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-rgt-identity33.0%

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

        \[\leadsto 4 \cdot \frac{1}{y} + \color{blue}{x \cdot \frac{1}{y}} \]
      3. distribute-rgt-in33.0%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x + 4\right)}{y}} \]
      6. *-lft-identity33.0%

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

        \[\leadsto \frac{\color{blue}{4 + x}}{y} \]
    9. Simplified33.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{-4 - x}{y}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 67.7% accurate, 7.4× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.5e-13)
   (/ x (- y_m))
   (if (<= x -1.45e-41) (/ (* x z) y_m) (/ (+ x 4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.5d-13)) then
        tmp = x / -y_m
    else if (x <= (-1.45d-41)) then
        tmp = (x * z) / y_m
    else
        tmp = (x + 4.0d0) / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x / -y_m;
	} else if (x <= -1.45e-41) {
		tmp = (x * z) / y_m;
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.5e-13:
		tmp = x / -y_m
	elif x <= -1.45e-41:
		tmp = (x * z) / y_m
	else:
		tmp = (x + 4.0) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.5e-13)
		tmp = Float64(x / Float64(-y_m));
	elseif (x <= -1.45e-41)
		tmp = Float64(Float64(x * z) / y_m);
	else
		tmp = Float64(Float64(x + 4.0) / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.5e-13)
		tmp = x / -y_m;
	elseif (x <= -1.45e-41)
		tmp = (x * z) / y_m;
	else
		tmp = (x + 4.0) / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.5e-13], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, -1.45e-41], N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{-y\_m}\\

\mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\
\;\;\;\;\frac{x \cdot z}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999992e-13

    1. Initial program 87.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub87.0%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.1%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.1%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.1%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/79.1%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/87.0%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.9%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub87.0%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt47.3%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg47.3%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 51.0%

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{z}{y} + \frac{1}{y}\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in46.8%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{z}{y}\right)} + x \cdot \frac{1}{y} \]
      3. distribute-rgt-neg-in46.8%

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity44.1%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub48.3%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg48.3%

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

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in48.3%

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

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

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub51.0%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub051.0%

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

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in51.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt50.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr48.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{y} \]
    14. Simplified31.2%

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

    if -1.49999999999999992e-13 < x < -1.44999999999999989e-41

    1. Initial program 80.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub80.8%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/99.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def99.7%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative99.7%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval99.7%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt60.0%

        \[\leadsto \left|\color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}}\right| \]
      2. fabs-sqr60.0%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}} \]
      3. add-sqr-sqrt59.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      4. fma-undefine59.8%

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      5. associate-*r/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y} \]
      6. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      7. div-inv40.8%

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y} \]
      12. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}} \]
      13. div-inv40.8%

        \[\leadsto \frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}} \]
      14. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y} \]
      15. sub-div60.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot z - \left(x + 4\right)}{y}} \]
    7. Taylor expanded in z around inf 60.1%

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

    if -1.44999999999999989e-41 < x

    1. Initial program 91.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub91.2%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/93.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/91.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv91.1%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv91.1%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub91.2%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt45.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr45.3%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.4%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.4%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-rgt-identity33.0%

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

        \[\leadsto 4 \cdot \frac{1}{y} + \color{blue}{x \cdot \frac{1}{y}} \]
      3. distribute-rgt-in33.0%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x + 4\right)}{y}} \]
      6. *-lft-identity33.0%

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

        \[\leadsto \frac{\color{blue}{4 + x}}{y} \]
    9. Simplified33.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{-y}\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-41}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 68.2% accurate, 8.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;\frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\frac{4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -10.5) (/ x (- y_m)) (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -10.5) {
		tmp = x / -y_m;
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-10.5d0)) then
        tmp = x / -y_m
    else if (x <= 4.0d0) then
        tmp = 4.0d0 / y_m
    else
        tmp = x / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -10.5) {
		tmp = x / -y_m;
	} else if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -10.5:
		tmp = x / -y_m
	elif x <= 4.0:
		tmp = 4.0 / y_m
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -10.5)
		tmp = Float64(x / Float64(-y_m));
	elseif (x <= 4.0)
		tmp = Float64(4.0 / y_m);
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -10.5)
		tmp = x / -y_m;
	elseif (x <= 4.0)
		tmp = 4.0 / y_m;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -10.5], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;\frac{x}{-y\_m}\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -10.5

    1. Initial program 86.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.8%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.0%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.0%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.7%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/78.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.8%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.7%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv86.8%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.8%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt47.6%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr47.6%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg48.0%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 51.8%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity44.7%

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

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg49.0%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative49.0%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in49.0%

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

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg49.0%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub51.8%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub051.8%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative51.8%

        \[\leadsto -\color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right) \cdot x} \]
      20. distribute-rgt-neg-in51.8%

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

      \[\leadsto \color{blue}{\frac{z + -1}{y} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative51.8%

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv51.8%

        \[\leadsto \color{blue}{\frac{-x}{\frac{y}{z + -1}}} \]
      4. add-sqr-sqrt51.5%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{y} \]
    14. Simplified31.7%

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

    if -10.5 < x < 4

    1. Initial program 94.4%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub94.4%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.0%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.0%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.0%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.0%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/99.8%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/94.4%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv94.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv94.4%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv94.4%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub94.4%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt47.7%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr47.7%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg49.1%

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

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

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

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

    if 4 < x

    1. Initial program 84.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub84.1%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def93.6%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/81.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/84.1%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv83.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv83.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv84.1%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub84.1%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt39.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr39.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg40.2%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative26.8%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval26.8%

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{4}}{y} \]
    9. Simplified26.8%

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 24.9%

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

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

Alternative 14: 70.5% accurate, 9.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{-53}:\\ \;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -4.1e-53) (/ x (/ y_m (+ -1.0 z))) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.1e-53) {
		tmp = x / (y_m / (-1.0 + z));
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-4.1d-53)) then
        tmp = x / (y_m / ((-1.0d0) + z))
    else
        tmp = (x + 4.0d0) / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.1e-53) {
		tmp = x / (y_m / (-1.0 + z));
	} else {
		tmp = (x + 4.0) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -4.1e-53:
		tmp = x / (y_m / (-1.0 + z))
	else:
		tmp = (x + 4.0) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -4.1e-53)
		tmp = Float64(x / Float64(y_m / Float64(-1.0 + z)));
	else
		tmp = Float64(Float64(x + 4.0) / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -4.1e-53)
		tmp = x / (y_m / (-1.0 + z));
	else
		tmp = (x + 4.0) / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -4.1e-53], N[(x / N[(y$95$m / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{\frac{y\_m}{-1 + z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.1000000000000001e-53

    1. Initial program 86.6%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub86.6%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def94.5%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval94.5%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified94.5%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine90.5%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/80.5%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/86.6%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv86.4%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv86.4%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub86.6%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.9%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.9%

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

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} + \frac{x}{y} \cdot \left(-z\right)} \]
    7. Taylor expanded in x around inf 50.4%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \color{blue}{\frac{x \cdot 1}{y}}\right) \]
      8. *-rgt-identity43.9%

        \[\leadsto 0 - \left(\frac{x \cdot z}{y} - \frac{\color{blue}{x}}{y}\right) \]
      9. div-sub47.8%

        \[\leadsto 0 - \color{blue}{\frac{x \cdot z - x}{y}} \]
      10. sub-neg47.8%

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

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{-1 \cdot x}}{y} \]
      12. *-commutative47.8%

        \[\leadsto 0 - \frac{x \cdot z + \color{blue}{x \cdot -1}}{y} \]
      13. distribute-lft-in47.8%

        \[\leadsto 0 - \frac{\color{blue}{x \cdot \left(z + -1\right)}}{y} \]
      14. metadata-eval47.8%

        \[\leadsto 0 - \frac{x \cdot \left(z + \color{blue}{\left(-1\right)}\right)}{y} \]
      15. sub-neg47.8%

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

        \[\leadsto 0 - \color{blue}{x \cdot \frac{z - 1}{y}} \]
      17. div-sub50.4%

        \[\leadsto 0 - x \cdot \color{blue}{\left(\frac{z}{y} - \frac{1}{y}\right)} \]
      18. neg-sub050.4%

        \[\leadsto \color{blue}{-x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)} \]
      19. *-commutative50.4%

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{1}{\frac{y}{z + -1}}} \]
      3. un-div-inv50.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{y}{z + -1}} \]
      5. sqrt-unprod37.7%

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{y}{z + -1}} \]
    11. Applied egg-rr49.6%

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

    if -4.1000000000000001e-53 < x

    1. Initial program 91.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub91.2%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def90.9%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval90.9%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.3%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/93.4%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/91.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv91.1%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv91.1%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub91.2%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt45.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr45.3%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt46.4%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg46.4%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-rgt-identity33.0%

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

        \[\leadsto 4 \cdot \frac{1}{y} + \color{blue}{x \cdot \frac{1}{y}} \]
      3. distribute-rgt-in33.0%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x + 4\right)}{y}} \]
      6. *-lft-identity33.0%

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

        \[\leadsto \frac{\color{blue}{4 + x}}{y} \]
    9. Simplified33.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{-53}:\\ \;\;\;\;\frac{x}{\frac{y}{-1 + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 54.0% accurate, 13.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 4:\\ \;\;\;\;\frac{4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z) :precision binary64 (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= 4.0d0) then
        tmp = 4.0d0 / y_m
    else
        tmp = x / y_m
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if (x <= 4.0) {
		tmp = 4.0 / y_m;
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= 4.0:
		tmp = 4.0 / y_m
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= 4.0)
		tmp = Float64(4.0 / y_m);
	else
		tmp = Float64(x / y_m);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= 4.0)
		tmp = 4.0 / y_m;
	else
		tmp = x / y_m;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4

    1. Initial program 91.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub91.7%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/89.9%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def91.4%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac91.4%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative91.4%

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

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg91.4%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval91.4%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified91.4%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine89.9%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/92.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/91.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv91.6%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv91.6%

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

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub91.7%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt47.7%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr47.7%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt48.7%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg48.7%

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

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

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

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

    if 4 < x

    1. Initial program 84.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Step-by-step derivation
      1. fabs-sub84.1%

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

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
      3. associate-*r/88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
      4. fmm-def93.6%

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
      5. distribute-neg-frac93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
      6. +-commutative93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
      7. distribute-neg-in93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
      8. unsub-neg93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
      9. metadata-eval93.6%

        \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
    3. Simplified93.6%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine88.8%

        \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
      2. associate-*r/81.3%

        \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
      3. associate-*l/84.1%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
      4. div-inv83.9%

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

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

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

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

        \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
      9. cancel-sign-sub-inv83.9%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
      10. div-inv84.1%

        \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
      11. fabs-sub84.1%

        \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
      12. add-sqr-sqrt39.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
      13. fabs-sqr39.5%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}} \]
      14. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      15. sub-neg40.2%

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

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

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

      \[\leadsto \color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}} \]
    8. Step-by-step derivation
      1. +-commutative26.8%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{4 \cdot 1}{y}} \]
      3. metadata-eval26.8%

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{4}}{y} \]
    9. Simplified26.8%

      \[\leadsto \color{blue}{\frac{x}{y} + \frac{4}{y}} \]
    10. Taylor expanded in x around inf 24.9%

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

Alternative 16: 39.6% accurate, 37.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \frac{4}{y\_m} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z) :precision binary64 (/ 4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	return 4.0 / y_m;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = 4.0d0 / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	return 4.0 / y_m;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	return 4.0 / y_m
y_m = abs(y)
function code(x, y_m, z)
	return Float64(4.0 / y_m)
end
y_m = abs(y);
function tmp = code(x, y_m, z)
	tmp = 4.0 / y_m;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := N[(4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|

\\
\frac{4}{y\_m}
\end{array}
Derivation
  1. Initial program 89.8%

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Step-by-step derivation
    1. fabs-sub89.8%

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} - \frac{x + 4}{y}\right| \]
    3. associate-*r/89.6%

      \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y}} - \frac{x + 4}{y}\right| \]
    4. fmm-def92.0%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, -\frac{x + 4}{y}\right)}\right| \]
    5. distribute-neg-frac92.0%

      \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \color{blue}{\frac{-\left(x + 4\right)}{y}}\right)\right| \]
    6. +-commutative92.0%

      \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-\color{blue}{\left(4 + x\right)}}{y}\right)\right| \]
    7. distribute-neg-in92.0%

      \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) + \left(-x\right)}}{y}\right)\right| \]
    8. unsub-neg92.0%

      \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{\left(-4\right) - x}}{y}\right)\right| \]
    9. metadata-eval92.0%

      \[\leadsto \left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{\color{blue}{-4} - x}{y}\right)\right| \]
  3. Simplified92.0%

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine89.6%

      \[\leadsto \left|\color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}}\right| \]
    2. associate-*r/89.6%

      \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}} + \frac{-4 - x}{y}\right| \]
    3. associate-*l/89.8%

      \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y}\right| \]
    4. div-inv89.7%

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

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

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

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

      \[\leadsto \left|\frac{x}{y} \cdot z + \left(-\color{blue}{\left(x + 4\right)}\right) \cdot \frac{1}{y}\right| \]
    9. cancel-sign-sub-inv89.7%

      \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z - \left(x + 4\right) \cdot \frac{1}{y}}\right| \]
    10. div-inv89.8%

      \[\leadsto \left|\frac{x}{y} \cdot z - \color{blue}{\frac{x + 4}{y}}\right| \]
    11. fabs-sub89.8%

      \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|} \]
    12. add-sqr-sqrt45.6%

      \[\leadsto \left|\color{blue}{\sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{x + 4}{y} - \frac{x}{y} \cdot z}}\right| \]
    13. fabs-sqr45.6%

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
    15. sub-neg46.6%

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

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

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

    \[\leadsto \color{blue}{\frac{4}{y}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024150 
(FPCore (x y z)
  :name "fabs fraction 1"
  :precision binary64
  (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))