fabs fraction 1

Percentage Accurate: 91.0% → 99.4%
Time: 8.0s
Alternatives: 13
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 13 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.0% 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.4% accurate, 0.5× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-82}:\\ \;\;\;\;\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} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z)
 :precision binary64
 (if (<= y 8e-82)
   (fabs (/ (- (+ x 4.0) (* x z)) 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 <= 8e-82) {
		tmp = fabs((((x + 4.0) - (x * z)) / 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 <= 8e-82)
		tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / 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, 8e-82], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $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 8 \cdot 10^{-82}:\\
\;\;\;\;\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8e-82

    1. Initial program 88.5%

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

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

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

    if 8e-82 < y

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-82}:\\ \;\;\;\;\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: 67.4% accurate, 0.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|z \cdot \frac{x}{y}\right|\\ t_1 := \left|\frac{x}{y}\right|\\ t_2 := \left|\frac{4}{y}\right|\\ \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+163}:\\ \;\;\;\;t_1\\ \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 (* z (/ x y)))) (t_1 (fabs (/ x y))) (t_2 (fabs (/ 4.0 y))))
   (if (<= x -10.5)
     t_1
     (if (<= x 6.5e-90)
       t_2
       (if (<= x 3.25e-37)
         t_0
         (if (<= x 4.0)
           t_2
           (if (<= x 9.5e+48)
             t_1
             (if (<= x 9e+81)
               (fabs (* x (/ z y)))
               (if (<= x 1.5e+163) t_1 t_0)))))))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((z * (x / y)));
	double t_1 = fabs((x / y));
	double t_2 = fabs((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_1;
	} else if (x <= 6.5e-90) {
		tmp = t_2;
	} else if (x <= 3.25e-37) {
		tmp = t_0;
	} else if (x <= 4.0) {
		tmp = t_2;
	} else if (x <= 9.5e+48) {
		tmp = t_1;
	} else if (x <= 9e+81) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 1.5e+163) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = abs((z * (x / y)))
    t_1 = abs((x / y))
    t_2 = abs((4.0d0 / y))
    if (x <= (-10.5d0)) then
        tmp = t_1
    else if (x <= 6.5d-90) then
        tmp = t_2
    else if (x <= 3.25d-37) then
        tmp = t_0
    else if (x <= 4.0d0) then
        tmp = t_2
    else if (x <= 9.5d+48) then
        tmp = t_1
    else if (x <= 9d+81) then
        tmp = abs((x * (z / y)))
    else if (x <= 1.5d+163) then
        tmp = t_1
    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((z * (x / y)));
	double t_1 = Math.abs((x / y));
	double t_2 = Math.abs((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_1;
	} else if (x <= 6.5e-90) {
		tmp = t_2;
	} else if (x <= 3.25e-37) {
		tmp = t_0;
	} else if (x <= 4.0) {
		tmp = t_2;
	} else if (x <= 9.5e+48) {
		tmp = t_1;
	} else if (x <= 9e+81) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 1.5e+163) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	t_0 = math.fabs((z * (x / y)))
	t_1 = math.fabs((x / y))
	t_2 = math.fabs((4.0 / y))
	tmp = 0
	if x <= -10.5:
		tmp = t_1
	elif x <= 6.5e-90:
		tmp = t_2
	elif x <= 3.25e-37:
		tmp = t_0
	elif x <= 4.0:
		tmp = t_2
	elif x <= 9.5e+48:
		tmp = t_1
	elif x <= 9e+81:
		tmp = math.fabs((x * (z / y)))
	elif x <= 1.5e+163:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
