fabs fraction 1

Percentage Accurate: 91.0% → 98.1%
Time: 7.9s
Alternatives: 12
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 12 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: 98.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.5 \cdot 10^{+16}:\\
\;\;\;\;\left|\frac{x - \mathsf{fma}\left(x, z, -4\right)}{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 < 5.5e16

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.5e16 < 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 5.5 \cdot 10^{+16}:\\ \;\;\;\;\left|\frac{x - \mathsf{fma}\left(x, z, -4\right)}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(z + -1\right) \cdot \frac{x}{y}\right|\\ \end{array} \]

Alternative 2: 67.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \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 2.95 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+162}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(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 2.95e-37)
         t_0
         (if (<= x 4.0)
           t_2
           (if (<= x 1.95e+49)
             t_1
             (if (<= x 3e+81)
               (fabs (* x (/ z y)))
               (if (<= x 1.45e+162) t_1 t_0)))))))))
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 <= 2.95e-37) {
		tmp = t_0;
	} else if (x <= 4.0) {
		tmp = t_2;
	} else if (x <= 1.95e+49) {
		tmp = t_1;
	} else if (x <= 3e+81) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 1.45e+162) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 <= 2.95d-37) then
        tmp = t_0
    else if (x <= 4.0d0) then
        tmp = t_2
    else if (x <= 1.95d+49) then
        tmp = t_1
    else if (x <= 3d+81) then
        tmp = abs((x * (z / y)))
    else if (x <= 1.45d+162) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
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 <= 2.95e-37) {
		tmp = t_0;
	} else if (x <= 4.0) {
		tmp = t_2;
	} else if (x <= 1.95e+49) {
		tmp = t_1;
	} else if (x <= 3e+81) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 1.45e+162) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 <= 2.95e-37:
		tmp = t_0
	elif x <= 4.0:
		tmp = t_2
	elif x <= 1.95e+49:
		tmp = t_1
	elif x <= 3e+81:
		tmp = math.fabs((x * (z / y)))
	elif x <= 1.45e+162:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
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 <= 2.95e-37)
		tmp = t_0;
	elseif (x <= 4.0)
		tmp = t_2;
	elseif (x <= 1.95e+49)
		tmp = t_1;
	elseif (x <= 3e+81)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 1.45e+162)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
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 <= 2.95e-37)
		tmp = t_0;
	elseif (x <= 4.0)
		tmp = t_2;
	elseif (x <= 1.95e+49)
		tmp = t_1;
	elseif (x <= 3e+81)
		tmp = abs((x * (z / y)));
	elseif (x <= 1.45e+162)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
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, 2.95e-37], t$95$0, If[LessEqual[x, 4.0], t$95$2, If[LessEqual[x, 1.95e+49], t$95$1, If[LessEqual[x, 3e+81], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.45e+162], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}

\\
\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 2.95 \cdot 10^{-37}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq 1.95 \cdot 10^{+49}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 1.45 \cdot 10^{+162}:\\
\;\;\;\;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 < 1.95e49 or 2.99999999999999997e81 < x < 1.45000000000000003e162

    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 2.9499999999999998e-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 < 2.9499999999999998e-37 or 1.45000000000000003e162 < 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 1.95e49 < x < 2.99999999999999997e81

    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 2.95 \cdot 10^{-37}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+49}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+162}:\\ \;\;\;\;\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} \\ \begin{array}{l} t_0 := \left|\frac{x}{y}\right|\\ t_1 := \left|\frac{4}{y}\right|\\ \mathbf{if}\;x \leq -10.2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-33}:\\ \;\;\;\;\left|z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{+49}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+155}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fabs (/ x y))) (t_1 (fabs (/ 4.0 y))))
   (if (<= x -10.2)
     t_0
     (if (<= x 6.5e-90)
       t_1
       (if (<= x 2.85e-33)
         (fabs (* z (/ x y)))
         (if (<= x 4.0)
           t_1
           (if (<= x 1.7e+49)
             t_0
             (if (<= x 2.05e+81)
               (fabs (* x (/ z y)))
               (if (<= x 7.2e+155) t_0 (fabs (/ z (/ y x))))))))))))
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.2) {
		tmp = t_0;
	} else if (x <= 6.5e-90) {
		tmp = t_1;
	} else if (x <= 2.85e-33) {
		tmp = fabs((z * (x / y)));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 1.7e+49) {
		tmp = t_0;
	} else if (x <= 2.05e+81) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 7.2e+155) {
		tmp = t_0;
	} else {
		tmp = fabs((z / (y / x)));
	}
	return tmp;
}
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.2d0)) then
        tmp = t_0
    else if (x <= 6.5d-90) then
        tmp = t_1
    else if (x <= 2.85d-33) then
        tmp = abs((z * (x / y)))
    else if (x <= 4.0d0) then
        tmp = t_1
    else if (x <= 1.7d+49) then
        tmp = t_0
    else if (x <= 2.05d+81) then
        tmp = abs((x * (z / y)))
    else if (x <= 7.2d+155) then
        tmp = t_0
    else
        tmp = abs((z / (y / x)))
    end if
    code = tmp
