fabs fraction 1

Percentage Accurate: 91.3% → 99.6%
Time: 10.5s
Alternatives: 14
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 14 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.3% 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.6% accurate, 0.5× speedup?

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

    1. Initial program 92.3%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in y around 0 98.1%

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

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

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

    if 8e80 < y

    1. Initial program 96.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{+80}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\ \end{array} \]

Alternative 2: 69.0% accurate, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \left|\frac{x}{y_m}\right|\\ t_1 := \left|x \cdot \frac{z}{y_m}\right|\\ \mathbf{if}\;x \leq -1.9 \cdot 10^{+99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{-15}:\\ \;\;\;\;\left|\frac{4}{y_m}\right|\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+163}:\\ \;\;\;\;t_1\\ \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 y_m))) (t_1 (fabs (* x (/ z y_m)))))
   (if (<= x -1.9e+99)
     t_0
     (if (<= x -2.9e-24)
       t_1
       (if (<= x 5.3e-15) (fabs (/ 4.0 y_m)) (if (<= x 5.4e+163) t_1 t_0))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double t_0 = fabs((x / y_m));
	double t_1 = fabs((x * (z / y_m)));
	double tmp;
	if (x <= -1.9e+99) {
		tmp = t_0;
	} else if (x <= -2.9e-24) {
		tmp = t_1;
	} else if (x <= 5.3e-15) {
		tmp = fabs((4.0 / y_m));
	} else if (x <= 5.4e+163) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = abs((x / y_m))
    t_1 = abs((x * (z / y_m)))
    if (x <= (-1.9d+99)) then
        tmp = t_0
    else if (x <= (-2.9d-24)) then
        tmp = t_1
    else if (x <= 5.3d-15) then
        tmp = abs((4.0d0 / y_m))
    else if (x <= 5.4d+163) then
        tmp = t_1
    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 / y_m));
	double t_1 = Math.abs((x * (z / y_m)));
	double tmp;
	if (x <= -1.9e+99) {
		tmp = t_0;
	} else if (x <= -2.9e-24) {
		tmp = t_1;
	} else if (x <= 5.3e-15) {
		tmp = Math.abs((4.0 / y_m));
	} else if (x <= 5.4e+163) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	t_0 = math.fabs((x / y_m))
	t_1 = math.fabs((x * (z / y_m)))
	tmp = 0
	if x <= -1.9e+99:
		tmp = t_0
	elif x <= -2.9e-24:
		tmp = t_1
	elif x <= 5.3e-15:
		tmp = math.fabs((4.0 / y_m))
	elif x <= 5.4e+163:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	t_0 = abs(Float64(x / y_m))
	t_1 = abs(Float64(x * Float64(z / y_m)))
	tmp = 0.0
	if (x <= -1.9e+99)
		tmp = t_0;
	elseif (x <= -2.9e-24)
		tmp = t_1;
	elseif (x <= 5.3e-15)
		tmp = abs(Float64(4.0 / y_m));
	elseif (x <= 5.4e+163)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	t_0 = abs((x / y_m));
	t_1 = abs((x * (z / y_m)));
	tmp = 0.0;
	if (x <= -1.9e+99)
		tmp = t_0;
	elseif (x <= -2.9e-24)
		tmp = t_1;
	elseif (x <= 5.3e-15)
		tmp = abs((4.0 / y_m));
	elseif (x <= 5.4e+163)
		tmp = t_1;
	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 / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.9e+99], t$95$0, If[LessEqual[x, -2.9e-24], t$95$1, If[LessEqual[x, 5.3e-15], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.4e+163], t$95$1, t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \left|\frac{x}{y_m}\right|\\
t_1 := \left|x \cdot \frac{z}{y_m}\right|\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -2.9 \cdot 10^{-24}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.3 \cdot 10^{-15}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{+163}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.9e99 or 5.39999999999999998e163 < x

    1. Initial program 82.7%

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

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

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

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

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

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

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

    if -1.9e99 < x < -2.8999999999999999e-24 or 5.3000000000000001e-15 < x < 5.39999999999999998e163

    1. Initial program 97.0%

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

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

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

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

    if -2.8999999999999999e-24 < x < 5.3000000000000001e-15

    1. Initial program 96.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+99}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-24}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{-15}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+163}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 3: 68.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left|\frac{x}{y_m}\right|\\
t_1 := \left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{if}\;x \leq -5.7 \cdot 10^{+100}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5 \cdot 10^{-14}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\

