fabs fraction 1

Percentage Accurate: 91.8% → 99.8%
Time: 9.6s
Alternatives: 16
Speedup: 1.0×

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

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 3.65 \cdot 10^{-44}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y\_m}, \frac{-4 - x}{y\_m}\right)\right|\\


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

    1. Initial program 88.4%

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

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

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

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

    if 3.64999999999999993e-44 < y

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.2% accurate, 0.3× 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 2 \cdot 10^{+73} \lor \neg \left(t\_0 \leq 4 \cdot 10^{+292}\right):\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 (or (<= t_0 2e+73) (not (<= t_0 4e+292)))
     (fabs (/ (- (+ x 4.0) (* x z)) y_m))
     t_0)))
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 <= 2e+73) || !(t_0 <= 4e+292)) {
		tmp = fabs((((x + 4.0) - (x * z)) / y_m));
	} else {
		tmp = t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = abs((((x + 4.0d0) / y_m) - (z * (x / y_m))))
    if ((t_0 <= 2d+73) .or. (.not. (t_0 <= 4d+292))) then
        tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
    else
        tmp = t_0
    end if
    code = tmp
end function
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 <= 2e+73) || !(t_0 <= 4e+292)) {
		tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
	} else {
		tmp = t_0;
	}
	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 <= 2e+73) or not (t_0 <= 4e+292):
		tmp = math.fabs((((x + 4.0) - (x * z)) / y_m))
	else:
		tmp = t_0
	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 <= 2e+73) || !(t_0 <= 4e+292))
		tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m));
	else
		tmp = t_0;
	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 <= 2e+73) || ~((t_0 <= 4e+292)))
		tmp = abs((((x + 4.0) - (x * z)) / y_m));
	else
		tmp = t_0;
	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[Or[LessEqual[t$95$0, 2e+73], N[Not[LessEqual[t$95$0, 4e+292]], $MachinePrecision]], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]
\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 2 \cdot 10^{+73} \lor \neg \left(t\_0 \leq 4 \cdot 10^{+292}\right):\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\

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


\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))) < 1.99999999999999997e73 or 4.0000000000000001e292 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)))

    1. Initial program 84.9%

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

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

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

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

    if 1.99999999999999997e73 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 4.0000000000000001e292

    1. Initial program 99.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

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

