fabs fraction 1

Percentage Accurate: 91.7% → 98.0%
Time: 10.5s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 91.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.0% accurate, 1.0× speedup?

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

\\
\left|\frac{4}{y} + \frac{x}{y} \cdot \left(1 - z\right)\right|
\end{array}
Derivation
  1. Initial program 95.3%

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

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
    3. +-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
    4. neg-sub0N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
    5. associate-+l-N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
    6. sub0-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
    7. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
    8. distribute-rgt-out--N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
    10. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
    11. associate-*l/N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
    13. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
    14. distribute-neg-inN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
    15. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
    16. div-subN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
    17. distribute-neg-fracN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
    18. associate--r-N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
    19. +-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    20. +-lowering-+.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    21. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    22. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
  3. Simplified98.8%

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

Alternative 2: 68.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{x}{y} \cdot z\right|\\ t_1 := \left|\frac{x}{y}\right|\\ \mathbf{if}\;x \leq -3.9 \cdot 10^{+151}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -10.5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 10^{-60}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 0.0225:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+160}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fabs (* (/ x y) z))) (t_1 (fabs (/ x y))))
   (if (<= x -3.9e+151)
     t_0
     (if (<= x -10.5)
       t_1
       (if (<= x 1e-60)
         (fabs (/ 4.0 y))
         (if (<= x 0.0225)
           (fabs (* x (/ z y)))
           (if (<= x 2.9e+160) t_1 t_0)))))))
double code(double x, double y, double z) {
	double t_0 = fabs(((x / y) * z));
	double t_1 = fabs((x / y));
	double tmp;
	if (x <= -3.9e+151) {
		tmp = t_0;
	} else if (x <= -10.5) {
		tmp = t_1;
	} else if (x <= 1e-60) {
		tmp = fabs((4.0 / y));
	} else if (x <= 0.0225) {
		tmp = fabs((x * (z / y)));
	} else if (x <= 2.9e+160) {
		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) :: tmp
    t_0 = abs(((x / y) * z))
    t_1 = abs((x / y))
    if (x <= (-3.9d+151)) then
        tmp = t_0
    else if (x <= (-10.5d0)) then
        tmp = t_1
    else if (x <= 1d-60) then
        tmp = abs((4.0d0 / y))
    else if (x <= 0.0225d0) then
        tmp = abs((x * (z / y)))
    else if (x <= 2.9d+160) 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(((x / y) * z));
	double t_1 = Math.abs((x / y));
	double tmp;
	if (x <= -3.9e+151) {
		tmp = t_0;
	} else if (x <= -10.5) {
		tmp = t_1;
	} else if (x <= 1e-60) {
		tmp = Math.abs((4.0 / y));
	} else if (x <= 0.0225) {
		tmp = Math.abs((x * (z / y)));
	} else if (x <= 2.9e+160) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.fabs(((x / y) * z))
	t_1 = math.fabs((x / y))
	tmp = 0
	if x <= -3.9e+151:
		tmp = t_0
	elif x <= -10.5:
		tmp = t_1
	elif x <= 1e-60:
		tmp = math.fabs((4.0 / y))
	elif x <= 0.0225:
		tmp = math.fabs((x * (z / y)))
	elif x <= 2.9e+160:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = abs(Float64(Float64(x / y) * z))
	t_1 = abs(Float64(x / y))
	tmp = 0.0
	if (x <= -3.9e+151)
		tmp = t_0;
	elseif (x <= -10.5)
		tmp = t_1;
	elseif (x <= 1e-60)
		tmp = abs(Float64(4.0 / y));
	elseif (x <= 0.0225)
		tmp = abs(Float64(x * Float64(z / y)));
	elseif (x <= 2.9e+160)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = abs(((x / y) * z));
	t_1 = abs((x / y));
	tmp = 0.0;
	if (x <= -3.9e+151)
		tmp = t_0;
	elseif (x <= -10.5)
		tmp = t_1;
	elseif (x <= 1e-60)
		tmp = abs((4.0 / y));
	elseif (x <= 0.0225)
		tmp = abs((x * (z / y)));
	elseif (x <= 2.9e+160)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.9e+151], t$95$0, If[LessEqual[x, -10.5], t$95$1, If[LessEqual[x, 1e-60], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.0225], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.9e+160], t$95$1, t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -10.5:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 0.0225:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\

