fabs fraction 1

Percentage Accurate: 91.7% → 99.9%
Time: 7.2s
Alternatives: 11
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 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 91.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.5× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{-16}:\\ \;\;\;\;\left|\frac{x \cdot z - \left(x + 4\right)}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (<= y 4e-16)
   (fabs (/ (- (* x z) (+ x 4.0)) y))
   (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 4e-16) {
		tmp = fabs((((x * z) - (x + 4.0)) / y));
	} else {
		tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
	}
	return tmp;
}
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if (y <= 4e-16)
		tmp = abs(Float64(Float64(Float64(x * z) - Float64(x + 4.0)) / y));
	else
		tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y)));
	end
	return tmp
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[LessEqual[y, 4e-16], N[Abs[N[(N[(N[(x * z), $MachinePrecision] - N[(x + 4.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-16}:\\
\;\;\;\;\left|\frac{x \cdot z - \left(x + 4\right)}{y}\right|\\

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9999999999999999e-16 < y

    1. Initial program 93.0%

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

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

Alternative 2: 67.6% accurate, 0.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ t_1 := \left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.95 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-10}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+107}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+127} \lor \neg \left(x \leq 6.2 \cdot 10^{+178}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fabs (/ x y))) (t_1 (fabs (/ x (/ y z)))))
   (if (<= x -1.35e+32)
     t_0
     (if (<= x -1.95e-94)
       t_1
       (if (<= x 1.35e-10)
         (fabs (/ 4.0 y))
         (if (<= x 3.3e+107)
           (fabs (* z (/ x y)))
           (if (or (<= x 3.4e+127) (not (<= x 6.2e+178))) t_0 t_1)))))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((x / y));
	double t_1 = fabs((x / (y / z)));
	double tmp;
	if (x <= -1.35e+32) {
		tmp = t_0;
	} else if (x <= -1.95e-94) {
		tmp = t_1;
	} else if (x <= 1.35e-10) {
		tmp = fabs((4.0 / y));
	} else if (x <= 3.3e+107) {
		tmp = fabs((z * (x / y)));
	} else if ((x <= 3.4e+127) || !(x <= 6.2e+178)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = abs((x / y))
    t_1 = abs((x / (y / z)))
    if (x <= (-1.35d+32)) then
        tmp = t_0
    else if (x <= (-1.95d-94)) then
        tmp = t_1
    else if (x <= 1.35d-10) then
        tmp = abs((4.0d0 / y))
    else if (x <= 3.3d+107) then
        tmp = abs((z * (x / y)))
    else if ((x <= 3.4d+127) .or. (.not. (x <= 6.2d+178))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double t_0 = Math.abs((x / y));
	double t_1 = Math.abs((x / (y / z)));
	double tmp;
	if (x <= -1.35e+32) {
		tmp = t_0;
	} else if (x <= -1.95e-94) {
		tmp = t_1;
	} else if (x <= 1.35e-10) {
		tmp = Math.abs((4.0 / y));
	} else if (x <= 3.3e+107) {
		tmp = Math.abs((z * (x / y)));
	} else if ((x <= 3.4e+127) || !(x <= 6.2e+178)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	t_0 = math.fabs((x / y))
	t_1 = math.fabs((x / (y / z)))
	tmp = 0
	if x <= -1.35e+32:
		tmp = t_0
	elif x <= -1.95e-94:
		tmp = t_1
	elif x <= 1.35e-10:
		tmp = math.fabs((4.0 / y))
	elif x <= 3.3e+107:
		tmp = math.fabs((z * (x / y)))
	elif (x <= 3.4e+127) or not (x <= 6.2e+178):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
y = abs(y)
function code(x, y, z)
	t_0 = abs(Float64(x / y))
	t_1 = abs(Float64(x / Float64(y / z)))
	tmp = 0.0
	if (x <= -1.35e+32)
		tmp = t_0;
	elseif (x <= -1.95e-94)
		tmp = t_1;
	elseif (x <= 1.35e-10)
		tmp = abs(Float64(4.0 / y));
	elseif (x <= 3.3e+107)
		tmp = abs(Float64(z * Float64(x / y)));
	elseif ((x <= 3.4e+127) || !(x <= 6.2e+178))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	t_0 = abs((x / y));
	t_1 = abs((x / (y / z)));
	tmp = 0.0;
	if (x <= -1.35e+32)
		tmp = t_0;
	elseif (x <= -1.95e-94)
		tmp = t_1;
	elseif (x <= 1.35e-10)
		tmp = abs((4.0 / y));
	elseif (x <= 3.3e+107)
		tmp = abs((z * (x / y)));
	elseif ((x <= 3.4e+127) || ~((x <= 6.2e+178)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.35e+32], t$95$0, If[LessEqual[x, -1.95e-94], t$95$1, If[LessEqual[x, 1.35e-10], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.3e+107], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 3.4e+127], N[Not[LessEqual[x, 6.2e+178]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+32}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.95 \cdot 10^{-94}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+107}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\

\mathbf{elif}\;x \leq 3.4 \cdot 10^{+127} \lor \neg \left(x \leq 6.2 \cdot 10^{+178}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.35000000000000006e32 or 3.30000000000000032e107 < x < 3.39999999999999977e127 or 6.19999999999999982e178 < x

    1. Initial program 91.6%

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

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

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

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

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

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

        \[\leadsto \left|\frac{\color{blue}{4}}{y} + \frac{x}{y}\right| \]
    6. Simplified74.0%

      \[\leadsto \left|\color{blue}{\frac{4}{y} + \frac{x}{y}}\right| \]
    7. Taylor expanded in x around inf 74.0%

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

    if -1.35000000000000006e32 < x < -1.9500000000000001e-94 or 3.39999999999999977e127 < x < 6.19999999999999982e178

    1. Initial program 91.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{z \cdot \left(-x\right)}{y}}\right| \]
    7. Step-by-step derivation
      1. expm1-log1p-u48.5%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef22.9%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*22.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt5.4%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod7.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg7.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod4.5%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt20.7%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr20.7%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def36.8%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p57.9%

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    10. Simplified67.3%

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

    if -1.9500000000000001e-94 < x < 1.35e-10

    1. Initial program 93.5%

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

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

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

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

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

    if 1.35e-10 < x < 3.30000000000000032e107

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{z \cdot \left(-x\right)}{y}}\right| \]
    7. Step-by-step derivation
      1. expm1-log1p-u23.3%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef16.0%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*16.0%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod37.7%

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

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod37.7%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt37.7%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr37.7%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def45.0%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p61.5%

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

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

        \[\leadsto \left|\color{blue}{z \cdot \frac{x}{y}}\right| \]
    10. Simplified61.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+32}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq -1.95 \cdot 10^{-94}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-10}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+107}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+127} \lor \neg \left(x \leq 6.2 \cdot 10^{+178}\right):\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \end{array} \]