y = abs(y)
function code(x, y, z)
	t_0 = abs(Float64(z * Float64(x / y)))
	t_1 = abs(Float64(x / y))
	t_2 = abs(Float64(4.0 / y))
	tmp = 0.0
	if (x <= -10.5)
		tmp = t_1;
	elseif (x <= 6.5e-90)
		tmp = t_2;
	elseif (x <= 3.25e-37)
		tmp = t_0;
	elseif (x <= 4.0)
		tmp = t_2;
	elseif (x <= 9.5e+48)
		tmp = t_1;
	elseif (x <= 9e+81)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 1.5e+163)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	t_0 = abs((z * (x / y)));
	t_1 = abs((x / y));
	t_2 = abs((4.0 / y));
	tmp = 0.0;
	if (x <= -10.5)
		tmp = t_1;
	elseif (x <= 6.5e-90)
		tmp = t_2;
	elseif (x <= 3.25e-37)
		tmp = t_0;
	elseif (x <= 4.0)
		tmp = t_2;
	elseif (x <= 9.5e+48)
		tmp = t_1;
	elseif (x <= 9e+81)
		tmp = abs((x * (z / y)));
	elseif (x <= 1.5e+163)
		tmp = t_1;
	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[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -10.5], t$95$1, If[LessEqual[x, 6.5e-90], t$95$2, If[LessEqual[x, 3.25e-37], t$95$0, If[LessEqual[x, 4.0], t$95$2, If[LessEqual[x, 9.5e+48], t$95$1, If[LessEqual[x, 9e+81], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.5e+163], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
t_1 := \left|\frac{x}{y}\right|\\
t_2 := \left|\frac{4}{y}\right|\\
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 3.25 \cdot 10^{-37}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+48}:\\
\;\;\;\;t_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -10.5 or 4 < x < 9.4999999999999997e48 or 9.00000000000000034e81 < x < 1.50000000000000007e163

    1. Initial program 84.1%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{1 - z}{\frac{y}{x}}}\right| \]
    7. Taylor expanded in z around 0 71.5%

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

    if -10.5 < x < 6.4999999999999996e-90 or 3.2500000000000001e-37 < x < 4

    1. Initial program 96.3%

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

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

    if 6.4999999999999996e-90 < x < 3.2500000000000001e-37 or 1.50000000000000007e163 < x

    1. Initial program 83.6%

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

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

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

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

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

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

    if 9.4999999999999997e48 < x < 9.00000000000000034e81

    1. Initial program 99.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-37}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+48}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+163}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \end{array} \]