\mathbf{elif}\;x \leq 2.9 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3.89999999999999976e151 or 2.8999999999999999e160 < x

    1. Initial program 87.5%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
      3. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
      4. flip3-+N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      5. div-invN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      6. fmm-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
    4. Applied egg-rr84.8%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \frac{x \cdot z}{y}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{x \cdot z}{y}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{z \cdot x}{y}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(z \cdot \frac{x}{y}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right)\right) \]
      7. /-lowering-/.f6478.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right)\right) \]
    7. Simplified78.3%

      \[\leadsto \left|\color{blue}{0 - z \cdot \frac{x}{y}}\right| \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \left|\mathsf{neg}\left(z \cdot \frac{x}{y}\right)\right| \]
      2. fabs-negN/A

        \[\leadsto \left|z \cdot \frac{x}{y}\right| \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z\right), y\right)\right) \]
      7. *-lowering-*.f6451.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, z\right), y\right)\right) \]
    9. Applied egg-rr51.2%

      \[\leadsto \color{blue}{\left|\frac{x \cdot z}{y}\right|} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right) \]
      4. /-lowering-/.f6478.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    11. Applied egg-rr78.3%

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

    if -3.89999999999999976e151 < x < -10.5 or 0.022499999999999999 < x < 2.8999999999999999e160

    1. Initial program 97.2%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \color{blue}{\left(\frac{x}{y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6471.5%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    7. Simplified71.5%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{x}{y}\right)}\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6466.9%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(x, y\right)\right) \]
    10. Simplified66.9%

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

    if -10.5 < x < 9.9999999999999997e-61

    1. Initial program 97.4%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified97.4%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6476.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(4, y\right)\right) \]
    7. Simplified76.2%

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

    if 9.9999999999999997e-61 < x < 0.022499999999999999

    1. Initial program 99.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
      3. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
      4. flip3-+N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      5. div-invN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      6. fmm-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
    4. Applied egg-rr99.4%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \frac{x \cdot z}{y}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{x \cdot z}{y}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{z \cdot x}{y}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(z \cdot \frac{x}{y}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right)\right) \]
      7. /-lowering-/.f6473.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right)\right) \]
    7. Simplified73.2%

      \[\leadsto \left|\color{blue}{0 - z \cdot \frac{x}{y}}\right| \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \left|\mathsf{neg}\left(z \cdot \frac{x}{y}\right)\right| \]
      2. fabs-negN/A

        \[\leadsto \left|z \cdot \frac{x}{y}\right| \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z\right), y\right)\right) \]
      7. *-lowering-*.f6472.9%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, z\right), y\right)\right) \]
    9. Applied egg-rr72.9%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(x \cdot \frac{z}{y}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z}{y} \cdot x\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\left(\frac{z}{y}\right), x\right)\right) \]
      4. /-lowering-/.f6473.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), x\right)\right) \]
    11. Applied egg-rr73.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+151}:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;x \leq -10.5:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 10^{-60}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 0.0225:\\ \;\;\;\;\left|x \cdot \frac{z}{y}\right|\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+160}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 68.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{x}{y} \cdot z\right|\\ t_1 := \left|\frac{x}{y}\right|\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{+152}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -10.2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-61}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 0.0225:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+160}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fabs (* (/ x y) z))) (t_1 (fabs (/ x y))))
   (if (<= x -1.5e+152)
     t_0
     (if (<= x -10.2)
       t_1
       (if (<= x 8.5e-61)
         (fabs (/ 4.0 y))
         (if (<= x 0.0225) t_0 (if (<= x 2.7e+160) t_1 t_0)))))))
