fabs fraction 1

Percentage Accurate: 91.9% → 99.8%
Time: 10.4s
Alternatives: 17
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 17 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 5 \cdot 10^{-39}:\\ \;\;\;\;\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 5e-39)
   (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 <= 5e-39) {
		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 <= 5e-39)
		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, 5e-39], 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 5 \cdot 10^{-39}:\\
\;\;\;\;\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 < 4.9999999999999998e-39

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\sqrt{\color{blue}{\left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right) \cdot \left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right)}}\right| \]
    6. Applied egg-rr98.4%

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

    if 4.9999999999999998e-39 < y

    1. Initial program 97.3%

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

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

        \[\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: 82.9% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \left|\frac{x \cdot z}{y\_m}\right|\\ \mathbf{if}\;z \leq -1.65 \cdot 10^{+220}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{+87}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{+174}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y\_m} + x \cdot \frac{z}{y\_m}\\ \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 z) y_m))))
   (if (<= z -1.65e+220)
     t_0
     (if (<= z -7.5e+87)
       (/ (- (+ x 4.0) (* x z)) y_m)
       (if (<= z -2.6e+14)
         t_0
         (if (<= z 5.8e-6)
           (fabs (/ (- -4.0 x) y_m))
           (if (<= z 3.1e+174)
             (+ (* (- -4.0 x) (/ -1.0 y_m)) (* x (/ z y_m)))
             t_0)))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = fabs(((x * z) / y_m));
	double tmp;
	if (z <= -1.65e+220) {
		tmp = t_0;
	} else if (z <= -7.5e+87) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else if (z <= -2.6e+14) {
		tmp = t_0;
	} else if (z <= 5.8e-6) {
		tmp = fabs(((-4.0 - x) / y_m));
	} else if (z <= 3.1e+174) {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (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 * z) / y_m))
    if (z <= (-1.65d+220)) then
        tmp = t_0
    else if (z <= (-7.5d+87)) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else if (z <= (-2.6d+14)) then
        tmp = t_0
    else if (z <= 5.8d-6) then
        tmp = abs((((-4.0d0) - x) / y_m))
    else if (z <= 3.1d+174) then
        tmp = (((-4.0d0) - x) * ((-1.0d0) / y_m)) + (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 * z) / y_m));
	double tmp;
	if (z <= -1.65e+220) {
		tmp = t_0;
	} else if (z <= -7.5e+87) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else if (z <= -2.6e+14) {
		tmp = t_0;
	} else if (z <= 5.8e-6) {
		tmp = Math.abs(((-4.0 - x) / y_m));
	} else if (z <= 3.1e+174) {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (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 * z) / y_m))
	tmp = 0
	if z <= -1.65e+220:
		tmp = t_0
	elif z <= -7.5e+87:
		tmp = ((x + 4.0) - (x * z)) / y_m
	elif z <= -2.6e+14:
		tmp = t_0
	elif z <= 5.8e-6:
		tmp = math.fabs(((-4.0 - x) / y_m))
	elif z <= 3.1e+174:
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (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(x * z) / y_m))
	tmp = 0.0
	if (z <= -1.65e+220)
		tmp = t_0;
	elseif (z <= -7.5e+87)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	elseif (z <= -2.6e+14)
		tmp = t_0;
	elseif (z <= 5.8e-6)
		tmp = abs(Float64(Float64(-4.0 - x) / y_m));
	elseif (z <= 3.1e+174)
		tmp = Float64(Float64(Float64(-4.0 - x) * Float64(-1.0 / y_m)) + Float64(x * Float64(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 * z) / y_m));
	tmp = 0.0;
	if (z <= -1.65e+220)
		tmp = t_0;
	elseif (z <= -7.5e+87)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	elseif (z <= -2.6e+14)
		tmp = t_0;
	elseif (z <= 5.8e-6)
		tmp = abs(((-4.0 - x) / y_m));
	elseif (z <= 3.1e+174)
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (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[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.65e+220], t$95$0, If[LessEqual[z, -7.5e+87], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[z, -2.6e+14], t$95$0, If[LessEqual[z, 5.8e-6], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.1e+174], N[(N[(N[(-4.0 - x), $MachinePrecision] * N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

\mathbf{elif}\;z \leq -2.6 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.65000000000000011e220 or -7.50000000000000014e87 < z < -2.6e14 or 3.1e174 < z

    1. Initial program 78.4%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 86.2%

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

    if -1.65000000000000011e220 < z < -7.50000000000000014e87

    1. Initial program 96.2%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr68.9%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt69.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr69.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in y around 0 69.5%

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

    if -2.6e14 < z < 5.8000000000000004e-6

    1. Initial program 94.9%

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

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

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

        \[\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| \]

    if 5.8000000000000004e-6 < z < 3.1e174

    1. Initial program 82.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr45.4%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt46.2%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative46.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr46.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Step-by-step derivation
      1. *-commutative46.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left|x \cdot \frac{z}{y}\right|} + \left(-4 - x\right) \cdot \frac{-1}{y} \]
      15. add-sqr-sqrt42.3%

        \[\leadsto \left|\color{blue}{\sqrt{x \cdot \frac{z}{y}} \cdot \sqrt{x \cdot \frac{z}{y}}}\right| + \left(-4 - x\right) \cdot \frac{-1}{y} \]
      16. fabs-sqr42.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+220}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{+87}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{+14}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\left|\frac{-4 - x}{y}\right|\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{+174}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y} + x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 92.4% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \left|x \cdot \frac{z + -1}{y\_m}\right|\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{-7}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 10^{-207}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{-121}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y\_m} + x \cdot \frac{z}{y\_m}\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{x + 4}{y\_m} + \left(x \cdot z\right) \cdot \frac{-1}{y\_m}\\ \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 (/ (+ z -1.0) y_m)))))
   (if (<= x -1.7e-7)
     t_0
     (if (<= x 1e-207)
       (/ (- (+ x 4.0) (* x z)) y_m)
       (if (<= x 6.3e-121)
         (+ (* (- -4.0 x) (/ -1.0 y_m)) (* x (/ z y_m)))
         (if (<= x 7.8e+15)
           (+ (/ (+ x 4.0) y_m) (* (* x z) (/ -1.0 y_m)))
           t_0))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = fabs((x * ((z + -1.0) / y_m)));
	double tmp;
	if (x <= -1.7e-7) {
		tmp = t_0;
	} else if (x <= 1e-207) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else if (x <= 6.3e-121) {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m));
	} else if (x <= 7.8e+15) {
		tmp = ((x + 4.0) / y_m) + ((x * z) * (-1.0 / 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 * ((z + (-1.0d0)) / y_m)))
    if (x <= (-1.7d-7)) then
        tmp = t_0
    else if (x <= 1d-207) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else if (x <= 6.3d-121) then
        tmp = (((-4.0d0) - x) * ((-1.0d0) / y_m)) + (x * (z / y_m))
    else if (x <= 7.8d+15) then
        tmp = ((x + 4.0d0) / y_m) + ((x * z) * ((-1.0d0) / 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 * ((z + -1.0) / y_m)));
	double tmp;
	if (x <= -1.7e-7) {
		tmp = t_0;
	} else if (x <= 1e-207) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else if (x <= 6.3e-121) {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m));
	} else if (x <= 7.8e+15) {
		tmp = ((x + 4.0) / y_m) + ((x * z) * (-1.0 / y_m));
	} else {
		tmp = t_0;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	t_0 = math.fabs((x * ((z + -1.0) / y_m)))
	tmp = 0
	if x <= -1.7e-7:
		tmp = t_0
	elif x <= 1e-207:
		tmp = ((x + 4.0) - (x * z)) / y_m
	elif x <= 6.3e-121:
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m))
	elif x <= 7.8e+15:
		tmp = ((x + 4.0) / y_m) + ((x * z) * (-1.0 / y_m))
	else:
		tmp = t_0
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	t_0 = abs(Float64(x * Float64(Float64(z + -1.0) / y_m)))
	tmp = 0.0
	if (x <= -1.7e-7)
		tmp = t_0;
	elseif (x <= 1e-207)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	elseif (x <= 6.3e-121)
		tmp = Float64(Float64(Float64(-4.0 - x) * Float64(-1.0 / y_m)) + Float64(x * Float64(z / y_m)));
	elseif (x <= 7.8e+15)
		tmp = Float64(Float64(Float64(x + 4.0) / y_m) + Float64(Float64(x * z) * Float64(-1.0 / 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 * ((z + -1.0) / y_m)));
	tmp = 0.0;
	if (x <= -1.7e-7)
		tmp = t_0;
	elseif (x <= 1e-207)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	elseif (x <= 6.3e-121)
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m));
	elseif (x <= 7.8e+15)
		tmp = ((x + 4.0) / y_m) + ((x * z) * (-1.0 / 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[(x * N[(N[(z + -1.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.7e-7], t$95$0, If[LessEqual[x, 1e-207], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 6.3e-121], N[(N[(N[(-4.0 - x), $MachinePrecision] * N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e+15], N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] + N[(N[(x * z), $MachinePrecision] * N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \left|x \cdot \frac{z + -1}{y\_m}\right|\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.69999999999999987e-7 or 7.8e15 < x

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{x \cdot \left(\frac{z}{y} - \frac{1}{y}\right)}\right| \]
    6. Step-by-step derivation
      1. div-sub99.4%

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

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

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

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

    if -1.69999999999999987e-7 < x < 9.99999999999999925e-208

    1. Initial program 96.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr41.7%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt43.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr43.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in y around 0 43.1%

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

    if 9.99999999999999925e-208 < x < 6.29999999999999961e-121

    1. Initial program 95.3%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr54.7%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt56.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr56.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Step-by-step derivation
      1. *-commutative56.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.29999999999999961e-121 < x < 7.8e15

    1. Initial program 96.4%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr49.5%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt51.2%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative51.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Step-by-step derivation
      1. *-commutative51.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-7}:\\ \;\;\;\;\left|x \cdot \frac{z + -1}{y}\right|\\ \mathbf{elif}\;x \leq 10^{-207}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{-121}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y} + x \cdot \frac{z}{y}\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{x + 4}{y} + \left(x \cdot z\right) \cdot \frac{-1}{y}\\ \mathbf{else}:\\ \;\;\;\;\left|x \cdot \frac{z + -1}{y}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.6% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 98.2%

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

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

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

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

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

    if -4.9999999999999998e-242 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\sqrt{\color{blue}{\left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right) \cdot \left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right)}}\right| \]
    6. Applied egg-rr97.4%

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

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

Alternative 5: 97.7% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 98.2%

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

    if -4.9999999999999998e-242 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\sqrt{\color{blue}{\left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right) \cdot \left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right)}}\right| \]
    6. Applied egg-rr97.4%

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

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

Alternative 6: 78.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{z}{y\_m}\\
t_1 := \frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{+55}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -0.00142:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.3e67 or -8.50000000000000002e55 < z < -0.00142000000000000004

    1. Initial program 96.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr61.1%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt61.7%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative61.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr61.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in y around 0 61.7%

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

    if -1.3e67 < z < -8.50000000000000002e55

    1. Initial program 99.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr29.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt30.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr30.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num30.3%

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

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

        \[\leadsto \frac{-1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      4. metadata-eval43.2%

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

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num43.2%

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

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr43.2%

      \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt43.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}}{\frac{y}{x}} \]
      2. sqrt-unprod43.2%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}}{\frac{y}{x}} \]
      3. sqr-neg43.2%

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

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

        \[\leadsto \frac{\color{blue}{z}}{\frac{y}{x}} \]
      6. associate-/r/57.3%

        \[\leadsto \color{blue}{\frac{z}{y} \cdot x} \]
    10. Applied egg-rr57.3%

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

    if -0.00142000000000000004 < z < 5.8000000000000004e-6

    1. Initial program 94.7%

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

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

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

        \[\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 99.9%

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

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

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

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

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

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

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

    if 5.8000000000000004e-6 < z

    1. Initial program 70.3%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr39.9%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt40.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr40.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Step-by-step derivation
      1. *-commutative40.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} + \left(-4 - x\right) \cdot \frac{-1}{y} \]
      10. fabs-sqr35.3%

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

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

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

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

        \[\leadsto \color{blue}{\left|x \cdot \frac{z}{y}\right|} + \left(-4 - x\right) \cdot \frac{-1}{y} \]
      15. add-sqr-sqrt50.2%

        \[\leadsto \left|\color{blue}{\sqrt{x \cdot \frac{z}{y}} \cdot \sqrt{x \cdot \frac{z}{y}}}\right| + \left(-4 - x\right) \cdot \frac{-1}{y} \]
      16. fabs-sqr50.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+67}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+55}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{elif}\;z \leq -0.00142:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\left|\frac{-4 - x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y} + x \cdot \frac{z}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 97.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 5.8 \cdot 10^{-6}\right):\\