Alternative 3: 95.6% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;z \leq -3.7 \cdot 10^{+14} \lor \neg \left(z \leq 7.5 \cdot 10^{-13}\right):\\ \;\;\;\;\left|\frac{4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (or (<= z -3.7e+14) (not (<= z 7.5e-13)))
   (fabs (- (/ 4.0 y_m) (/ x (/ y_m z))))
   (fabs (/ (- x -4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if ((z <= -3.7e+14) || !(z <= 7.5e-13)) {
		tmp = fabs(((4.0 / y_m) - (x / (y_m / z))));
	} else {
		tmp = fabs(((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 ((z <= (-3.7d+14)) .or. (.not. (z <= 7.5d-13))) then
        tmp = abs(((4.0d0 / y_m) - (x / (y_m / z))))
    else
        tmp = abs(((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 ((z <= -3.7e+14) || !(z <= 7.5e-13)) {
		tmp = Math.abs(((4.0 / y_m) - (x / (y_m / z))));
	} else {
		tmp = Math.abs(((x - -4.0) / y_m));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if (z <= -3.7e+14) or not (z <= 7.5e-13):
		tmp = math.fabs(((4.0 / y_m) - (x / (y_m / z))))
	else:
		tmp = math.fabs(((x - -4.0) / y_m))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if ((z <= -3.7e+14) || !(z <= 7.5e-13))
		tmp = abs(Float64(Float64(4.0 / y_m) - Float64(x / Float64(y_m / z))));
	else
		tmp = abs(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 ((z <= -3.7e+14) || ~((z <= 7.5e-13)))
		tmp = abs(((4.0 / y_m) - (x / (y_m / z))));
	else
		tmp = abs(((x - -4.0) / y_m));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[Or[LessEqual[z, -3.7e+14], N[Not[LessEqual[z, 7.5e-13]], $MachinePrecision]], N[Abs[N[(N[(4.0 / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+14} \lor \neg \left(z \leq 7.5 \cdot 10^{-13}\right):\\
\;\;\;\;\left|\frac{4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.7e14 or 7.5000000000000004e-13 < z

    1. Initial program 85.4%

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

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

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

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

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    5. Taylor expanded in x around 0 87.9%

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

    if -3.7e14 < z < 7.5000000000000004e-13

    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.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 100.0%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/100.0%

        \[\leadsto \left|\color{blue}{\frac{-1 \cdot \left(4 + x\right)}{y}}\right| \]
      2. distribute-lft-in100.0%

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval100.0%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-1100.0%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified100.0%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.6%

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

Alternative 4: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 5 \cdot 10^{-12}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\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-12)
   (fabs (/ (- (+ x 4.0) (* x z)) y_m))
   (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-12) {
		tmp = fabs((((x + 4.0) - (x * z)) / y_m));
	} else {
		tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
	}
	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 (y_m <= 5d-12) then
        tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
    else
        tmp = abs((((x + 4.0d0) / y_m) - (x / (y_m / z))))
    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 (y_m <= 5e-12) {
		tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
	} else {
		tmp = Math.abs((((x + 4.0) / y_m) - (x / (y_m / z))));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if y_m <= 5e-12:
		tmp = math.fabs((((x + 4.0) - (x * z)) / y_m))
	else:
		tmp = math.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-12)
		tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m));
	else
		tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z))));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (y_m <= 5e-12)
		tmp = abs((((x + 4.0) - (x * z)) / y_m));
	else
		tmp = abs((((x + 4.0) / y_m) - (x / (y_m / z))));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 5e-12], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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^{-12}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\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 < 4.9999999999999997e-12

    1. Initial program 88.6%

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

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

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

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

    if 4.9999999999999997e-12 < y

    1. Initial program 96.7%

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

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

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

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

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

      \[\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 5: 86.1% accurate, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+47} \lor \neg \left(z \leq 2.6 \cdot 10^{+31}\right):\\ \;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (or (<= z -1.45e+47) (not (<= z 2.6e+31)))
   (fabs (* z (/ x y_m)))
   (fabs (/ (- x -4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if ((z <= -1.45e+47) || !(z <= 2.6e+31)) {
		tmp = fabs((z * (x / y_m)));
	} else {
		tmp = fabs(((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 ((z <= (-1.45d+47)) .or. (.not. (z <= 2.6d+31))) then
        tmp = abs((z * (x / y_m)))
    else
        tmp = abs(((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 ((z <= -1.45e+47) || !(z <= 2.6e+31)) {
		tmp = Math.abs((z * (x / y_m)));
	} else {
		tmp = Math.abs(((x - -4.0) / y_m));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if (z <= -1.45e+47) or not (z <= 2.6e+31):
		tmp = math.fabs((z * (x / y_m)))
	else:
		tmp = math.fabs(((x - -4.0) / y_m))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if ((z <= -1.45e+47) || !(z <= 2.6e+31))
		tmp = abs(Float64(z * Float64(x / y_m)));
	else
		tmp = abs(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 ((z <= -1.45e+47) || ~((z <= 2.6e+31)))
		tmp = abs((z * (x / y_m)));
	else
		tmp = abs(((x - -4.0) / y_m));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[Or[LessEqual[z, -1.45e+47], N[Not[LessEqual[z, 2.6e+31]], $MachinePrecision]], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+47} \lor \neg \left(z \leq 2.6 \cdot 10^{+31}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4499999999999999e47 or 2.6e31 < z

    1. Initial program 85.2%

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

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

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right| \]
    5. Step-by-step derivation
      1. mul-1-neg69.1%

        \[\leadsto \left|\color{blue}{-\frac{x \cdot z}{y}}\right| \]
      2. distribute-frac-neg269.1%

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

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

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

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

    if -1.4499999999999999e47 < z < 2.6e31

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 98.2%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/98.2%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval98.2%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-198.2%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified98.2%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+47} \lor \neg \left(z \leq 2.6 \cdot 10^{+31}\right):\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x - -4}{y}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 96.0% accurate, 1.0× speedup?

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

\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|
\end{array}
Derivation
  1. Initial program 90.4%

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

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

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

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

Alternative 7: 79.2% accurate, 5.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \frac{x + 4}{y\_m}\\ \mathbf{if}\;x \leq -4:\\ \;\;\;\;x \cdot \frac{z}{y\_m} - t\_0\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-272}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \frac{x}{\frac{y\_m}{z}}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (let* ((t_0 (/ (+ x 4.0) y_m)))
   (if (<= x -4.0)
     (- (* x (/ z y_m)) t_0)
     (if (<= x 2.6e-272)
       (/ (- (+ x 4.0) (* x z)) y_m)
       (+ t_0 (/ x (/ y_m z)))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = (x + 4.0) / y_m;
	double tmp;
	if (x <= -4.0) {
		tmp = (x * (z / y_m)) - t_0;
	} else if (x <= 2.6e-272) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = t_0 + (x / (y_m / z));
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = (x + 4.0d0) / y_m
    if (x <= (-4.0d0)) then
        tmp = (x * (z / y_m)) - t_0
    else if (x <= 2.6d-272) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else
        tmp = t_0 + (x / (y_m / z))
    end if
    code = tmp
end function
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 tmp;
	if (x <= -4.0) {
		tmp = (x * (z / y_m)) - t_0;
	} else if (x <= 2.6e-272) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = t_0 + (x / (y_m / z));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	t_0 = (x + 4.0) / y_m
	tmp = 0
	if x <= -4.0:
		tmp = (x * (z / y_m)) - t_0
	elif x <= 2.6e-272:
		tmp = ((x + 4.0) - (x * z)) / y_m
	else:
		tmp = t_0 + (x / (y_m / z))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	t_0 = Float64(Float64(x + 4.0) / y_m)
	tmp = 0.0
	if (x <= -4.0)
		tmp = Float64(Float64(x * Float64(z / y_m)) - t_0);
	elseif (x <= 2.6e-272)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	else
		tmp = Float64(t_0 + Float64(x / Float64(y_m / z)));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	t_0 = (x + 4.0) / y_m;
	tmp = 0.0;
	if (x <= -4.0)
		tmp = (x * (z / y_m)) - t_0;
	elseif (x <= 2.6e-272)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	else
		tmp = t_0 + (x / (y_m / z));
	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]}, If[LessEqual[x, -4.0], N[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.6e-272], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(t$95$0 + N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{x}{\frac{y\_m}{z}}\\


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

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}\right| \]
      12. add-sqr-sqrt51.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| \]
      13. fabs-sqr51.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)}} \]
      14. add-sqr-sqrt51.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      16. associate-*r/43.8%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      18. div-inv46.0%

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

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

    if -4 < x < 2.59999999999999992e-272

    1. Initial program 92.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt38.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| \]
      2. fabs-sqr38.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}} \]
      3. add-sqr-sqrt40.2%

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/34.4%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}} \]
    4. Applied egg-rr34.4%

      \[\leadsto \color{blue}{\frac{x + 4}{y} - x \cdot \frac{z}{y}} \]
    5. Step-by-step derivation
      1. clear-num34.4%

        \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
      2. un-div-inv34.6%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
    6. Applied egg-rr34.6%

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

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

    if 2.59999999999999992e-272 < x

    1. Initial program 92.5%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt42.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| \]
      2. fabs-sqr42.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}} \]
      3. add-sqr-sqrt43.6%

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/45.4%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}} \]
    4. Applied egg-rr45.4%

      \[\leadsto \color{blue}{\frac{x + 4}{y} - x \cdot \frac{z}{y}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt21.7%

        \[\leadsto \frac{x + 4}{y} - x \cdot \frac{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}{y} \]
      2. sqrt-unprod35.3%

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

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

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

        \[\leadsto \frac{x + 4}{y} - x \cdot \frac{\color{blue}{-z}}{y} \]
      6. distribute-frac-neg42.7%

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

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

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

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{-x}{\frac{y}{z}}} \]
    6. Applied egg-rr42.7%

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

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

Alternative 8: 77.4% accurate, 6.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4:\\ \;\;\;\;\frac{x \cdot z + \left(-4 - x\right)}{y\_m}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\ \;\;\;\;\frac{4 - x \cdot z}{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)
   (/ (+ (* x z) (- -4.0 x)) y_m)
   (if (<= x 6.5e+23) (/ (- 4.0 (* x z)) 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 = ((x * z) + (-4.0 - x)) / y_m;
	} else if (x <= 6.5e+23) {
		tmp = (4.0 - (x * z)) / 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 = ((x * z) + ((-4.0d0) - x)) / y_m
    else if (x <= 6.5d+23) then
        tmp = (4.0d0 - (x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m;
	} else if (x <= 6.5e+23) {
		tmp = (4.0 - (x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m
	elif x <= 6.5e+23:
		tmp = (4.0 - (x * z)) / 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(Float64(Float64(x * z) + Float64(-4.0 - x)) / y_m);
	elseif (x <= 6.5e+23)
		tmp = Float64(Float64(4.0 - Float64(x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m;
	elseif (x <= 6.5e+23)
		tmp = (4.0 - (x * z)) / 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[(N[(N[(x * z), $MachinePrecision] + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 6.5e+23], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / 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{x \cdot z + \left(-4 - x\right)}{y\_m}\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\

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


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

    1. Initial program 84.6%

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

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

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

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

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

    if -4 < x < 6.4999999999999996e23

    1. Initial program 94.4%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt39.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| \]
      2. fabs-sqr39.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}} \]
      3. add-sqr-sqrt40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4999999999999996e23 < x

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 75.7%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/75.7%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval75.7%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-175.7%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified75.7%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt75.3%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod64.7%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs64.7%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs64.7%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs64.7%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg264.7%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg64.7%

        \[\leadsto \sqrt{\frac{\color{blue}{-4 + \left(-x\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      8. metadata-eval64.7%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg264.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg64.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval64.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{\left(-4\right)} + \left(-x\right)}{-y}} \]
      15. distribute-neg-in64.7%

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

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod38.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y}} \cdot \sqrt{\frac{x + 4}{y}}} \]
      19. add-sqr-sqrt39.1%

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
      20. clear-num39.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x + 4}}} \]
    9. Applied egg-rr39.0%

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

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

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

Alternative 9: 74.8% accurate, 6.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.22 \cdot 10^{+51}:\\ \;\;\;\;\frac{-x}{y\_m}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\ \;\;\;\;\frac{4 - x \cdot z}{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.22e+51)
   (/ (- x) y_m)
   (if (<= x 6.5e+23) (/ (- 4.0 (* x z)) y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.22e+51) {
		tmp = -x / y_m;
	} else if (x <= 6.5e+23) {
		tmp = (4.0 - (x * z)) / 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.22d+51)) then
        tmp = -x / y_m
    else if (x <= 6.5d+23) then
        tmp = (4.0d0 - (x * z)) / 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.22e+51) {
		tmp = -x / y_m;
	} else if (x <= 6.5e+23) {
		tmp = (4.0 - (x * z)) / 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.22e+51:
		tmp = -x / y_m
	elif x <= 6.5e+23:
		tmp = (4.0 - (x * z)) / 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.22e+51)
		tmp = Float64(Float64(-x) / y_m);
	elseif (x <= 6.5e+23)
		tmp = Float64(Float64(4.0 - Float64(x * z)) / 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.22e+51)
		tmp = -x / y_m;
	elseif (x <= 6.5e+23)
		tmp = (4.0 - (x * z)) / 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.22e+51], N[((-x) / y$95$m), $MachinePrecision], If[LessEqual[x, 6.5e+23], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / 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.22 \cdot 10^{+51}:\\
\;\;\;\;\frac{-x}{y\_m}\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.22000000000000005e51

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 69.7%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/69.7%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval69.7%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-169.7%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified69.7%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt36.2%

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

        \[\leadsto \color{blue}{\sqrt{\frac{-4 - x}{y}} \cdot \sqrt{\frac{-4 - x}{y}}} \]
      3. add-sqr-sqrt36.8%

        \[\leadsto \color{blue}{\frac{-4 - x}{y}} \]
      4. div-inv36.7%

        \[\leadsto \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
    9. Applied egg-rr36.7%

      \[\leadsto \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
    10. Taylor expanded in x around inf 36.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg36.8%

        \[\leadsto \color{blue}{-\frac{x}{y}} \]
      2. distribute-frac-neg236.8%

        \[\leadsto \color{blue}{\frac{x}{-y}} \]
    12. Simplified36.8%

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

    if -1.22000000000000005e51 < x < 6.4999999999999996e23

    1. Initial program 94.2%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt40.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| \]
      2. fabs-sqr40.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}} \]
      3. add-sqr-sqrt41.8%

        \[\leadsto \color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z} \]
      4. sub-neg41.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      16. neg-sub040.0%

        \[\leadsto \color{blue}{0 - \mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)} \]
      17. fma-undefine40.0%

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

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

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

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

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

    if 6.4999999999999996e23 < x

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 75.7%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/75.7%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval75.7%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-175.7%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified75.7%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt75.3%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod64.7%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs64.7%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs64.7%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs64.7%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg264.7%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg64.7%

        \[\leadsto \sqrt{\frac{\color{blue}{-4 + \left(-x\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      8. metadata-eval64.7%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg264.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg64.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval64.7%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{\left(-4\right)} + \left(-x\right)}{-y}} \]
      15. distribute-neg-in64.7%

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

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod38.4%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y}} \cdot \sqrt{\frac{x + 4}{y}}} \]
      19. add-sqr-sqrt39.1%

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
      20. clear-num39.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x + 4}}} \]
    9. Applied egg-rr39.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.22 \cdot 10^{+51}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\ \;\;\;\;\frac{4 - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 80.6% accurate, 6.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4:\\ \;\;\;\;x \cdot \frac{z}{y\_m} - \frac{x + 4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -4.0)
   (- (* x (/ z y_m)) (/ (+ x 4.0) y_m))
   (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.0) {
		tmp = (x * (z / y_m)) - ((x + 4.0) / y_m);
	} else {
		tmp = ((x + 4.0) - (x * z)) / 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 = (x * (z / y_m)) - ((x + 4.0d0) / y_m)
    else
        tmp = ((x + 4.0d0) - (x * z)) / 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 = (x * (z / y_m)) - ((x + 4.0) / y_m);
	} else {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -4.0:
		tmp = (x * (z / y_m)) - ((x + 4.0) / y_m)
	else:
		tmp = ((x + 4.0) - (x * z)) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -4.0)
		tmp = Float64(Float64(x * Float64(z / y_m)) - Float64(Float64(x + 4.0) / y_m));
	else
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / 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 = (x * (z / y_m)) - ((x + 4.0) / y_m);
	else
		tmp = ((x + 4.0) - (x * z)) / 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[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;x \cdot \frac{z}{y\_m} - \frac{x + 4}{y\_m}\\

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


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

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)}\right| \]
      12. add-sqr-sqrt51.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| \]
      13. fabs-sqr51.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)}} \]
      14. add-sqr-sqrt51.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y} + \frac{-4 - x}{y}} \]
      16. associate-*r/43.8%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} + \frac{-4 - x}{y} \]
      18. div-inv46.0%

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

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

    if -4 < x

    1. Initial program 92.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt41.1%

        \[\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| \]
      2. fabs-sqr41.1%

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

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/40.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}} \]
    4. Applied egg-rr40.8%

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

        \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
      2. un-div-inv40.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
    6. Applied egg-rr40.8%

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

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

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