double code(double x, double y, double z) {
	double t_0 = fabs(((x / y) * z));
	double t_1 = fabs((x / y));
	double tmp;
	if (x <= -1.5e+152) {
		tmp = t_0;
	} else if (x <= -10.2) {
		tmp = t_1;
	} else if (x <= 8.5e-61) {
		tmp = fabs((4.0 / y));
	} else if (x <= 0.0225) {
		tmp = t_0;
	} else if (x <= 2.7e+160) {
		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) :: tmp
    t_0 = abs(((x / y) * z))
    t_1 = abs((x / y))
    if (x <= (-1.5d+152)) then
        tmp = t_0
    else if (x <= (-10.2d0)) then
        tmp = t_1
    else if (x <= 8.5d-61) then
        tmp = abs((4.0d0 / y))
    else if (x <= 0.0225d0) then
        tmp = t_0
    else if (x <= 2.7d+160) 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(((x / y) * z));
	double t_1 = Math.abs((x / y));
	double tmp;
	if (x <= -1.5e+152) {
		tmp = t_0;
	} else if (x <= -10.2) {
		tmp = t_1;
	} else if (x <= 8.5e-61) {
		tmp = Math.abs((4.0 / y));
	} else if (x <= 0.0225) {
		tmp = t_0;
	} else if (x <= 2.7e+160) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.fabs(((x / y) * z))
	t_1 = math.fabs((x / y))
	tmp = 0
	if x <= -1.5e+152:
		tmp = t_0
	elif x <= -10.2:
		tmp = t_1
	elif x <= 8.5e-61:
		tmp = math.fabs((4.0 / y))
	elif x <= 0.0225:
		tmp = t_0
	elif x <= 2.7e+160:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = abs(Float64(Float64(x / y) * z))
	t_1 = abs(Float64(x / y))
	tmp = 0.0
	if (x <= -1.5e+152)
		tmp = t_0;
	elseif (x <= -10.2)
		tmp = t_1;
	elseif (x <= 8.5e-61)
		tmp = abs(Float64(4.0 / y));
	elseif (x <= 0.0225)
		tmp = t_0;
	elseif (x <= 2.7e+160)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = abs(((x / y) * z));
	t_1 = abs((x / y));
	tmp = 0.0;
	if (x <= -1.5e+152)
		tmp = t_0;
	elseif (x <= -10.2)
		tmp = t_1;
	elseif (x <= 8.5e-61)
		tmp = abs((4.0 / y));
	elseif (x <= 0.0225)
		tmp = t_0;
	elseif (x <= 2.7e+160)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.5e+152], t$95$0, If[LessEqual[x, -10.2], t$95$1, If[LessEqual[x, 8.5e-61], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.0225], t$95$0, If[LessEqual[x, 2.7e+160], t$95$1, t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -10.2:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 0.0225:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999995e152 or 8.50000000000000016e-61 < x < 0.022499999999999999 or 2.7e160 < x

    1. Initial program 89.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
      3. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
      4. flip3-+N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      5. div-invN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      6. fmm-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
    4. Applied egg-rr87.8%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \frac{x \cdot z}{y}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{x \cdot z}{y}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{z \cdot x}{y}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(z \cdot \frac{x}{y}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right)\right) \]
      7. /-lowering-/.f6477.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right)\right) \]
    7. Simplified77.2%

      \[\leadsto \left|\color{blue}{0 - z \cdot \frac{x}{y}}\right| \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \left|\mathsf{neg}\left(z \cdot \frac{x}{y}\right)\right| \]
      2. fabs-negN/A

        \[\leadsto \left|z \cdot \frac{x}{y}\right| \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z\right), y\right)\right) \]
      7. *-lowering-*.f6455.6%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, z\right), y\right)\right) \]
    9. Applied egg-rr55.6%

      \[\leadsto \color{blue}{\left|\frac{x \cdot z}{y}\right|} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right) \]
      4. /-lowering-/.f6477.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    11. Applied egg-rr77.2%

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

    if -1.49999999999999995e152 < x < -10.199999999999999 or 0.022499999999999999 < x < 2.7e160

    1. Initial program 97.2%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \color{blue}{\left(\frac{x}{y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6471.5%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    7. Simplified71.5%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{x}{y}\right)}\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6466.9%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(x, y\right)\right) \]
    10. Simplified66.9%

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

    if -10.199999999999999 < x < 8.50000000000000016e-61

    1. Initial program 97.4%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified97.4%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6476.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(4, y\right)\right) \]
    7. Simplified76.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+152}:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;x \leq -10.2:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-61}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \mathbf{elif}\;x \leq 0.0225:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+160}:\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \left|\frac{4}{y} - \frac{x}{y} \cdot z\right|\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.6:\\