Alternative 3: 69.2% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ \mathbf{if}\;x \leq -1.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-10}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+107} \lor \neg \left(x \leq 2.15 \cdot 10^{+130}\right) \land x \leq 5.2 \cdot 10^{+188}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fabs (/ x y))))
   (if (<= x -1.5)
     t_0
     (if (<= x 1.4e-10)
       (fabs (/ 4.0 y))
       (if (or (<= x 4.6e+107) (and (not (<= x 2.15e+130)) (<= x 5.2e+188)))
         (fabs (* z (/ x y)))
         t_0)))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((x / y));
	double tmp;
	if (x <= -1.5) {
		tmp = t_0;
	} else if (x <= 1.4e-10) {
		tmp = fabs((4.0 / y));
	} else if ((x <= 4.6e+107) || (!(x <= 2.15e+130) && (x <= 5.2e+188))) {
		tmp = fabs((z * (x / y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = abs((x / y))
    if (x <= (-1.5d0)) then
        tmp = t_0
    else if (x <= 1.4d-10) then
        tmp = abs((4.0d0 / y))
    else if ((x <= 4.6d+107) .or. (.not. (x <= 2.15d+130)) .and. (x <= 5.2d+188)) then
        tmp = abs((z * (x / y)))
    else
        tmp = t_0
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double t_0 = Math.abs((x / y));
	double tmp;
	if (x <= -1.5) {
		tmp = t_0;
	} else if (x <= 1.4e-10) {
		tmp = Math.abs((4.0 / y));
	} else if ((x <= 4.6e+107) || (!(x <= 2.15e+130) && (x <= 5.2e+188))) {
		tmp = Math.abs((z * (x / y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	t_0 = math.fabs((x / y))
	tmp = 0
	if x <= -1.5:
		tmp = t_0
	elif x <= 1.4e-10:
		tmp = math.fabs((4.0 / y))
	elif (x <= 4.6e+107) or (not (x <= 2.15e+130) and (x <= 5.2e+188)):
		tmp = math.fabs((z * (x / y)))
	else:
		tmp = t_0
	return tmp
y = abs(y)
function code(x, y, z)
	t_0 = abs(Float64(x / y))
	tmp = 0.0
	if (x <= -1.5)
		tmp = t_0;
	elseif (x <= 1.4e-10)
		tmp = abs(Float64(4.0 / y));
	elseif ((x <= 4.6e+107) || (!(x <= 2.15e+130) && (x <= 5.2e+188)))
		tmp = abs(Float64(z * Float64(x / y)));
	else
		tmp = t_0;
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	t_0 = abs((x / y));
	tmp = 0.0;
	if (x <= -1.5)
		tmp = t_0;
	elseif (x <= 1.4e-10)
		tmp = abs((4.0 / y));
	elseif ((x <= 4.6e+107) || (~((x <= 2.15e+130)) && (x <= 5.2e+188)))
		tmp = abs((z * (x / y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.5], t$95$0, If[LessEqual[x, 1.4e-10], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 4.6e+107], And[N[Not[LessEqual[x, 2.15e+130]], $MachinePrecision], LessEqual[x, 5.2e+188]]], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.5:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-10}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\

\mathbf{elif}\;x \leq 4.6 \cdot 10^{+107} \lor \neg \left(x \leq 2.15 \cdot 10^{+130}\right) \land x \leq 5.2 \cdot 10^{+188}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.5 or 4.6000000000000001e107 < x < 2.14999999999999992e130 or 5.19999999999999975e188 < x

    1. Initial program 91.7%

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{4}{y} + \frac{x}{y}}\right| \]
    7. Taylor expanded in x around inf 72.2%

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

    if -1.5 < x < 1.40000000000000008e-10

    1. Initial program 92.8%

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

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

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

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

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

    if 1.40000000000000008e-10 < x < 4.6000000000000001e107 or 2.14999999999999992e130 < x < 5.19999999999999975e188

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{z \cdot \left(-x\right)}{y}}\right| \]
    7. Step-by-step derivation
      1. expm1-log1p-u39.8%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef32.2%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*34.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod26.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg26.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod29.4%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt29.4%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr29.4%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def37.0%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p72.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-10}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+107} \lor \neg \left(x \leq 2.15 \cdot 10^{+130}\right) \land x \leq 5.2 \cdot 10^{+188}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 4: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+59}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-15}:\\ \;\;\;\;\left|\frac{x + 4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|x \cdot \left(\frac{z}{y} + \frac{-1}{y}\right)\right|\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (<= z -2.5e+59)
   (fabs (/ x (/ y z)))
   (if (<= z 6.5e-15)
     (fabs (/ (+ x 4.0) y))
     (fabs (* x (+ (/ z y) (/ -1.0 y)))))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.5e+59) {
		tmp = fabs((x / (y / z)));
	} else if (z <= 6.5e-15) {
		tmp = fabs(((x + 4.0) / y));
	} else {
		tmp = fabs((x * ((z / y) + (-1.0 / y))));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-2.5d+59)) then
        tmp = abs((x / (y / z)))
    else if (z <= 6.5d-15) then
        tmp = abs(((x + 4.0d0) / y))
    else
        tmp = abs((x * ((z / y) + ((-1.0d0) / y))))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.5e+59) {
		tmp = Math.abs((x / (y / z)));
	} else if (z <= 6.5e-15) {
		tmp = Math.abs(((x + 4.0) / y));
	} else {
		tmp = Math.abs((x * ((z / y) + (-1.0 / y))));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	tmp = 0
	if z <= -2.5e+59:
		tmp = math.fabs((x / (y / z)))
	elif z <= 6.5e-15:
		tmp = math.fabs(((x + 4.0) / y))
	else:
		tmp = math.fabs((x * ((z / y) + (-1.0 / y))))
	return tmp
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if (z <= -2.5e+59)
		tmp = abs(Float64(x / Float64(y / z)));
	elseif (z <= 6.5e-15)
		tmp = abs(Float64(Float64(x + 4.0) / y));
	else
		tmp = abs(Float64(x * Float64(Float64(z / y) + Float64(-1.0 / y))));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -2.5e+59)
		tmp = abs((x / (y / z)));
	elseif (z <= 6.5e-15)
		tmp = abs(((x + 4.0) / y));
	else
		tmp = abs((x * ((z / y) + (-1.0 / y))));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[LessEqual[z, -2.5e+59], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 6.5e-15], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(z / y), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+59}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-15}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\

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


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef26.0%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*29.5%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt14.2%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod16.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt32.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr32.8%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def47.1%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p76.4%

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    10. Simplified78.1%

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

    if -2.4999999999999999e59 < z < 6.49999999999999991e-15

    1. Initial program 95.9%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{y} + 4 \cdot \frac{1}{y}}\right| \]
      2. *-rgt-identity98.0%

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

        \[\leadsto \left|\color{blue}{x \cdot \frac{1}{y}} + 4 \cdot \frac{1}{y}\right| \]
      4. distribute-rgt-in97.9%

        \[\leadsto \left|\color{blue}{\frac{1}{y} \cdot \left(x + 4\right)}\right| \]
      5. associate-*l/98.1%

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

        \[\leadsto \left|\frac{\color{blue}{x + 4}}{y}\right| \]
    6. Simplified98.1%

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

    if 6.49999999999999991e-15 < z

    1. Initial program 82.7%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Simplified91.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 81.9%

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

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