\mathbf{elif}\;x \leq 6 \cdot 10^{+163}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.69999999999999984e100 or 6.00000000000000027e163 < x

    1. Initial program 82.7%

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

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

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

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

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

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

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

    if -5.69999999999999984e100 < x < -1.0600000000000001e-89 or 5.0000000000000002e-14 < x < 6.00000000000000027e163

    1. Initial program 97.4%

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

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

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}}\right| \]
    5. Step-by-step derivation
      1. associate-*l/62.2%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z}\right| \]
    6. Simplified62.2%

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

    if -1.0600000000000001e-89 < x < 5.0000000000000002e-14

    1. Initial program 96.5%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 84.0%

      \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{+100}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-14}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+163}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 4: 67.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left|\frac{x}{y_m}\right|\\
\mathbf{if}\;x \leq -8 \cdot 10^{+101}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\

\mathbf{elif}\;x \leq 10^{-11}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+163}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -7.9999999999999998e101 or 9.50000000000000053e163 < x

    1. Initial program 82.7%

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

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

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

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

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

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

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

    if -7.9999999999999998e101 < x < -1.0600000000000001e-89

    1. Initial program 95.7%

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

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

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}}\right| \]
    5. Step-by-step derivation
      1. associate-*l/64.7%

        \[\leadsto \left|\color{blue}{\frac{x}{y} \cdot z}\right| \]
    6. Simplified64.7%

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

    if -1.0600000000000001e-89 < x < 9.99999999999999939e-12

    1. Initial program 96.5%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 84.0%

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

    if 9.99999999999999939e-12 < x < 9.50000000000000053e163

    1. Initial program 99.9%

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

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right| \]
    3. Step-by-step derivation
      1. associate-*r/47.4%

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

        \[\leadsto \left|\frac{\color{blue}{-x \cdot z}}{y}\right| \]
      3. distribute-rgt-neg-in47.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x \cdot \color{blue}{\frac{z}{y}}\right| \]
      8. associate-*r/47.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+101}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 10^{-11}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+163}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 5: 67.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left|\frac{x}{y_m}\right|\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\
\;\;\;\;\left|\frac{z}{\frac{y_m}{x}}\right|\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{-12}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+163}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3.8999999999999998e102 or 6.4999999999999998e163 < x

    1. Initial program 82.7%

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

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

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

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

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

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

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

    if -3.8999999999999998e102 < x < -1.0600000000000001e-89

    1. Initial program 95.7%

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

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right| \]
    3. Step-by-step derivation
      1. associate-*r/58.9%

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

        \[\leadsto \left|\frac{\color{blue}{-x \cdot z}}{y}\right| \]
      3. distribute-rgt-neg-in58.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x \cdot \color{blue}{\frac{z}{y}}\right| \]
      8. associate-*r/58.9%

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

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

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

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

    if -1.0600000000000001e-89 < x < 1.3499999999999999e-12

    1. Initial program 96.5%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 84.0%

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

    if 1.3499999999999999e-12 < x < 6.4999999999999998e163

    1. Initial program 99.9%

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

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right| \]
    3. Step-by-step derivation
      1. associate-*r/47.4%

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

        \[\leadsto \left|\frac{\color{blue}{-x \cdot z}}{y}\right| \]
      3. distribute-rgt-neg-in47.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x \cdot \color{blue}{\frac{z}{y}}\right| \]
      8. associate-*r/47.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+102}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-89}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-12}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+163}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 6: 97.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 9.5 \cdot 10^{+144}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y_m}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9.50000000000000031e144

    1. Initial program 92.3%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in y around 0 98.2%

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

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

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

    if 9.50000000000000031e144 < y

    1. Initial program 97.4%

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

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

Alternative 7: 99.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.99999999999999969e81

    1. Initial program 92.3%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in y around 0 98.1%

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

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

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

    if 3.99999999999999969e81 < y

    1. Initial program 96.3%

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

      \[\leadsto \color{blue}{\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|} \]
    3. Step-by-step derivation
      1. div-inv99.8%

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

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

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

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

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

Alternative 8: 99.8% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1e47

    1. Initial program 92.1%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in y around 0 98.0%

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

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

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

    if 1e47 < y

    1. Initial program 96.6%

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

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

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