\;\;\;\;\left|\frac{4 + x}{y}\right|\\

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


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

    1. Initial program 95.5%

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

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), z\right)\right)\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6496.7%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), z\right)\right)\right) \]
    5. Simplified96.7%

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

    if -1 < z < 2.60000000000000009

    1. Initial program 95.1%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + \frac{x \cdot 1}{y}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + x \cdot \frac{1}{y}\right)\right) \]
      3. distribute-rgt-outN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1}{y} \cdot \left(4 + x\right)\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1 \cdot \left(4 + x\right)}{y}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(\mathsf{neg}\left(-1\right)\right) \cdot \left(4 + x\right)}{y}\right)\right) \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{neg}\left(-1 \cdot \left(4 + x\right)\right)}{y}\right)\right) \]
      7. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{-1 \cdot \left(4 + x\right)}{y}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(4 + x\right)\right)}{y}\right)\right)\right) \]
      9. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{4 + x}{y}\right)\right)\right)\right)\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4 + x}{y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(4 + x\right), y\right)\right) \]
      12. +-lowering-+.f6498.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(4, x\right), y\right)\right) \]
    7. Simplified98.3%

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

Alternative 5: 95.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \left|\frac{x \cdot z - 4}{y}\right|\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.7:\\
\;\;\;\;\left|\frac{4 + x}{y}\right|\\

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


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

    1. Initial program 95.5%

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

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), z\right)\right)\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6496.7%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), z\right)\right)\right) \]
    5. Simplified96.7%

      \[\leadsto \left|\color{blue}{\frac{4}{y}} - \frac{x}{y} \cdot z\right| \]
    6. Step-by-step derivation
      1. fabs-subN/A

        \[\leadsto \left|\frac{x}{y} \cdot z - \frac{4}{y}\right| \]
      2. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x}{y} \cdot z - \frac{4}{y}\right)\right) \]
      3. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y} - \frac{4}{y}\right)\right) \]
      4. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z - 4}{y}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z - 4\right), y\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot z\right), 4\right), y\right)\right) \]
      7. *-lowering-*.f6491.7%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, z\right), 4\right), y\right)\right) \]
    7. Applied egg-rr91.7%

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

    if -1 < z < 2.7000000000000002

    1. Initial program 95.1%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified100.0%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + \frac{x \cdot 1}{y}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + x \cdot \frac{1}{y}\right)\right) \]
      3. distribute-rgt-outN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1}{y} \cdot \left(4 + x\right)\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1 \cdot \left(4 + x\right)}{y}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(\mathsf{neg}\left(-1\right)\right) \cdot \left(4 + x\right)}{y}\right)\right) \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{neg}\left(-1 \cdot \left(4 + x\right)\right)}{y}\right)\right) \]
      7. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{-1 \cdot \left(4 + x\right)}{y}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(4 + x\right)\right)}{y}\right)\right)\right) \]
      9. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{4 + x}{y}\right)\right)\right)\right)\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4 + x}{y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(4 + x\right), y\right)\right) \]
      12. +-lowering-+.f6498.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(4, x\right), y\right)\right) \]
    7. Simplified98.3%

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