\;\;\;\;\left|\frac{4}{y\_m} - \frac{z}{\frac{y\_m}{x}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 5.8000000000000004e-6 < z

    1. Initial program 83.6%

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

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

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

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

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

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

    if -1 < z < 5.8000000000000004e-6

    1. Initial program 94.8%

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

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

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

        \[\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.9%

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

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

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

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

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

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

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

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

Alternative 8: 95.8% 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 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\sqrt{\color{blue}{\left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right) \cdot \left(-\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right)}}\right| \]
  6. Applied egg-rr97.7%

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

Alternative 9: 69.4% accurate, 3.4× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y\_m}{x}}\\ \mathbf{elif}\;x \leq -2.55 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{+26}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+227}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y\_m} + x \cdot \frac{z}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -1.35e+249)
   (/ z (/ y_m x))
   (if (<= x -2.55e+178)
     (* z (/ x (- y_m)))
     (if (<= x -3e+26)
       (* z (/ x y_m))
       (if (<= x 1.3e+227)
         (/ (- (+ x 4.0) (* x z)) y_m)
         (+ (* (- -4.0 x) (/ -1.0 y_m)) (* x (/ z y_m))))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -1.35e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -2.55e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -3e+26) {
		tmp = z * (x / y_m);
	} else if (x <= 1.3e+227) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (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 <= (-1.35d+249)) then
        tmp = z / (y_m / x)
    else if (x <= (-2.55d+178)) then
        tmp = z * (x / -y_m)
    else if (x <= (-3d+26)) then
        tmp = z * (x / y_m)
    else if (x <= 1.3d+227) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else
        tmp = (((-4.0d0) - x) * ((-1.0d0) / y_m)) + (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 <= -1.35e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -2.55e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -3e+26) {
		tmp = z * (x / y_m);
	} else if (x <= 1.3e+227) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -1.35e+249:
		tmp = z / (y_m / x)
	elif x <= -2.55e+178:
		tmp = z * (x / -y_m)
	elif x <= -3e+26:
		tmp = z * (x / y_m)
	elif x <= 1.3e+227:
		tmp = ((x + 4.0) - (x * z)) / y_m
	else:
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -1.35e+249)
		tmp = Float64(z / Float64(y_m / x));
	elseif (x <= -2.55e+178)
		tmp = Float64(z * Float64(x / Float64(-y_m)));
	elseif (x <= -3e+26)
		tmp = Float64(z * Float64(x / y_m));
	elseif (x <= 1.3e+227)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	else
		tmp = Float64(Float64(Float64(-4.0 - x) * Float64(-1.0 / y_m)) + Float64(x * Float64(z / y_m)));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -1.35e+249)
		tmp = z / (y_m / x);
	elseif (x <= -2.55e+178)
		tmp = z * (x / -y_m);
	elseif (x <= -3e+26)
		tmp = z * (x / y_m);
	elseif (x <= 1.3e+227)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	else
		tmp = ((-4.0 - x) * (-1.0 / y_m)) + (x * (z / y_m));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -1.35e+249], N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.55e+178], N[(z * N[(x / (-y$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e+26], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.3e+227], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(-4.0 - x), $MachinePrecision] * N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

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

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

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


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

    1. Initial program 86.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr33.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt33.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr33.9%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod80.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num34.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num40.5%

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

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

    if -1.35000000000000009e249 < x < -2.5499999999999998e178

    1. Initial program 25.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod88.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num26.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num50.3%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    8. Applied egg-rr50.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. associate-/r/26.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \cdot \left(-\frac{x \cdot z}{y}\right)} \]
      8. mul-1-neg88.1%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
      11. mul-1-neg14.8%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      12. div-inv14.8%

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

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{x}{y}} \]
      16. distribute-lft-neg-in38.1%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{x}{y}} \]
    10. Applied egg-rr38.1%

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

    if -2.5499999999999998e178 < x < -2.99999999999999997e26

    1. Initial program 89.2%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt47.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr47.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac26.9%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num26.9%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac26.9%

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr26.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt33.9%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr33.9%

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

    if -2.99999999999999997e26 < x < 1.29999999999999991e227

    1. Initial program 95.1%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr48.2%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt49.4%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in y around 0 49.4%

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

    if 1.29999999999999991e227 < x

    1. Initial program 70.8%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr54.4%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt54.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr54.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Step-by-step derivation
      1. *-commutative54.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -2.55 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{+26}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+227}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(-4 - x\right) \cdot \frac{-1}{y} + x \cdot \frac{z}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 69.4% accurate, 3.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y\_m}{x}}\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{+24}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+213}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y\_m}{x \cdot \left(z + 1\right)}}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -5.8e+249)
   (/ z (/ y_m x))
   (if (<= x -1.08e+178)
     (* z (/ x (- y_m)))
     (if (<= x -2.1e+24)
       (* z (/ x y_m))
       (if (<= x 5.5e+213)
         (/ (- (+ x 4.0) (* x z)) y_m)
         (/ 1.0 (/ y_m (* x (+ z 1.0)))))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -5.8e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -1.08e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -2.1e+24) {
		tmp = z * (x / y_m);
	} else if (x <= 5.5e+213) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = 1.0 / (y_m / (x * (z + 1.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) :: tmp
    if (x <= (-5.8d+249)) then
        tmp = z / (y_m / x)
    else if (x <= (-1.08d+178)) then
        tmp = z * (x / -y_m)
    else if (x <= (-2.1d+24)) then
        tmp = z * (x / y_m)
    else if (x <= 5.5d+213) then
        tmp = ((x + 4.0d0) - (x * z)) / y_m
    else
        tmp = 1.0d0 / (y_m / (x * (z + 1.0d0)))
    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 <= -5.8e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -1.08e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -2.1e+24) {
		tmp = z * (x / y_m);
	} else if (x <= 5.5e+213) {
		tmp = ((x + 4.0) - (x * z)) / y_m;
	} else {
		tmp = 1.0 / (y_m / (x * (z + 1.0)));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -5.8e+249:
		tmp = z / (y_m / x)
	elif x <= -1.08e+178:
		tmp = z * (x / -y_m)
	elif x <= -2.1e+24:
		tmp = z * (x / y_m)
	elif x <= 5.5e+213:
		tmp = ((x + 4.0) - (x * z)) / y_m
	else:
		tmp = 1.0 / (y_m / (x * (z + 1.0)))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -5.8e+249)
		tmp = Float64(z / Float64(y_m / x));
	elseif (x <= -1.08e+178)
		tmp = Float64(z * Float64(x / Float64(-y_m)));
	elseif (x <= -2.1e+24)
		tmp = Float64(z * Float64(x / y_m));
	elseif (x <= 5.5e+213)
		tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m);
	else
		tmp = Float64(1.0 / Float64(y_m / Float64(x * Float64(z + 1.0))));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -5.8e+249)
		tmp = z / (y_m / x);
	elseif (x <= -1.08e+178)
		tmp = z * (x / -y_m);
	elseif (x <= -2.1e+24)
		tmp = z * (x / y_m);
	elseif (x <= 5.5e+213)
		tmp = ((x + 4.0) - (x * z)) / y_m;
	else
		tmp = 1.0 / (y_m / (x * (z + 1.0)));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -5.8e+249], N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.08e+178], N[(z * N[(x / (-y$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.1e+24], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e+213], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(1.0 / N[(y$95$m / N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

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

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

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


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

    1. Initial program 86.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr33.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt33.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr33.9%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod80.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num34.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num40.5%

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

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

    if -5.80000000000000034e249 < x < -1.07999999999999996e178

    1. Initial program 25.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod88.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num26.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num50.3%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    8. Applied egg-rr50.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. associate-/r/26.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \cdot \left(-\frac{x \cdot z}{y}\right)} \]
      8. mul-1-neg88.1%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
      11. mul-1-neg14.8%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      12. div-inv14.8%

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

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{x}{y}} \]
      16. distribute-lft-neg-in38.1%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{x}{y}} \]
    10. Applied egg-rr38.1%

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

    if -1.07999999999999996e178 < x < -2.1000000000000001e24

    1. Initial program 89.2%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt47.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr47.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac26.9%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num26.9%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac26.9%

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr26.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt33.9%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr33.9%

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

    if -2.1000000000000001e24 < x < 5.50000000000000059e213

    1. Initial program 96.1%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr49.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in y around 0 50.3%

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

    if 5.50000000000000059e213 < x

    1. Initial program 68.9%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr48.5%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt48.7%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative48.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr48.7%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
      3. distribute-rgt-neg-in55.3%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot \left(z - 1\right)}{y}} \]
      6. sub-neg55.3%

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
    8. Simplified55.3%

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x \cdot \left(1 - z\right)}}} \]
      3. *-un-lft-identity48.7%

        \[\leadsto \frac{1}{\frac{y}{x \cdot \color{blue}{\left(1 \cdot \left(1 - z\right)\right)}}} \]
      4. *-un-lft-identity48.7%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y}\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{+24}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+213}:\\ \;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x \cdot \left(z + 1\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 63.2% accurate, 3.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+248}:\\ \;\;\;\;\frac{z}{\frac{y\_m}{x}}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+16}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y\_m}{x \cdot \left(z + 1\right)}}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -7.5e+248)
   (/ z (/ y_m x))
   (if (<= x -2.2e+178)
     (* z (/ x (- y_m)))
     (if (<= x -8.5e-6)
       (* z (/ x y_m))
       (if (<= x 1.45e+16)
         (/ (+ x 4.0) y_m)
         (/ 1.0 (/ y_m (* x (+ z 1.0)))))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -7.5e+248) {
		tmp = z / (y_m / x);
	} else if (x <= -2.2e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -8.5e-6) {
		tmp = z * (x / y_m);
	} else if (x <= 1.45e+16) {
		tmp = (x + 4.0) / y_m;
	} else {
		tmp = 1.0 / (y_m / (x * (z + 1.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) :: tmp
    if (x <= (-7.5d+248)) then
        tmp = z / (y_m / x)
    else if (x <= (-2.2d+178)) then
        tmp = z * (x / -y_m)
    else if (x <= (-8.5d-6)) then
        tmp = z * (x / y_m)
    else if (x <= 1.45d+16) then
        tmp = (x + 4.0d0) / y_m
    else
        tmp = 1.0d0 / (y_m / (x * (z + 1.0d0)))
    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 <= -7.5e+248) {
		tmp = z / (y_m / x);
	} else if (x <= -2.2e+178) {
		tmp = z * (x / -y_m);
	} else if (x <= -8.5e-6) {
		tmp = z * (x / y_m);
	} else if (x <= 1.45e+16) {
		tmp = (x + 4.0) / y_m;
	} else {
		tmp = 1.0 / (y_m / (x * (z + 1.0)));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -7.5e+248:
		tmp = z / (y_m / x)
	elif x <= -2.2e+178:
		tmp = z * (x / -y_m)
	elif x <= -8.5e-6:
		tmp = z * (x / y_m)
	elif x <= 1.45e+16:
		tmp = (x + 4.0) / y_m
	else:
		tmp = 1.0 / (y_m / (x * (z + 1.0)))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -7.5e+248)
		tmp = Float64(z / Float64(y_m / x));
	elseif (x <= -2.2e+178)
		tmp = Float64(z * Float64(x / Float64(-y_m)));
	elseif (x <= -8.5e-6)
		tmp = Float64(z * Float64(x / y_m));
	elseif (x <= 1.45e+16)
		tmp = Float64(Float64(x + 4.0) / y_m);
	else
		tmp = Float64(1.0 / Float64(y_m / Float64(x * Float64(z + 1.0))));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -7.5e+248)
		tmp = z / (y_m / x);
	elseif (x <= -2.2e+178)
		tmp = z * (x / -y_m);
	elseif (x <= -8.5e-6)
		tmp = z * (x / y_m);
	elseif (x <= 1.45e+16)
		tmp = (x + 4.0) / y_m;
	else
		tmp = 1.0 / (y_m / (x * (z + 1.0)));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -7.5e+248], N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e+178], N[(z * N[(x / (-y$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-6], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e+16], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(1.0 / N[(y$95$m / N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

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

\mathbf{elif}\;x \leq 1.45 \cdot 10^{+16}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\

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


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

    1. Initial program 86.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr33.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt33.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr33.9%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod80.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num34.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num40.5%

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

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

    if -7.5000000000000004e248 < x < -2.19999999999999997e178

    1. Initial program 25.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod88.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num26.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num50.3%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    8. Applied egg-rr50.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. associate-/r/26.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \cdot \left(-\frac{x \cdot z}{y}\right)} \]
      8. mul-1-neg88.1%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
      11. mul-1-neg14.8%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      12. div-inv14.8%

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

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{x}{y}} \]
      16. distribute-lft-neg-in38.1%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{x}{y}} \]
    10. Applied egg-rr38.1%

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

    if -2.19999999999999997e178 < x < -8.4999999999999999e-6

    1. Initial program 90.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num30.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac33.1%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num33.1%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac33.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \sqrt{\color{blue}{z \cdot z}} \]
      7. sqrt-unprod13.2%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt30.0%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr30.0%

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

    if -8.4999999999999999e-6 < x < 1.45e16

    1. Initial program 96.3%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr45.4%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt46.8%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative46.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr46.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in z around 0 40.8%

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

    if 1.45e16 < x

    1. Initial program 84.2%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr54.1%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt54.5%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative54.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr54.5%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
      3. distribute-rgt-neg-in57.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
    8. Simplified57.2%

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x \cdot \left(1 - z\right)}}} \]
      3. *-un-lft-identity54.5%

        \[\leadsto \frac{1}{\frac{y}{x \cdot \color{blue}{\left(1 \cdot \left(1 - z\right)\right)}}} \]
      4. *-un-lft-identity54.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+248}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y}\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+16}:\\ \;\;\;\;\frac{x + 4}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x \cdot \left(z + 1\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 64.2% accurate, 4.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y\_m}{x}}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{+177}:\\ \;\;\;\;z \cdot \frac{x}{-y\_m}\\ \mathbf{elif}\;x \leq -6.9 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y\_m}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+35}:\\ \;\;\;\;\frac{x + 4}{y\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1 - z}{y\_m}\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (<= x -9e+249)
   (/ z (/ y_m x))
   (if (<= x -9.8e+177)
     (* z (/ x (- y_m)))
     (if (<= x -6.9e-6)
       (* z (/ x y_m))
       (if (<= x 3.1e+35) (/ (+ x 4.0) y_m) (* x (/ (- 1.0 z) y_m)))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= -9e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -9.8e+177) {
		tmp = z * (x / -y_m);
	} else if (x <= -6.9e-6) {
		tmp = z * (x / y_m);
	} else if (x <= 3.1e+35) {
		tmp = (x + 4.0) / y_m;
	} else {
		tmp = x * ((1.0 - 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 <= (-9d+249)) then
        tmp = z / (y_m / x)
    else if (x <= (-9.8d+177)) then
        tmp = z * (x / -y_m)
    else if (x <= (-6.9d-6)) then
        tmp = z * (x / y_m)
    else if (x <= 3.1d+35) then
        tmp = (x + 4.0d0) / y_m
    else
        tmp = x * ((1.0d0 - 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 <= -9e+249) {
		tmp = z / (y_m / x);
	} else if (x <= -9.8e+177) {
		tmp = z * (x / -y_m);
	} else if (x <= -6.9e-6) {
		tmp = z * (x / y_m);
	} else if (x <= 3.1e+35) {
		tmp = (x + 4.0) / y_m;
	} else {
		tmp = x * ((1.0 - z) / y_m);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= -9e+249:
		tmp = z / (y_m / x)
	elif x <= -9.8e+177:
		tmp = z * (x / -y_m)
	elif x <= -6.9e-6:
		tmp = z * (x / y_m)
	elif x <= 3.1e+35:
		tmp = (x + 4.0) / y_m
	else:
		tmp = x * ((1.0 - z) / y_m)
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= -9e+249)
		tmp = Float64(z / Float64(y_m / x));
	elseif (x <= -9.8e+177)
		tmp = Float64(z * Float64(x / Float64(-y_m)));
	elseif (x <= -6.9e-6)
		tmp = Float64(z * Float64(x / y_m));
	elseif (x <= 3.1e+35)
		tmp = Float64(Float64(x + 4.0) / y_m);
	else
		tmp = Float64(x * Float64(Float64(1.0 - z) / y_m));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if (x <= -9e+249)
		tmp = z / (y_m / x);
	elseif (x <= -9.8e+177)
		tmp = z * (x / -y_m);
	elseif (x <= -6.9e-6)
		tmp = z * (x / y_m);
	elseif (x <= 3.1e+35)
		tmp = (x + 4.0) / y_m;
	else
		tmp = x * ((1.0 - z) / y_m);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[LessEqual[x, -9e+249], N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.8e+177], N[(z * N[(x / (-y$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.9e-6], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+35], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

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

\mathbf{elif}\;x \leq 3.1 \cdot 10^{+35}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\

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


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

    1. Initial program 86.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr33.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt33.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr33.9%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod80.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num34.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num40.5%

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

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

    if -8.9999999999999993e249 < x < -9.8000000000000003e177

    1. Initial program 25.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod88.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num26.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num50.3%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    8. Applied egg-rr50.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. associate-/r/26.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \cdot \left(-\frac{x \cdot z}{y}\right)} \]
      8. mul-1-neg88.1%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
      11. mul-1-neg14.8%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      12. div-inv14.8%

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

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{x}{y}} \]
      16. distribute-lft-neg-in38.1%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{x}{y}} \]
    10. Applied egg-rr38.1%

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

    if -9.8000000000000003e177 < x < -6.9e-6

    1. Initial program 90.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num30.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac33.1%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num33.1%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac33.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \sqrt{\color{blue}{z \cdot z}} \]
      7. sqrt-unprod13.2%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt30.0%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr30.0%

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

    if -6.9e-6 < x < 3.09999999999999987e35

    1. Initial program 96.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr46.2%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt47.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr47.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in z around 0 41.1%

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

    if 3.09999999999999987e35 < x

    1. Initial program 83.2%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr52.9%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt53.3%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr53.3%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
      3. distribute-rgt-neg-in56.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
    8. Simplified56.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{+177}:\\ \;\;\;\;z \cdot \frac{x}{-y}\\ \mathbf{elif}\;x \leq -6.9 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+35}:\\ \;\;\;\;\frac{x + 4}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1 - z}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 62.1% accurate, 5.5× speedup?

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

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

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

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

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


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

    1. Initial program 86.5%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr33.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt33.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr33.9%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod80.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num34.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num40.5%

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

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

    if -6.70000000000000027e249 < x < -3.00000000000000016e178

    1. Initial program 25.0%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.2%

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

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

        \[\leadsto \color{blue}{\sqrt{-1 \cdot \frac{x \cdot z}{y}} \cdot \sqrt{-1 \cdot \frac{x \cdot z}{y}}} \]
      2. sqrt-unprod88.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
      8. clear-num26.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      10. clear-num50.3%

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    8. Applied egg-rr50.3%

      \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. associate-/r/26.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)} \cdot \left(-\frac{x \cdot z}{y}\right)} \]
      8. mul-1-neg88.1%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
      11. mul-1-neg14.8%

        \[\leadsto \color{blue}{-\frac{x \cdot z}{y}} \]
      12. div-inv14.8%

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

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

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

        \[\leadsto -z \cdot \color{blue}{\frac{x}{y}} \]
      16. distribute-lft-neg-in38.1%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{x}{y}} \]
    10. Applied egg-rr38.1%

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

    if -3.00000000000000016e178 < x < -7.50000000000000019e-6

    1. Initial program 90.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr50.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt50.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr50.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num30.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac33.1%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num33.1%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac33.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \sqrt{\color{blue}{z \cdot z}} \]
      7. sqrt-unprod13.2%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt30.0%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr30.0%

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

    if -7.50000000000000019e-6 < x

    1. Initial program 92.1%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt49.5%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative49.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in z around 0 41.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.7 \cdot 10^{+249}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{+178}:\\ \;\;\;\;z \cdot \frac{x}{-y}\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 31.1% accurate, 7.4× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 6.6 \cdot 10^{+18}\right):\\ \;\;\;\;x \cdot \frac{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 (or (<= z -0.17) (not (<= z 6.6e+18))) (* x (/ z y_m)) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if ((z <= -0.17) || !(z <= 6.6e+18)) {
		tmp = 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 ((z <= (-0.17d0)) .or. (.not. (z <= 6.6d+18))) then
        tmp = 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 ((z <= -0.17) || !(z <= 6.6e+18)) {
		tmp = 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 (z <= -0.17) or not (z <= 6.6e+18):
		tmp = 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 ((z <= -0.17) || !(z <= 6.6e+18))
		tmp = Float64(x * Float64(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 ((z <= -0.17) || ~((z <= 6.6e+18)))
		tmp = 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[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 6.6e+18]], $MachinePrecision]], N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 6.6 \cdot 10^{+18}\right):\\
\;\;\;\;x \cdot \frac{z}{y\_m}\\

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


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

    1. Initial program 83.6%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr47.9%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt48.5%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative48.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr48.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num33.8%

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

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

        \[\leadsto \frac{-1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      4. metadata-eval35.3%

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

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num35.3%

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

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr35.3%

      \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt20.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{z}}{\frac{y}{x}} \]
      6. associate-/r/36.4%

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

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

    if -0.170000000000000012 < z < 6.6e18

    1. Initial program 94.8%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr47.8%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt48.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr48.9%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
      3. distribute-rgt-neg-in26.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
    8. Simplified26.7%

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

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

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

Alternative 15: 62.1% accurate, 11.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \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 -8.5e-6) (* z (/ 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 <= -8.5e-6) {
		tmp = z * (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 <= (-8.5d-6)) then
        tmp = z * (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 <= -8.5e-6) {
		tmp = z * (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 <= -8.5e-6:
		tmp = z * (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 <= -8.5e-6)
		tmp = Float64(z * 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 <= -8.5e-6)
		tmp = z * (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, -8.5e-6], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-6}:\\
\;\;\;\;z \cdot \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 < -8.4999999999999999e-6

    1. Initial program 79.9%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr45.6%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt46.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr46.0%

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

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

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

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

        \[\leadsto \frac{-1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      4. metadata-eval37.5%

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac37.5%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num37.5%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac37.5%

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr37.5%

      \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. clear-num37.5%

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \sqrt{\color{blue}{z \cdot z}} \]
      7. sqrt-unprod16.8%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt35.8%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr35.8%

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

    if -8.4999999999999999e-6 < x

    1. Initial program 92.1%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr48.4%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt49.5%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative49.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    6. Taylor expanded in z around 0 41.2%

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

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

Alternative 16: 30.0% accurate, 11.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 2.4 \cdot 10^{-46}:\\ \;\;\;\;z \cdot \frac{x}{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 2.4e-46) (* z (/ x y_m)) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if (x <= 2.4e-46) {
		tmp = z * (x / 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 <= 2.4d-46) then
        tmp = z * (x / 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 <= 2.4e-46) {
		tmp = z * (x / y_m);
	} else {
		tmp = x / y_m;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if x <= 2.4e-46:
		tmp = z * (x / y_m)
	else:
		tmp = x / y_m
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if (x <= 2.4e-46)
		tmp = Float64(z * Float64(x / 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 <= 2.4e-46)
		tmp = z * (x / 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, 2.4e-46], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4 \cdot 10^{-46}:\\
\;\;\;\;z \cdot \frac{x}{y\_m}\\

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


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

    1. Initial program 90.9%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr45.1%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt46.2%

        \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
      4. *-commutative46.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr46.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{y}} \]
    7. Step-by-step derivation
      1. clear-num15.9%

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

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

        \[\leadsto \frac{-1}{\color{blue}{\frac{\frac{y}{x}}{z}}} \]
      4. metadata-eval17.5%

        \[\leadsto \frac{\color{blue}{-1}}{\frac{\frac{y}{x}}{z}} \]
      5. distribute-neg-frac17.5%

        \[\leadsto \color{blue}{-\frac{1}{\frac{\frac{y}{x}}{z}}} \]
      6. clear-num17.5%

        \[\leadsto -\color{blue}{\frac{z}{\frac{y}{x}}} \]
      7. distribute-neg-frac17.5%

        \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    8. Applied egg-rr17.5%

      \[\leadsto \color{blue}{\frac{-z}{\frac{y}{x}}} \]
    9. Step-by-step derivation
      1. clear-num17.5%

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      8. add-sqr-sqrt17.8%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{z} \]
    10. Applied egg-rr17.8%

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

    if 2.40000000000000013e-46 < x

    1. Initial program 86.4%

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
      2. fabs-sqr53.5%

        \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
      3. add-sqr-sqrt54.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
    5. Applied egg-rr54.1%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
      3. distribute-rgt-neg-in52.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
    8. Simplified52.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.4 \cdot 10^{-46}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 18.0% accurate, 37.0× speedup?

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

\\
\frac{x}{y\_m}
\end{array}
Derivation
  1. Initial program 89.5%

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

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

      \[\leadsto \left|\color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}}\right| \]
    2. fabs-sqr47.8%

      \[\leadsto \color{blue}{\sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \cdot \sqrt{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)}} \]
    3. add-sqr-sqrt48.7%

      \[\leadsto \color{blue}{\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)} \]
    4. *-commutative48.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, -4 - x\right) \cdot \frac{-1}{y}} \]
  5. Applied egg-rr48.7%

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

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

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

      \[\leadsto -\color{blue}{x \cdot \frac{z - 1}{y}} \]
    3. distribute-rgt-neg-in32.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{\color{blue}{1 - z}}{y} \]
  8. Simplified32.1%

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  10. Add Preprocessing

Reproduce

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