end function
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.2) {
		tmp = t_0;
	} else if (x <= 6.5e-90) {
		tmp = t_1;
	} else if (x <= 2.85e-33) {
		tmp = Math.abs((z * (x / y)));
	} else if (x <= 4.0) {
		tmp = t_1;
	} else if (x <= 1.7e+49) {
		tmp = t_0;
	} else if (x <= 2.05e+81) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 7.2e+155) {
		tmp = t_0;
	} else {
		tmp = Math.abs((z / (y / x)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.fabs((x / y))
	t_1 = math.fabs((4.0 / y))
	tmp = 0
	if x <= -10.2:
		tmp = t_0
	elif x <= 6.5e-90:
		tmp = t_1
	elif x <= 2.85e-33:
		tmp = math.fabs((z * (x / y)))
	elif x <= 4.0:
		tmp = t_1
	elif x <= 1.7e+49:
		tmp = t_0
	elif x <= 2.05e+81:
		tmp = math.fabs((x * (z / y)))
	elif x <= 7.2e+155:
		tmp = t_0
	else:
		tmp = math.fabs((z / (y / x)))
	return tmp
function code(x, y, z)
	t_0 = abs(Float64(x / y))
	t_1 = abs(Float64(4.0 / y))
	tmp = 0.0
	if (x <= -10.2)
		tmp = t_0;
	elseif (x <= 6.5e-90)
		tmp = t_1;
	elseif (x <= 2.85e-33)
		tmp = abs(Float64(z * Float64(x / y)));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 1.7e+49)
		tmp = t_0;
	elseif (x <= 2.05e+81)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 7.2e+155)
		tmp = t_0;
	else
		tmp = abs(Float64(z / Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = abs((x / y));
	t_1 = abs((4.0 / y));
	tmp = 0.0;
	if (x <= -10.2)
		tmp = t_0;
	elseif (x <= 6.5e-90)
		tmp = t_1;
	elseif (x <= 2.85e-33)
		tmp = abs((z * (x / y)));
	elseif (x <= 4.0)
		tmp = t_1;
	elseif (x <= 1.7e+49)
		tmp = t_0;
	elseif (x <= 2.05e+81)
		tmp = abs((x * (z / y)));
	elseif (x <= 7.2e+155)
		tmp = t_0;
	else
		tmp = abs((z / (y / x)));
	end
	tmp_2 = tmp;
end
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.2], t$95$0, If[LessEqual[x, 6.5e-90], t$95$1, If[LessEqual[x, 2.85e-33], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], t$95$1, If[LessEqual[x, 1.7e+49], t$95$0, If[LessEqual[x, 2.05e+81], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 7.2e+155], t$95$0, N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|\frac{4}{y}\right|\\
\mathbf{if}\;x \leq -10.2:\\
\;\;\;\;t_0\\

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

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

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

\mathbf{elif}\;x \leq 1.7 \cdot 10^{+49}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq 7.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.199999999999999 or 4 < x < 1.7e49 or 2.05000000000000006e81 < x < 7.20000000000000015e155

    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.199999999999999 < x < 6.4999999999999996e-90 or 2.85000000000000013e-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 < 2.85000000000000013e-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 1.7e49 < x < 2.05000000000000006e81

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

\\
\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 1.6 \cdot 10^{-26}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\

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

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

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

\mathbf{elif}\;x \leq 1.75 \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 < 1.7499999999999999e48 or 2.05000000000000006e81 < x < 1.74999999999999992e155

    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 1.6000000000000001e-26 < 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 < 1.6000000000000001e-26

    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 1.7499999999999999e48 < x < 2.05000000000000006e81

    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.74999999999999992e155 < 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 1.6 \cdot 10^{-26}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{+48}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{+81}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{+155}:\\ \;\;\;\;\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} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+24} \lor \neg \left(x \leq 4.2\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} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.15e+24) (not (<= x 4.2)))
   (fabs (* (+ z -1.0) (/ x y)))
   (fabs (/ 1.0 (/ y (- (* x z) 4.0))))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.15e+24) || !(x <= 4.2)) {
		tmp = fabs(((z + -1.0) * (x / y)));
	} else {
		tmp = fabs((1.0 / (y / ((x * z) - 4.0))));
	}
	return tmp;
}
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 <= 4.2d0))) then
        tmp = abs(((z + (-1.0d0)) * (x / y)))
    else
        tmp = abs((1.0d0 / (y / ((x * z) - 4.0d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.15e+24) || !(x <= 4.2)) {
		tmp = Math.abs(((z + -1.0) * (x / y)));
	} else {
		tmp = Math.abs((1.0 / (y / ((x * z) - 4.0))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.15e+24) or not (x <= 4.2):
		tmp = math.fabs(((z + -1.0) * (x / y)))
	else:
		tmp = math.fabs((1.0 / (y / ((x * z) - 4.0))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.15e+24) || !(x <= 4.2))
		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
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.15e+24) || ~((x <= 4.2)))
		tmp = abs(((z + -1.0) * (x / y)));
	else
		tmp = abs((1.0 / (y / ((x * z) - 4.0))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.15e+24], N[Not[LessEqual[x, 4.2]], $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}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+24} \lor \neg \left(x \leq 4.2\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 4.20000000000000018 < 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 < 4.20000000000000018

    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 4.2\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: 67.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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 2.9 \cdot 10^{+255}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(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 2.9e+255) (fabs (* x (/ z y))) t_0)))))
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 <= 2.9e+255) {
		tmp = fabs((x * (z / y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 <= 2.9d+255) then
        tmp = abs((x * (z / y)))
    else
        tmp = t_0
    end if
    code = tmp
end function
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 <= 2.9e+255) {
		tmp = Math.abs((x * (z / y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 <= 2.9e+255:
		tmp = math.fabs((x * (z / y)))
	else:
		tmp = t_0
	return tmp
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 <= 2.9e+255)
		tmp = abs(Float64(x * Float64(z / y)));
	else
		tmp = t_0;
	end
	return tmp
end
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 <= 2.9e+255)
		tmp = abs((x * (z / y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
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, 2.9e+255], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\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 2.9 \cdot 10^{+255}:\\
\;\;\;\;\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 2.9000000000000002e255 < 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 < 2.9000000000000002e255

    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 2.9 \cdot 10^{+255}:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \end{array} \]

Alternative 7: 84.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+127}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\

\mathbf{elif}\;z \leq 2 \cdot 10^{+34}:\\
\;\;\;\;\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.19999999999999976e127

    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.19999999999999976e127 < z < 1.99999999999999989e34

    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.99999999999999989e34 < 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.2 \cdot 10^{+127}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+34}:\\ \;\;\;\;\left|\frac{x}{y} + \frac{4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 8: 84.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{+129}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{+20}:\\
\;\;\;\;\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 < -1.08e129

    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 -1.08e129 < z < 3.9e20

    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 3.9e20 < 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 -1.08 \cdot 10^{+129}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+20}:\\ \;\;\;\;\left|\frac{x}{y} + \frac{4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 9: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.4 \cdot 10^{+16}:\\ \;\;\;\;\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} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 3.4e+16)
   (fabs (/ (- (+ x 4.0) (* x z)) y))
   (fabs (* (+ z -1.0) (/ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 3.4e+16) {
		tmp = fabs((((x + 4.0) - (x * z)) / y));
	} else {
		tmp = fabs(((z + -1.0) * (x / y)));
	}
	return tmp;
}
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 <= 3.4d+16) then
        tmp = abs((((x + 4.0d0) - (x * z)) / y))
    else
        tmp = abs(((z + (-1.0d0)) * (x / y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 3.4e+16) {
		tmp = Math.abs((((x + 4.0) - (x * z)) / y));
	} else {
		tmp = Math.abs(((z + -1.0) * (x / y)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 3.4e+16:
		tmp = math.fabs((((x + 4.0) - (x * z)) / y))
	else:
		tmp = math.fabs(((z + -1.0) * (x / y)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 3.4e+16)
		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
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 3.4e+16)
		tmp = abs((((x + 4.0) - (x * z)) / y));
	else
		tmp = abs(((z + -1.0) * (x / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 3.4e+16], 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}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{+16}:\\
\;\;\;\;\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 < 3.4e16

    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 3.4e16 < 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 3.4 \cdot 10^{+16}:\\ \;\;\;\;\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 10: 84.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+127}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+24}:\\
\;\;\;\;\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.19999999999999976e127

    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.19999999999999976e127 < z < 2.1000000000000001e24

    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 2.1000000000000001e24 < 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.2 \cdot 10^{+127}:\\ \;\;\;\;\left|\frac{x \cdot z}{y}\right|\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+24}:\\ \;\;\;\;\left|\frac{-4 - x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\ \end{array} \]

Alternative 11: 68.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 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;
}
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
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;
}
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
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
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
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}

\\
\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 12: 39.2% accurate, 1.1× speedup?

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

\\
\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))))