Alternative 6: 85.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 95.9%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
      3. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
      4. flip3-+N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      5. div-invN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      6. fmm-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
    4. Applied egg-rr94.0%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \frac{x \cdot z}{y}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{x \cdot z}{y}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{z \cdot x}{y}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(z \cdot \frac{x}{y}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right)\right) \]
      7. /-lowering-/.f6479.9%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right)\right) \]
    7. Simplified79.9%

      \[\leadsto \left|\color{blue}{0 - z \cdot \frac{x}{y}}\right| \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \left|\mathsf{neg}\left(z \cdot \frac{x}{y}\right)\right| \]
      2. fabs-negN/A

        \[\leadsto \left|z \cdot \frac{x}{y}\right| \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z\right), y\right)\right) \]
      7. *-lowering-*.f6478.2%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, z\right), y\right)\right) \]
    9. Applied egg-rr78.2%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(x \cdot \frac{z}{y}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z}{y} \cdot x\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\left(\frac{z}{y}\right), x\right)\right) \]
      4. /-lowering-/.f6480.7%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(z, y\right), x\right)\right) \]
    11. Applied egg-rr80.7%

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

    if -6.0000000000000005e126 < z < 1.8199999999999999e52

    1. Initial program 95.6%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + \frac{x \cdot 1}{y}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(4 \cdot \frac{1}{y} + x \cdot \frac{1}{y}\right)\right) \]
      3. distribute-rgt-outN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1}{y} \cdot \left(4 + x\right)\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{1 \cdot \left(4 + x\right)}{y}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(\mathsf{neg}\left(-1\right)\right) \cdot \left(4 + x\right)}{y}\right)\right) \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{neg}\left(-1 \cdot \left(4 + x\right)\right)}{y}\right)\right) \]
      7. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{-1 \cdot \left(4 + x\right)}{y}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(4 + x\right)\right)}{y}\right)\right)\right) \]
      9. distribute-frac-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{4 + x}{y}\right)\right)\right)\right)\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4 + x}{y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(4 + x\right), y\right)\right) \]
      12. +-lowering-+.f6489.4%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(4, x\right), y\right)\right) \]
    7. Simplified89.4%

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

    if 1.8199999999999999e52 < z

    1. Initial program 93.8%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
      3. sub-divN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
      4. flip3-+N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      5. div-invN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
      6. fmm-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
    4. Applied egg-rr89.8%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \frac{x \cdot z}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \frac{x \cdot z}{y}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{x \cdot z}{y}\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{z \cdot x}{y}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \left(z \cdot \frac{x}{y}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right)\right) \]
      7. /-lowering-/.f6472.0%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right)\right) \]
    7. Simplified72.0%

      \[\leadsto \left|\color{blue}{0 - z \cdot \frac{x}{y}}\right| \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \left|\mathsf{neg}\left(z \cdot \frac{x}{y}\right)\right| \]
      2. fabs-negN/A

        \[\leadsto \left|z \cdot \frac{x}{y}\right| \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x \cdot z}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(x \cdot z\right), y\right)\right) \]
      7. *-lowering-*.f6464.0%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, z\right), y\right)\right) \]
    9. Applied egg-rr64.0%

      \[\leadsto \color{blue}{\left|\frac{x \cdot z}{y}\right|} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{z \cdot x}{y}\right)\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(z \cdot \frac{x}{y}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \left(\frac{x}{y}\right)\right)\right) \]
      4. /-lowering-/.f6472.0%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(z, \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    11. Applied egg-rr72.0%

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

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

Alternative 7: 69.1% 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 4:\\ \;\;\;\;\left|\frac{4}{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 4.0) (fabs (/ 4.0 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 <= 4.0) {
		tmp = fabs((4.0 / 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 <= 4.0d0) then
        tmp = abs((4.0d0 / 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 <= 4.0) {
		tmp = Math.abs((4.0 / 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 <= 4.0:
		tmp = math.fabs((4.0 / 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 <= 4.0)
		tmp = abs(Float64(4.0 / 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 <= 4.0)
		tmp = abs((4.0 / 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, 4.0], N[Abs[N[(4.0 / y), $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 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\

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


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

    1. Initial program 93.0%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \color{blue}{\left(\frac{x}{y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6464.3%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{/.f64}\left(x, y\right)\right)\right) \]
    7. Simplified64.3%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{x}{y}\right)}\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6462.4%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(x, y\right)\right) \]
    10. Simplified62.4%

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

    if -10.5 < x < 4

    1. Initial program 97.7%

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

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
      4. neg-sub0N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
      5. associate-+l-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      6. sub0-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
      8. distribute-rgt-out--N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      10. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
      11. associate-*l/N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
      13. neg-mul-1N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
      14. distribute-neg-inN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
      15. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
      16. div-subN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
      18. associate--r-N/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
      19. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      20. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
      22. sub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
    3. Simplified97.7%

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

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6471.0%

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(4, y\right)\right) \]
    7. Simplified71.0%

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

Alternative 8: 96.4% accurate, 1.0× speedup?

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

\\
\left|\frac{\left(4 + x\right) - x \cdot z}{y}\right|
\end{array}
Derivation
  1. Initial program 95.3%

    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. fabs-lowering-fabs.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
    2. associate-*l/N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x \cdot z}{y}\right)\right) \]
    3. sub-divN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left(x + 4\right) - x \cdot z}{y}\right)\right) \]
    4. flip3-+N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\frac{{x}^{3} + {4}^{3}}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
    5. div-invN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\left({x}^{3} + {4}^{3}\right) \cdot \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)} - x \cdot z}{y}\right)\right) \]
    6. fmm-defN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(x \cdot z\right)\right)}{y}\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)}{y}\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{fma}\left({x}^{3} + {4}^{3}, \frac{1}{x \cdot x + \left(4 \cdot 4 - x \cdot 4\right)}, \mathsf{neg}\left(z \cdot x\right)\right)\right), y\right)\right) \]
  4. Applied egg-rr96.2%

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