Alternative 3: 67.2% accurate, 0.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ t_1 := \left|\frac{4}{y}\right|\\ \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-33}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+155}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \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 (/ 4.0 y))))
   (if (<= x -10.5)
     t_0
     (if (<= x 6.5e-90)
       t_1
       (if (<= x 4.2e-33)
         (fabs (* z (/ x y)))
         (if (<= x 4.0)
           t_1
           (if (<= x 5.3e+48)
             t_0
             (if (<= x 2.2e+81)
               (fabs (* x (/ z y)))
               (if (<= x 5.2e+155) t_0 (fabs (/ z (/ y x))))))))))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((x / y));
	double t_1 = fabs((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_0;
	} else if (x <= 6.5e-90) {
		tmp = t_1;
	} else if (x <= 4.2e-33) {
		tmp = fabs((z * (x / y)));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 5.3e+48) {
		tmp = t_0;
	} else if (x <= 2.2e+81) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 5.2e+155) {
		tmp = t_0;
	} else {
		tmp = fabs((z / (y / x)));
	}
	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((4.0d0 / y))
    if (x <= (-10.5d0)) then
        tmp = t_0
    else if (x <= 6.5d-90) then
        tmp = t_1
    else if (x <= 4.2d-33) then
        tmp = abs((z * (x / y)))
    else if (x <= 4.0d0) then
        tmp = t_1
    else if (x <= 5.3d+48) then
        tmp = t_0
    else if (x <= 2.2d+81) then
        tmp = abs((x * (z / y)))
    else if (x <= 5.2d+155) then
        tmp = t_0
    else
        tmp = abs((z / (y / x)))
    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((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_0;
	} else if (x <= 6.5e-90) {
		tmp = t_1;
	} else if (x <= 4.2e-33) {
		tmp = Math.abs((z * (x / y)));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 5.3e+48) {
		tmp = t_0;
	} else if (x <= 2.2e+81) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 5.2e+155) {
		tmp = t_0;
	} else {
		tmp = Math.abs((z / (y / x)));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	t_0 = math.fabs((x / y))
	t_1 = math.fabs((4.0 / y))
	tmp = 0
	if x <= -10.5:
		tmp = t_0
	elif x <= 6.5e-90:
		tmp = t_1
	elif x <= 4.2e-33:
		tmp = math.fabs((z * (x / y)))
	elif x <= 4.0:
		tmp = t_1
	elif x <= 5.3e+48:
		tmp = t_0
	elif x <= 2.2e+81:
		tmp = math.fabs((x * (z / y)))
	elif x <= 5.2e+155:
		tmp = t_0
	else:
		tmp = math.fabs((z / (y / x)))
	return tmp
y = abs(y)
function code(x, y, z)
	t_0 = abs(Float64(x / y))
	t_1 = abs(Float64(4.0 / y))
	tmp = 0.0
	if (x <= -10.5)
		tmp = t_0;
	elseif (x <= 6.5e-90)
		tmp = t_1;
	elseif (x <= 4.2e-33)
		tmp = abs(Float64(z * Float64(x / y)));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 5.3e+48)
		tmp = t_0;
	elseif (x <= 2.2e+81)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 5.2e+155)
		tmp = t_0;
	else
		tmp = abs(Float64(z / Float64(y / x)));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	t_0 = abs((x / y));
	t_1 = abs((4.0 / y));
	tmp = 0.0;
	if (x <= -10.5)
		tmp = t_0;
	elseif (x <= 6.5e-90)
		tmp = t_1;
	elseif (x <= 4.2e-33)
		tmp = abs((z * (x / y)));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 5.3e+48)
		tmp = t_0;
	elseif (x <= 2.2e+81)
		tmp = abs((x * (z / y)));
	elseif (x <= 5.2e+155)
		tmp = t_0;
	else
		tmp = abs((z / (y / x)));
	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[(4.0 / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -10.5], t$95$0, If[LessEqual[x, 6.5e-90], t$95$1, If[LessEqual[x, 4.2e-33], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], t$95$1, If[LessEqual[x, 5.3e+48], t$95$0, If[LessEqual[x, 2.2e+81], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.2e+155], t$95$0, N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|\frac{4}{y}\right|\\
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.2 \cdot 10^{-33}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq 5.2 \cdot 10^{+155}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -10.5 or 4 < x < 5.3e48 or 2.19999999999999987e81 < x < 5.2000000000000004e155

    1. Initial program 83.5%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{1 - z}{\frac{y}{x}}}\right| \]
    7. Taylor expanded in z around 0 71.7%

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

    if -10.5 < x < 6.4999999999999996e-90 or 4.2e-33 < x < 4

    1. Initial program 96.3%

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

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

    if 6.4999999999999996e-90 < x < 4.2e-33

    1. Initial program 99.4%

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

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

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

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

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

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

    if 5.3e48 < x < 2.19999999999999987e81

    1. Initial program 99.7%

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

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

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

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

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

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

    if 5.2000000000000004e155 < x

    1. Initial program 82.7%

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

      \[\leadsto \color{blue}{\left|\frac{1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|} \]
    3. Step-by-step derivation
      1. associate-*l/81.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-33}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+155}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 4: 67.4% accurate, 0.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ t_1 := \left|\frac{4}{y}\right|\\ \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-30}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+156}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \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 (/ 4.0 y))))
   (if (<= x -10.5)
     t_0
     (if (<= x 6e-90)
       t_1
       (if (<= x 7.2e-30)
         (fabs (/ (* x z) y))
         (if (<= x 4.0)
           t_1
           (if (<= x 5.3e+48)
             t_0
             (if (<= x 2.2e+81)
               (fabs (* x (/ z y)))
               (if (<= x 1.32e+156) t_0 (fabs (/ z (/ y x))))))))))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((x / y));
	double t_1 = fabs((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_0;
	} else if (x <= 6e-90) {
		tmp = t_1;
	} else if (x <= 7.2e-30) {
		tmp = fabs(((x * z) / y));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 5.3e+48) {
		tmp = t_0;
	} else if (x <= 2.2e+81) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 1.32e+156) {
		tmp = t_0;
	} else {
		tmp = fabs((z / (y / x)));
	}
	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((4.0d0 / y))
    if (x <= (-10.5d0)) then
        tmp = t_0
    else if (x <= 6d-90) then
        tmp = t_1
    else if (x <= 7.2d-30) then
        tmp = abs(((x * z) / y))
    else if (x <= 4.0d0) then
        tmp = t_1
    else if (x <= 5.3d+48) then
        tmp = t_0
    else if (x <= 2.2d+81) then
        tmp = abs((x * (z / y)))
    else if (x <= 1.32d+156) then
        tmp = t_0
    else
        tmp = abs((z / (y / x)))
    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((4.0 / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_0;
	} else if (x <= 6e-90) {
		tmp = t_1;
	} else if (x <= 7.2e-30) {
		tmp = Math.abs(((x * z) / y));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 5.3e+48) {
		tmp = t_0;
	} else if (x <= 2.2e+81) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 1.32e+156) {
		tmp = t_0;
	} else {
		tmp = Math.abs((z / (y / x)));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z):
	t_0 = math.fabs((x / y))
	t_1 = math.fabs((4.0 / y))
	tmp = 0
	if x <= -10.5:
		tmp = t_0
	elif x <= 6e-90:
		tmp = t_1
	elif x <= 7.2e-30:
		tmp = math.fabs(((x * z) / y))
	elif x <= 4.0:
		tmp = t_1
	elif x <= 5.3e+48:
		tmp = t_0
	elif x <= 2.2e+81:
		tmp = math.fabs((x * (z / y)))
	elif x <= 1.32e+156:
		tmp = t_0
	else:
		tmp = math.fabs((z / (y / x)))
	return tmp