Alternative 9: 87.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.15 \cdot 10^{-24} \lor \neg \left(x \leq 1.6 \cdot 10^{-14}\right):\\
\;\;\;\;\left|x \cdot \frac{z + -1}{y_m}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.1499999999999999e-24 or 1.6000000000000001e-14 < x

    1. Initial program 89.8%

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

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

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

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

    if -3.1499999999999999e-24 < x < 1.6000000000000001e-14

    1. Initial program 96.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.15 \cdot 10^{-24} \lor \neg \left(x \leq 1.6 \cdot 10^{-14}\right):\\ \;\;\;\;\left|x \cdot \frac{z + -1}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \end{array} \]

Alternative 10: 87.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-24} \lor \neg \left(x \leq 4.2 \cdot 10^{-16}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1999999999999999e-24 or 4.2000000000000002e-16 < x

    1. Initial program 89.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in y around 0 94.4%

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

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

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot \left(1 - z\right)}{y}}\right| \]
    6. Step-by-step derivation
      1. associate-/l*97.4%

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

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

    if -1.1999999999999999e-24 < x < 4.2000000000000002e-16

    1. Initial program 96.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{-24} \lor \neg \left(x \leq 4.2 \cdot 10^{-16}\right):\\ \;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \end{array} \]

Alternative 11: 85.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+17}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+33}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y_m}{x}}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.1e17

    1. Initial program 98.2%

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

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

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot z}{y}}\right| \]
    5. Step-by-step derivation
      1. associate-*l/80.9%

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

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

    if -1.1e17 < z < 1.8000000000000001e33

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

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

    if 1.8000000000000001e33 < z

    1. Initial program 80.3%

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

      \[\leadsto \left|\color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right| \]
    3. Step-by-step derivation
      1. associate-*r/71.1%

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

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

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

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

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

        \[\leadsto \left|x \cdot \color{blue}{\left(\sqrt{\frac{-z}{y}} \cdot \sqrt{\frac{-z}{y}}\right)}\right| \]
      2. sqrt-unprod57.6%

        \[\leadsto \left|x \cdot \color{blue}{\sqrt{\frac{-z}{y} \cdot \frac{-z}{y}}}\right| \]
      3. distribute-frac-neg57.6%

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

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

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

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

        \[\leadsto \left|x \cdot \color{blue}{\frac{z}{y}}\right| \]
      8. associate-*r/71.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+17}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+33}:\\ \;\;\;\;\left|\frac{-4 - x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 12: 96.3% 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 93.0%

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Taylor expanded in y around 0 96.9%

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

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

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

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

Alternative 13: 68.7% accurate, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{x}{y_m}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y_m}\right|\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z)
 :precision binary64
 (if (or (<= x -1.5) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
	double tmp;
	if ((x <= -1.5) || !(x <= 4.0)) {
		tmp = fabs((x / y_m));
	} else {
		tmp = fabs((4.0 / y_m));
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-1.5d0)) .or. (.not. (x <= 4.0d0))) then
        tmp = abs((x / y_m))
    else
        tmp = abs((4.0d0 / y_m))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
	double tmp;
	if ((x <= -1.5) || !(x <= 4.0)) {
		tmp = Math.abs((x / y_m));
	} else {
		tmp = Math.abs((4.0 / y_m));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z):
	tmp = 0
	if (x <= -1.5) or not (x <= 4.0):
		tmp = math.fabs((x / y_m))
	else:
		tmp = math.fabs((4.0 / y_m))
	return tmp
y_m = abs(y)
function code(x, y_m, z)
	tmp = 0.0
	if ((x <= -1.5) || !(x <= 4.0))
		tmp = abs(Float64(x / y_m));
	else
		tmp = abs(Float64(4.0 / y_m));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z)
	tmp = 0.0;
	if ((x <= -1.5) || ~((x <= 4.0)))
		tmp = abs((x / y_m));
	else
		tmp = abs((4.0 / y_m));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -1.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\


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

    1. Initial program 89.2%

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

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

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

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

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

        \[\leadsto \left|\frac{\color{blue}{-x}}{y}\right| \]
    6. Simplified63.2%

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

    if -1.5 < x < 4

    1. Initial program 97.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Taylor expanded in x around 0 76.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \end{array} \]

Alternative 14: 40.1% accurate, 1.1× speedup?

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

\\
\left|\frac{4}{y_m}\right|
\end{array}
Derivation
  1. Initial program 93.0%

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Taylor expanded in x around 0 40.0%

    \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
  3. Final simplification40.0%

    \[\leadsto \left|\frac{4}{y}\right| \]

Reproduce

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