Alternative 9: 40.3% 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 95.3%

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

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} - \frac{x}{y} \cdot z\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right)\right)\right) \]
    3. +-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \frac{x + 4}{y}\right)\right) \]
    4. neg-sub0N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(0 - \frac{x}{y} \cdot z\right) + \frac{x + 4}{y}\right)\right) \]
    5. associate-+l-N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(0 - \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
    6. sub0-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\mathsf{neg}\left(\left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right)\right) \]
    7. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z - \frac{x + 4}{y}\right)\right)\right) \]
    8. distribute-rgt-out--N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\frac{x}{y} \cdot z\right) \cdot -1 - \frac{x + 4}{y} \cdot -1\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(-1 \cdot \left(\frac{x}{y} \cdot z\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
    10. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{x + 4}{y} \cdot -1\right)\right) \]
    11. associate-*l/N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(x + 4\right) \cdot -1}{y}\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{-1 \cdot \left(x + 4\right)}{y}\right)\right) \]
    13. neg-mul-1N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\mathsf{neg}\left(\left(x + 4\right)\right)}{y}\right)\right) \]
    14. distribute-neg-inN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(4\right)\right)}{y}\right)\right) \]
    15. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \frac{\left(\mathsf{neg}\left(x\right)\right) - 4}{y}\right)\right) \]
    16. div-subN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\frac{\mathsf{neg}\left(x\right)}{y} - \frac{4}{y}\right)\right)\right) \]
    17. distribute-neg-fracN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) - \frac{4}{y}\right)\right)\right) \]
    18. associate--r-N/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right) + \frac{4}{y}\right)\right) \]
    19. +-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\left(\frac{4}{y} + \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    20. +-lowering-+.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\left(\frac{4}{y}\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    21. /-lowering-/.f64N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) - \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \]
    22. sub-negN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\left(\mathsf{neg}\left(\frac{x}{y} \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right)\right)\right) \]
  3. Simplified98.8%

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

    \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(\frac{4}{y}\right)}\right) \]
  6. Step-by-step derivation
    1. /-lowering-/.f6437.9%

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{/.f64}\left(4, y\right)\right) \]
  7. Simplified37.9%

    \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
  8. Add Preprocessing

Reproduce

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