Alternative 5: 99.8% accurate, 1.0× speedup?

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.2000000000000002e-16 < y

    1. Initial program 93.0%

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

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

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

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

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

Alternative 6: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+58}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-15}:\\ \;\;\;\;\left|\frac{x + 4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.2e+58)
   (fabs (/ x (/ y z)))
   (if (<= z 6.5e-15) (fabs (/ (+ x 4.0) y)) (fabs (/ x (/ y (- 1.0 z)))))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.2e+58) {
		tmp = fabs((x / (y / z)));
	} else if (z <= 6.5e-15) {
		tmp = fabs(((x + 4.0) / y));
	} else {
		tmp = fabs((x / (y / (1.0 - z))));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1.2d+58)) then
        tmp = abs((x / (y / z)))
    else if (z <= 6.5d-15) then
        tmp = abs(((x + 4.0d0) / y))
    else
        tmp = abs((x / (y / (1.0d0 - z))))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.2e+58) {
		tmp = Math.abs((x / (y / z)));
	} else if (z <= 6.5e-15) {
		tmp = Math.abs(((x + 4.0) / y));
	} else {
		tmp = Math.abs((x / (y / (1.0 - z))));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	tmp = 0
	if z <= -1.2e+58:
		tmp = math.fabs((x / (y / z)))
	elif z <= 6.5e-15:
		tmp = math.fabs(((x + 4.0) / y))
	else:
		tmp = math.fabs((x / (y / (1.0 - z))))
	return tmp
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.2e+58)
		tmp = abs(Float64(x / Float64(y / z)));
	elseif (z <= 6.5e-15)
		tmp = abs(Float64(Float64(x + 4.0) / y));
	else
		tmp = abs(Float64(x / Float64(y / Float64(1.0 - z))));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.2e+58)
		tmp = abs((x / (y / z)));
	elseif (z <= 6.5e-15)
		tmp = abs(((x + 4.0) / y));
	else
		tmp = abs((x / (y / (1.0 - z))));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[LessEqual[z, -1.2e+58], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 6.5e-15], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+58}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-15}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef26.0%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*29.5%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt14.2%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod16.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt32.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr32.8%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def47.1%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p76.4%

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    10. Simplified78.1%

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

    if -1.2e58 < z < 6.49999999999999991e-15

    1. Initial program 95.9%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{y} + 4 \cdot \frac{1}{y}}\right| \]
      2. *-rgt-identity98.0%

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

        \[\leadsto \left|\color{blue}{x \cdot \frac{1}{y}} + 4 \cdot \frac{1}{y}\right| \]
      4. distribute-rgt-in97.9%

        \[\leadsto \left|\color{blue}{\frac{1}{y} \cdot \left(x + 4\right)}\right| \]
      5. associate-*l/98.1%

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

        \[\leadsto \left|\frac{\color{blue}{x + 4}}{y}\right| \]
    6. Simplified98.1%

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

    if 6.49999999999999991e-15 < z

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+58}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-15}:\\ \;\;\;\;\left|\frac{x + 4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\ \end{array} \]