y = abs(y)
function code(x, y, z)
	t_0 = abs(Float64(x / y))
	t_1 = abs(Float64(4.0 / y))
	tmp = 0.0
	if (x <= -10.5)
		tmp = t_0;
	elseif (x <= 6e-90)
		tmp = t_1;
	elseif (x <= 7.2e-30)
		tmp = abs(Float64(Float64(x * z) / y));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 5.3e+48)
		tmp = t_0;
	elseif (x <= 2.2e+81)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 1.32e+156)
		tmp = t_0;
	else
		tmp = abs(Float64(z / Float64(y / x)));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z)
	t_0 = abs((x / y));
	t_1 = abs((4.0 / y));
	tmp = 0.0;
	if (x <= -10.5)
		tmp = t_0;
	elseif (x <= 6e-90)
		tmp = t_1;
	elseif (x <= 7.2e-30)
		tmp = abs(((x * z) / y));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 5.3e+48)
		tmp = t_0;
	elseif (x <= 2.2e+81)
		tmp = abs((x * (z / y)));
	elseif (x <= 1.32e+156)
		tmp = t_0;
	else
		tmp = abs((z / (y / x)));
	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[(4.0 / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -10.5], t$95$0, If[LessEqual[x, 6e-90], t$95$1, If[LessEqual[x, 7.2e-30], N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], t$95$1, If[LessEqual[x, 5.3e+48], t$95$0, If[LessEqual[x, 2.2e+81], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.32e+156], t$95$0, N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|\frac{4}{y}\right|\\
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 6 \cdot 10^{-90}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 7.2 \cdot 10^{-30}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\

\mathbf{elif}\;x \leq 4:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq 1.32 \cdot 10^{+156}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -10.5 or 4 < x < 5.3e48 or 2.19999999999999987e81 < x < 1.3199999999999999e156

    1. Initial program 83.5%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{1 - z}{\frac{y}{x}}}\right| \]
    7. Taylor expanded in z around 0 71.7%

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

    if -10.5 < x < 6.00000000000000041e-90 or 7.2000000000000006e-30 < x < 4

    1. Initial program 96.3%

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

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

    if 6.00000000000000041e-90 < x < 7.2000000000000006e-30

    1. Initial program 99.4%

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

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

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

    if 5.3e48 < x < 2.19999999999999987e81

    1. Initial program 99.7%

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

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

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

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

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

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

    if 1.3199999999999999e156 < x

    1. Initial program 82.7%

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

      \[\leadsto \color{blue}{\left|\frac{1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|} \]
    3. Step-by-step derivation
      1. associate-*l/81.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-90}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-30}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+48}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+156}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 5: 98.4% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15e24 or 3.7000000000000002 < x

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

    if -1.15e24 < x < 3.7000000000000002

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.9% accurate, 1.0× speedup?

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

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


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

    1. Initial program 89.2%

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

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

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

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

    if 2e7 < y

    1. Initial program 95.0%

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

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

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

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

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