Alternative 11: 80.1% accurate, 7.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4:\\ \;\;\;\;\frac{x \cdot z + \left(-4 - x\right)}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -4.0) (/ (+ (* x z) (- -4.0 x)) y_m) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.0) {
		tmp = ((x * z) + (-4.0 - x)) / y_m;
	} else {
		tmp = ((x + 4.0) - (x * z)) / 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 = ((x * z) + ((-4.0d0) - x)) / y_m
    else
        tmp = ((x + 4.0d0) - (x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m;
	} else {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -4.0:
		tmp = ((x * z) + (-4.0 - x)) / y_m
	else:
		tmp = ((x + 4.0) - (x * z)) / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -4.0)
		tmp = Float64(Float64(Float64(x * z) + Float64(-4.0 - x)) / y_m);
	else
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m;
	else
		tmp = ((x + 4.0) - (x * z)) / 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[(N[(N[(x * z), $MachinePrecision] + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{x \cdot z + \left(-4 - x\right)}{y\_m}\\

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


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

    1. Initial program 84.6%

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

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

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

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

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

    if -4 < x

    1. Initial program 92.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt41.1%

        \[\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| \]
      2. fabs-sqr41.1%

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

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/40.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}} \]
    4. Applied egg-rr40.8%

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

        \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
      2. un-div-inv40.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
    6. Applied egg-rr40.8%

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

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

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

Alternative 12: 70.0% 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(Float64(-x) / 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 84.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 65.6%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/65.6%

        \[\leadsto \left|\color{blue}{\frac{-1 \cdot \left(4 + x\right)}{y}}\right| \]
      2. distribute-lft-in65.6%

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval65.6%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-165.6%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified65.6%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt35.9%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-4 - x}{y}} \cdot \sqrt{\frac{-4 - x}{y}}}\right| \]
      2. fabs-sqr35.9%

        \[\leadsto \color{blue}{\sqrt{\frac{-4 - x}{y}} \cdot \sqrt{\frac{-4 - x}{y}}} \]
      3. add-sqr-sqrt36.5%

        \[\leadsto \color{blue}{\frac{-4 - x}{y}} \]
      4. div-inv36.4%

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

      \[\leadsto \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
    10. Taylor expanded in x around inf 36.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg36.5%

        \[\leadsto \color{blue}{-\frac{x}{y}} \]
      2. distribute-frac-neg236.5%

        \[\leadsto \color{blue}{\frac{x}{-y}} \]
    12. Simplified36.5%

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

    if -10.5 < x < 4

    1. Initial program 94.3%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. 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| \]
      2. 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}} \]
      3. add-sqr-sqrt40.8%

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/38.8%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{x \cdot \frac{z}{y}} \]
    4. Applied egg-rr38.8%

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

        \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
      2. un-div-inv38.9%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
    6. Applied egg-rr38.9%

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

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

    if 4 < x

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 72.2%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/72.2%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval72.2%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-172.2%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified72.2%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt71.8%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod61.9%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs61.9%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs61.9%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs61.9%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg261.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg61.9%

        \[\leadsto \sqrt{\frac{\color{blue}{-4 + \left(-x\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      8. metadata-eval61.9%

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

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

        \[\leadsto \sqrt{\frac{-\color{blue}{\left(x + 4\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      11. frac-2neg61.9%

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg261.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{\left(-4\right)} + \left(-x\right)}{-y}} \]
      15. distribute-neg-in61.9%

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{-\color{blue}{\left(x + 4\right)}}{-y}} \]
      17. frac-2neg61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod35.8%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y}} \cdot \sqrt{\frac{x + 4}{y}}} \]
      19. add-sqr-sqrt36.4%

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
      20. clear-num36.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x + 4}}} \]
    9. Applied egg-rr36.4%

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

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

    \[\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 13: 71.0% accurate, 11.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4:\\ \;\;\;\;\frac{-4 - x}{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 -4.0) (/ (- -4.0 x) y_m) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.0) {
		tmp = (-4.0 - x) / 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 <= (-4.0d0)) then
        tmp = ((-4.0d0) - x) / 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 <= -4.0) {
		tmp = (-4.0 - x) / 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 <= -4.0:
		tmp = (-4.0 - x) / 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 <= -4.0)
		tmp = Float64(Float64(-4.0 - x) / 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 <= -4.0)
		tmp = (-4.0 - x) / 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, -4.0], N[(N[(-4.0 - x), $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 -4:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\

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


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

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 66.1%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/66.1%

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

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

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-166.1%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified66.1%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt35.4%

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

        \[\leadsto \color{blue}{\sqrt{\frac{-4 - x}{y}} \cdot \sqrt{\frac{-4 - x}{y}}} \]
      3. add-sqr-sqrt36.0%

        \[\leadsto \color{blue}{\frac{-4 - x}{y}} \]
      4. div-inv35.9%

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

      \[\leadsto \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
    10. Taylor expanded in x around 0 36.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y} - 4 \cdot \frac{1}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg36.0%

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

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

        \[\leadsto \left(0 - \frac{x}{y}\right) - \color{blue}{\frac{4 \cdot 1}{y}} \]
      4. metadata-eval36.0%

        \[\leadsto \left(0 - \frac{x}{y}\right) - \frac{\color{blue}{4}}{y} \]
      5. associate--r+36.0%

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

        \[\leadsto 0 - \color{blue}{\left(\frac{4}{y} + \frac{x}{y}\right)} \]
      7. associate--r+36.0%

        \[\leadsto \color{blue}{\left(0 - \frac{4}{y}\right) - \frac{x}{y}} \]
      8. neg-sub036.0%

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

        \[\leadsto \color{blue}{\frac{-4}{y}} - \frac{x}{y} \]
      10. metadata-eval36.0%

        \[\leadsto \frac{\color{blue}{-4}}{y} - \frac{x}{y} \]
      11. div-sub36.0%

        \[\leadsto \color{blue}{\frac{-4 - x}{y}} \]
    12. Simplified36.0%

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

    if -4 < x

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 74.2%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/74.2%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval74.2%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-174.2%

        \[\leadsto \left|\frac{-4 + \color{blue}{\left(-x\right)}}{y}\right| \]
      5. sub-neg74.2%

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified74.2%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt73.7%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod47.6%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs47.6%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs47.6%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs47.6%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg247.6%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg47.6%

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

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

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

        \[\leadsto \sqrt{\frac{-\color{blue}{\left(x + 4\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      11. frac-2neg47.6%

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg247.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg47.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval47.6%

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

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{-\color{blue}{\left(x + 4\right)}}{-y}} \]
      17. frac-2neg47.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod32.1%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
    9. Applied egg-rr33.2%

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

Alternative 14: 70.8% accurate, 11.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -4:\\ \;\;\;\;\frac{-x}{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 -4.0) (/ (- x) y_m) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -4.0) {
		tmp = -x / 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 <= (-4.0d0)) then
        tmp = -x / 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 <= -4.0) {
		tmp = -x / 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 <= -4.0:
		tmp = -x / 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 <= -4.0)
		tmp = Float64(Float64(-x) / 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 <= -4.0)
		tmp = -x / 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, -4.0], N[((-x) / 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 -4:\\
\;\;\;\;\frac{-x}{y\_m}\\

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


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

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 66.1%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/66.1%

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

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

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-166.1%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified66.1%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt35.4%

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

        \[\leadsto \color{blue}{\sqrt{\frac{-4 - x}{y}} \cdot \sqrt{\frac{-4 - x}{y}}} \]
      3. add-sqr-sqrt36.0%

        \[\leadsto \color{blue}{\frac{-4 - x}{y}} \]
      4. div-inv35.9%

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

      \[\leadsto \color{blue}{\left(-4 - x\right) \cdot \frac{1}{y}} \]
    10. Taylor expanded in x around inf 36.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg36.0%

        \[\leadsto \color{blue}{-\frac{x}{y}} \]
      2. distribute-frac-neg236.0%

        \[\leadsto \color{blue}{\frac{x}{-y}} \]
    12. Simplified36.0%

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

    if -4 < x

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 74.2%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/74.2%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval74.2%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-174.2%

        \[\leadsto \left|\frac{-4 + \color{blue}{\left(-x\right)}}{y}\right| \]
      5. sub-neg74.2%

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified74.2%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt73.7%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod47.6%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs47.6%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs47.6%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs47.6%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg247.6%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg47.6%

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

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

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

        \[\leadsto \sqrt{\frac{-\color{blue}{\left(x + 4\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      11. frac-2neg47.6%

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg247.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg47.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval47.6%

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

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{-\color{blue}{\left(x + 4\right)}}{-y}} \]
      17. frac-2neg47.6%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod32.1%

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

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
    9. Applied egg-rr33.2%

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

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

Alternative 15: 56.5% 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 90.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt38.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| \]
      2. fabs-sqr38.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}} \]
      3. add-sqr-sqrt39.9%

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

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
      5. associate-*r/39.1%

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

      \[\leadsto \color{blue}{\frac{x + 4}{y} - x \cdot \frac{z}{y}} \]
    5. Step-by-step derivation
      1. clear-num39.1%

        \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
      2. un-div-inv39.2%

        \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
    6. Applied egg-rr39.2%

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

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

    if 4 < x

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 72.2%

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{4 + x}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-*r/72.2%

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

        \[\leadsto \left|\frac{\color{blue}{-1 \cdot 4 + -1 \cdot x}}{y}\right| \]
      3. metadata-eval72.2%

        \[\leadsto \left|\frac{\color{blue}{-4} + -1 \cdot x}{y}\right| \]
      4. neg-mul-172.2%

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

        \[\leadsto \left|\frac{\color{blue}{-4 - x}}{y}\right| \]
    7. Simplified72.2%

      \[\leadsto \left|\color{blue}{\frac{-4 - x}{y}}\right| \]
    8. Step-by-step derivation
      1. add-sqr-sqrt71.8%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right|} \cdot \sqrt{\left|\frac{-4 - x}{y}\right|}} \]
      2. sqrt-unprod61.9%

        \[\leadsto \color{blue}{\sqrt{\left|\frac{-4 - x}{y}\right| \cdot \left|\frac{-4 - x}{y}\right|}} \]
      3. neg-fabs61.9%

        \[\leadsto \sqrt{\color{blue}{\left|-\frac{-4 - x}{y}\right|} \cdot \left|\frac{-4 - x}{y}\right|} \]
      4. neg-fabs61.9%

        \[\leadsto \sqrt{\left|-\frac{-4 - x}{y}\right| \cdot \color{blue}{\left|-\frac{-4 - x}{y}\right|}} \]
      5. sqr-abs61.9%

        \[\leadsto \sqrt{\color{blue}{\left(-\frac{-4 - x}{y}\right) \cdot \left(-\frac{-4 - x}{y}\right)}} \]
      6. distribute-frac-neg261.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-4 - x}{-y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      7. sub-neg61.9%

        \[\leadsto \sqrt{\frac{\color{blue}{-4 + \left(-x\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      8. metadata-eval61.9%

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

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

        \[\leadsto \sqrt{\frac{-\color{blue}{\left(x + 4\right)}}{-y} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      11. frac-2neg61.9%

        \[\leadsto \sqrt{\color{blue}{\frac{x + 4}{y}} \cdot \left(-\frac{-4 - x}{y}\right)} \]
      12. distribute-frac-neg261.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{-4 - x}{-y}}} \]
      13. sub-neg61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{-4 + \left(-x\right)}}{-y}} \]
      14. metadata-eval61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{\color{blue}{\left(-4\right)} + \left(-x\right)}{-y}} \]
      15. distribute-neg-in61.9%

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

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \frac{-\color{blue}{\left(x + 4\right)}}{-y}} \]
      17. frac-2neg61.9%

        \[\leadsto \sqrt{\frac{x + 4}{y} \cdot \color{blue}{\frac{x + 4}{y}}} \]
      18. sqrt-unprod35.8%

        \[\leadsto \color{blue}{\sqrt{\frac{x + 4}{y}} \cdot \sqrt{\frac{x + 4}{y}}} \]
      19. add-sqr-sqrt36.4%

        \[\leadsto \color{blue}{\frac{x + 4}{y}} \]
      20. clear-num36.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x + 4}}} \]
    9. Applied egg-rr36.4%

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

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

Alternative 16: 41.5% 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 90.4%

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt40.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| \]
    2. fabs-sqr40.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}} \]
    3. add-sqr-sqrt41.3%

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

      \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}} \]
    5. associate-*r/40.7%

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

    \[\leadsto \color{blue}{\frac{x + 4}{y} - x \cdot \frac{z}{y}} \]
  5. Step-by-step derivation
    1. clear-num40.7%

      \[\leadsto \frac{x + 4}{y} - x \cdot \color{blue}{\frac{1}{\frac{y}{z}}} \]
    2. un-div-inv40.8%

      \[\leadsto \frac{x + 4}{y} - \color{blue}{\frac{x}{\frac{y}{z}}} \]
  6. Applied egg-rr40.8%

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

    \[\leadsto \color{blue}{\frac{4}{y}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024117 
(FPCore (x y z)
  :name "fabs fraction 1"
  :precision binary64
  (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))