Alternative 7: 97.7% accurate, 1.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\


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

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3999999999999999e95 < x

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.9% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+57} \lor \neg \left(z \leq 10^{+21}\right):\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y}\right|\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -6.6e+57) (not (<= z 1e+21)))
   (fabs (/ x (/ y z)))
   (fabs (/ (+ x 4.0) y))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -6.6e+57) || !(z <= 1e+21)) {
		tmp = fabs((x / (y / z)));
	} else {
		tmp = fabs(((x + 4.0) / y));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-6.6d+57)) .or. (.not. (z <= 1d+21))) then
        tmp = abs((x / (y / z)))
    else
        tmp = abs(((x + 4.0d0) / y))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -6.6e+57) || !(z <= 1e+21)) {
		tmp = Math.abs((x / (y / z)));
	} else {
		tmp = Math.abs(((x + 4.0) / y));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	tmp = 0
	if (z <= -6.6e+57) or not (z <= 1e+21):
		tmp = math.fabs((x / (y / z)))
	else:
		tmp = math.fabs(((x + 4.0) / y))
	return tmp
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if ((z <= -6.6e+57) || !(z <= 1e+21))
		tmp = abs(Float64(x / Float64(y / z)));
	else
		tmp = abs(Float64(Float64(x + 4.0) / y));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -6.6e+57) || ~((z <= 1e+21)))
		tmp = abs((x / (y / z)));
	else
		tmp = abs(((x + 4.0) / y));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[Or[LessEqual[z, -6.6e+57], N[Not[LessEqual[z, 1e+21]], $MachinePrecision]], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+57} \lor \neg \left(z \leq 10^{+21}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.6000000000000002e57 or 1e21 < z

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{z \cdot \left(-x\right)}{y}}\right| \]
    7. Step-by-step derivation
      1. expm1-log1p-u47.3%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef26.4%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*28.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt14.4%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod21.7%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg21.7%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod15.2%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt34.2%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr34.2%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def45.1%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p74.2%

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

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

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

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

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

    if -6.6000000000000002e57 < z < 1e21

    1. Initial program 96.2%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{y} + 4 \cdot \frac{1}{y}}\right| \]
      2. *-rgt-identity95.0%

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

        \[\leadsto \left|\color{blue}{x \cdot \frac{1}{y}} + 4 \cdot \frac{1}{y}\right| \]
      4. distribute-rgt-in94.8%

        \[\leadsto \left|\color{blue}{\frac{1}{y} \cdot \left(x + 4\right)}\right| \]
      5. associate-*l/95.0%

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

        \[\leadsto \left|\frac{\color{blue}{x + 4}}{y}\right| \]
    6. Simplified95.0%

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

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