Alternative 7: 67.2% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 26000000:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+253}:\\ \;\;\;\;\left|x \cdot \frac{z}{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 -10.5)
     t_0
     (if (<= x 26000000.0)
       (fabs (/ 4.0 y))
       (if (<= x 5.6e+253) (fabs (* x (/ z y))) t_0)))))
y = abs(y);
double code(double x, double y, double z) {
	double t_0 = fabs((x / y));
	double tmp;
	if (x <= -10.5) {
		tmp = t_0;
	} else if (x <= 26000000.0) {
		tmp = fabs((4.0 / y));
	} else if (x <= 5.6e+253) {
		tmp = fabs((x * (z / 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 <= (-10.5d0)) then
        tmp = t_0
    else if (x <= 26000000.0d0) then
        tmp = abs((4.0d0 / y))
    else if (x <= 5.6d+253) then
        tmp = abs((x * (z / 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 <= -10.5) {
		tmp = t_0;
	} else if (x <= 26000000.0) {
		tmp = Math.abs((4.0 / y));
	} else if (x <= 5.6e+253) {
		tmp = Math.abs((x * (z / 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 <= -10.5:
		tmp = t_0
	elif x <= 26000000.0:
		tmp = math.fabs((4.0 / y))
	elif x <= 5.6e+253:
		tmp = math.fabs((x * (z / 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 <= -10.5)
		tmp = t_0;
	elseif (x <= 26000000.0)
		tmp = abs(Float64(4.0 / y));
	elseif (x <= 5.6e+253)
		tmp = abs(Float64(x * Float64(z / 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 <= -10.5)
		tmp = t_0;
	elseif (x <= 26000000.0)
		tmp = abs((4.0 / y));
	elseif (x <= 5.6e+253)
		tmp = abs((x * (z / 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, -10.5], t$95$0, If[LessEqual[x, 26000000.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.6e+253], N[Abs[N[(x * N[(z / 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 -10.5:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 26000000:\\
\;\;\;\;\left|\frac{4}{y}\right|\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -10.5 or 5.5999999999999999e253 < x

    1. Initial program 78.8%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{1 - z}{\frac{y}{x}}}\right| \]
    7. Taylor expanded in z around 0 77.1%

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

    if -10.5 < x < 2.6e7

    1. Initial program 96.5%

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

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

    if 2.6e7 < x < 5.5999999999999999e253

    1. Initial program 90.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 26000000:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+253}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 8: 84.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

    if -3.59999999999999979e127 < z < 1.9000000000000002e32

    1. Initial program 94.3%

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

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

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

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

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

    if 1.9000000000000002e32 < z

    1. Initial program 77.5%

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

      \[\leadsto \color{blue}{\left|\frac{1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|} \]
    3. Step-by-step derivation
      1. associate-*l/92.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+127}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+32}:\\ \;\;\;\;\left|\frac{x}{y} + \frac{4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 9: 84.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

    if -2.0999999999999999e130 < z < 2.99999999999999984e33

    1. Initial program 94.3%

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

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

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

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

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

    if 2.99999999999999984e33 < z

    1. Initial program 77.5%

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

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

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

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

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

        \[\leadsto \left|\frac{z + \color{blue}{-1}}{\frac{y}{x}}\right| \]
    5. Simplified79.1%

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

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

Alternative 10: 98.1% accurate, 1.0× speedup?

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

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


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

    1. Initial program 92.1%

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

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

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

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

    if 4.4e15 < x

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 84.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

    if -3.49999999999999978e127 < z < 1e30

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

    if 1e30 < z

    1. Initial program 77.5%

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

      \[\leadsto \color{blue}{\left|\frac{1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|} \]
    3. Step-by-step derivation
      1. associate-*l/92.8%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 68.2% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -10.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 -10.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 <= -10.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 <= (-10.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 <= -10.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 <= -10.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 <= -10.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 <= -10.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, -10.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 -10.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 < -10.5 or 4 < x

    1. Initial program 84.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. sub-div92.8%

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{1 - z}{\frac{y}{x}}}\right| \]
    7. Taylor expanded in z around 0 65.5%

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

    if -10.5 < x < 4

    1. Initial program 96.4%

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

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

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

Alternative 13: 39.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 90.6%

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

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

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

Reproduce

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