Alternative 9: 85.9% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+57}:\\ \;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+20}:\\ \;\;\;\;\left|\frac{x + 4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (<= z -5.8e+57)
   (fabs (/ x (/ y z)))
   (if (<= z 9.5e+20) (fabs (/ (+ x 4.0) y)) (fabs (* x (/ z y))))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.8e+57) {
		tmp = fabs((x / (y / z)));
	} else if (z <= 9.5e+20) {
		tmp = fabs(((x + 4.0) / y));
	} else {
		tmp = fabs((x * (z / y)));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-5.8d+57)) then
        tmp = abs((x / (y / z)))
    else if (z <= 9.5d+20) then
        tmp = abs(((x + 4.0d0) / y))
    else
        tmp = abs((x * (z / y)))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.8e+57) {
		tmp = Math.abs((x / (y / z)));
	} else if (z <= 9.5e+20) {
		tmp = Math.abs(((x + 4.0) / y));
	} else {
		tmp = Math.abs((x * (z / y)));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	tmp = 0
	if z <= -5.8e+57:
		tmp = math.fabs((x / (y / z)))
	elif z <= 9.5e+20:
		tmp = math.fabs(((x + 4.0) / y))
	else:
		tmp = math.fabs((x * (z / y)))
	return tmp
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if (z <= -5.8e+57)
		tmp = abs(Float64(x / Float64(y / z)));
	elseif (z <= 9.5e+20)
		tmp = abs(Float64(Float64(x + 4.0) / y));
	else
		tmp = abs(Float64(x * Float64(z / y)));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -5.8e+57)
		tmp = abs((x / (y / z)));
	elseif (z <= 9.5e+20)
		tmp = abs(((x + 4.0) / y));
	else
		tmp = abs((x * (z / y)));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[LessEqual[z, -5.8e+57], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 9.5e+20], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+57}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+20}:\\
\;\;\;\;\left|\frac{x + 4}{y}\right|\\

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


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)\right)}\right| \]
      2. expm1-udef26.0%

        \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z \cdot \left(-x\right)}{y}\right)} - 1}\right| \]
      3. associate-/l*29.5%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\color{blue}{\frac{z}{\frac{y}{-x}}}\right)} - 1\right| \]
      4. add-sqr-sqrt14.2%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}\right)} - 1\right| \]
      5. sqrt-unprod23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}\right)} - 1\right| \]
      6. sqr-neg23.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\sqrt{\color{blue}{x \cdot x}}}}\right)} - 1\right| \]
      7. sqrt-unprod16.9%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right)} - 1\right| \]
      8. add-sqr-sqrt32.8%

        \[\leadsto \left|e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{\color{blue}{x}}}\right)} - 1\right| \]
    8. Applied egg-rr32.8%

      \[\leadsto \left|\color{blue}{e^{\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)} - 1}\right| \]
    9. Step-by-step derivation
      1. expm1-def47.1%

        \[\leadsto \left|\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{z}{\frac{y}{x}}\right)\right)}\right| \]
      2. expm1-log1p76.4%

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{\frac{y}{z}}}\right| \]
    10. Simplified78.1%

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

    if -5.8000000000000003e57 < z < 9.5e20

    1. Initial program 96.2%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{x}{y} + 4 \cdot \frac{1}{y}}\right| \]
      2. *-rgt-identity95.0%

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

        \[\leadsto \left|\color{blue}{x \cdot \frac{1}{y}} + 4 \cdot \frac{1}{y}\right| \]
      4. distribute-rgt-in94.8%

        \[\leadsto \left|\color{blue}{\frac{1}{y} \cdot \left(x + 4\right)}\right| \]
      5. associate-*l/95.0%

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

        \[\leadsto \left|\frac{\color{blue}{x + 4}}{y}\right| \]
    6. Simplified95.0%

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

    if 9.5e20 < z

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 68.5% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \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} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.5) || !(x <= 4.0)) {
		tmp = fabs((x / y));
	} else {
		tmp = fabs((4.0 / y));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-1.5d0)) .or. (.not. (x <= 4.0d0))) then
        tmp = abs((x / y))
    else
        tmp = abs((4.0d0 / y))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.5) || !(x <= 4.0)) {
		tmp = Math.abs((x / y));
	} else {
		tmp = Math.abs((4.0 / y));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	tmp = 0
	if (x <= -1.5) or not (x <= 4.0):
		tmp = math.fabs((x / y))
	else:
		tmp = math.fabs((4.0 / y))
	return tmp
y = abs(y)
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.5) || !(x <= 4.0))
		tmp = abs(Float64(x / y));
	else
		tmp = abs(Float64(4.0 / y));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.5) || ~((x <= 4.0)))
		tmp = abs((x / y));
	else
		tmp = abs((4.0 / y));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := If[Or[LessEqual[x, -1.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.5 or 4 < x

    1. Initial program 92.1%

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{4}{y} + \frac{x}{y}}\right| \]
    7. Taylor expanded in x around inf 64.0%

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

    if -1.5 < x < 4

    1. Initial program 92.9%

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.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 11: 40.2% accurate, 1.1× speedup?

\[\begin{array}{l} y = |y|\\ \\ \left|\frac{4}{y}\right| \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
y = abs(y);
double code(double x, double y, double z) {
	return fabs((4.0 / y));
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = abs((4.0d0 / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
	return Math.abs((4.0 / y));
}
y = abs(y)
def code(x, y, z):
	return math.fabs((4.0 / y))
y = abs(y)
function code(x, y, z)
	return abs(Float64(4.0 / y))
end
y = abs(y)
function tmp = code(x, y, z)
	tmp = abs((4.0 / y));
end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{4}{y}\right|
\end{array}
Derivation
  1. Initial program 92.5%

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

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

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

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

    \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
  5. Final simplification39.2%

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

Reproduce

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