Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3

Percentage Accurate: 99.9% → 99.9%
Time: 10.3s
Alternatives: 10
Speedup: 1.0×

Specification

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

\\
x + \frac{\left|y - x\right|}{2}
\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 10 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: 99.9% accurate, 1.0× speedup?

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

\\
x + \frac{\left|y - x\right|}{2}
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{\left|y - x\right|}{2} \]
  2. Add Preprocessing
  3. Final simplification99.9%

    \[\leadsto x + \frac{\left|y - x\right|}{2} \]
  4. Add Preprocessing

Alternative 2: 83.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{-91}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-112}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -2.2e-91)
   (* 0.5 (+ x y))
   (if (<= x 5.5e-112)
     (* (fabs (- y x)) 0.5)
     (- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 (+ (* y -0.5) (* y 1.5)))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -2.2e-91) {
		tmp = 0.5 * (x + y);
	} else if (x <= 5.5e-112) {
		tmp = fabs((y - x)) * 0.5;
	} else {
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.2d-91)) then
        tmp = 0.5d0 * (x + y)
    else if (x <= 5.5d-112) then
        tmp = abs((y - x)) * 0.5d0
    else
        tmp = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * ((y * (-0.5d0)) + (y * 1.5d0)))))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.2e-91) {
		tmp = 0.5 * (x + y);
	} else if (x <= 5.5e-112) {
		tmp = Math.abs((y - x)) * 0.5;
	} else {
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -2.2e-91:
		tmp = 0.5 * (x + y)
	elif x <= 5.5e-112:
		tmp = math.fabs((y - x)) * 0.5
	else:
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -2.2e-91)
		tmp = Float64(0.5 * Float64(x + y));
	elseif (x <= 5.5e-112)
		tmp = Float64(abs(Float64(y - x)) * 0.5);
	else
		tmp = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * Float64(Float64(y * -0.5) + Float64(y * 1.5))))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.2e-91)
		tmp = 0.5 * (x + y);
	elseif (x <= 5.5e-112)
		tmp = abs((y - x)) * 0.5;
	else
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -2.2e-91], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e-112], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-91}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-112}:\\
\;\;\;\;\left|y - x\right| \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.2000000000000001e-91

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt91.5%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr91.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt92.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval92.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 92.1%

      \[\leadsto \color{blue}{x + \left(-0.5 \cdot x + 0.5 \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-+r+92.2%

        \[\leadsto \color{blue}{\left(x + -0.5 \cdot x\right) + 0.5 \cdot y} \]
      2. distribute-rgt1-in92.2%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} + 0.5 \cdot y \]
      3. metadata-eval92.2%

        \[\leadsto \color{blue}{0.5} \cdot x + 0.5 \cdot y \]
      4. distribute-lft-out92.2%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
    7. Simplified92.2%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]

    if -2.2000000000000001e-91 < x < 5.5e-112

    1. Initial program 100.0%

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

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

    if 5.5e-112 < x

    1. Initial program 99.7%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+56.9%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num56.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv56.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt11.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow211.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr11.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval11.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(y + \color{blue}{-1 \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      5. distribute-lft-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod55.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod54.3%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt54.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr54.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around inf 83.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(2 \cdot \left(-0.5 \cdot y + 1.5 \cdot y\right) - 3 \cdot y\right) + 1.5 \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{-91}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-112}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.6% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{-241}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-278}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0
         (- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 (+ (* y -0.5) (* y 1.5))))))))
   (if (<= y -5.5e-241)
     t_0
     (if (<= y -2e-278) (* x 0.5) (if (<= y 2e-169) t_0 (* 0.5 (+ x y)))))))
double code(double x, double y) {
	double t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	double tmp;
	if (y <= -5.5e-241) {
		tmp = t_0;
	} else if (y <= -2e-278) {
		tmp = x * 0.5;
	} else if (y <= 2e-169) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * ((y * (-0.5d0)) + (y * 1.5d0)))))
    if (y <= (-5.5d-241)) then
        tmp = t_0
    else if (y <= (-2d-278)) then
        tmp = x * 0.5d0
    else if (y <= 2d-169) then
        tmp = t_0
    else
        tmp = 0.5d0 * (x + y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	double tmp;
	if (y <= -5.5e-241) {
		tmp = t_0;
	} else if (y <= -2e-278) {
		tmp = x * 0.5;
	} else if (y <= 2e-169) {
		tmp = t_0;
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))))
	tmp = 0
	if y <= -5.5e-241:
		tmp = t_0
	elif y <= -2e-278:
		tmp = x * 0.5
	elif y <= 2e-169:
		tmp = t_0
	else:
		tmp = 0.5 * (x + y)
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * Float64(Float64(y * -0.5) + Float64(y * 1.5))))))
	tmp = 0.0
	if (y <= -5.5e-241)
		tmp = t_0;
	elseif (y <= -2e-278)
		tmp = Float64(x * 0.5);
	elseif (y <= 2e-169)
		tmp = t_0;
	else
		tmp = Float64(0.5 * Float64(x + y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * ((y * -0.5) + (y * 1.5)))));
	tmp = 0.0;
	if (y <= -5.5e-241)
		tmp = t_0;
	elseif (y <= -2e-278)
		tmp = x * 0.5;
	elseif (y <= 2e-169)
		tmp = t_0;
	else
		tmp = 0.5 * (x + y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e-241], t$95$0, If[LessEqual[y, -2e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2e-169], t$95$0, N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-241}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -2 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.4999999999999998e-241 or -1.99999999999999988e-278 < y < 2.00000000000000004e-169

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+56.7%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv56.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt12.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr12.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt16.4%

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

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt12.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr12.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt40.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv40.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr16.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow216.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow216.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval16.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr16.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr18.2%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(y + \color{blue}{-1 \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      5. distribute-lft-in18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative18.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified18.2%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt13.0%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod55.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr55.7%

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

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval55.7%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr55.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative55.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative55.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod45.4%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt48.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv48.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval48.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative48.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative48.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr48.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around inf 79.1%

      \[\leadsto \color{blue}{0.5 \cdot \left(2 \cdot \left(-0.5 \cdot y + 1.5 \cdot y\right) - 3 \cdot y\right) + 1.5 \cdot x} \]

    if -5.4999999999999998e-241 < y < -1.99999999999999988e-278

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt81.3%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr81.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt85.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval85.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr85.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 85.0%

      \[\leadsto \color{blue}{x + -0.5 \cdot x} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in85.0%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} \]
      2. metadata-eval85.0%

        \[\leadsto \color{blue}{0.5} \cdot x \]
      3. *-commutative85.0%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified85.0%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if 2.00000000000000004e-169 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt83.1%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr83.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt86.6%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval86.6%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr86.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 86.6%

      \[\leadsto \color{blue}{x + \left(-0.5 \cdot x + 0.5 \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-+r+86.7%

        \[\leadsto \color{blue}{\left(x + -0.5 \cdot x\right) + 0.5 \cdot y} \]
      2. distribute-rgt1-in86.7%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} + 0.5 \cdot y \]
      3. metadata-eval86.7%

        \[\leadsto \color{blue}{0.5} \cdot x + 0.5 \cdot y \]
      4. distribute-lft-out86.7%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-241}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-278}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 77.7% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot -0.5 + y \cdot 1.5\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{-241}:\\ \;\;\;\;y \cdot -0.5 - 0.5 \cdot \left(x \cdot \left(-1 - 2 \cdot \frac{t\_0}{y}\right)\right)\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{-278}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ (* y -0.5) (* y 1.5))))
   (if (<= y -4.8e-241)
     (- (* y -0.5) (* 0.5 (* x (- -1.0 (* 2.0 (/ t_0 y))))))
     (if (<= y -3.1e-278)
       (* x 0.5)
       (if (<= y 2e-169)
         (- (* x 1.5) (* 0.5 (- (* y 3.0) (* 2.0 t_0))))
         (* 0.5 (+ x y)))))))
double code(double x, double y) {
	double t_0 = (y * -0.5) + (y * 1.5);
	double tmp;
	if (y <= -4.8e-241) {
		tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))));
	} else if (y <= -3.1e-278) {
		tmp = x * 0.5;
	} else if (y <= 2e-169) {
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0)));
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y * (-0.5d0)) + (y * 1.5d0)
    if (y <= (-4.8d-241)) then
        tmp = (y * (-0.5d0)) - (0.5d0 * (x * ((-1.0d0) - (2.0d0 * (t_0 / y)))))
    else if (y <= (-3.1d-278)) then
        tmp = x * 0.5d0
    else if (y <= 2d-169) then
        tmp = (x * 1.5d0) - (0.5d0 * ((y * 3.0d0) - (2.0d0 * t_0)))
    else
        tmp = 0.5d0 * (x + y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y * -0.5) + (y * 1.5);
	double tmp;
	if (y <= -4.8e-241) {
		tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))));
	} else if (y <= -3.1e-278) {
		tmp = x * 0.5;
	} else if (y <= 2e-169) {
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0)));
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
def code(x, y):
	t_0 = (y * -0.5) + (y * 1.5)
	tmp = 0
	if y <= -4.8e-241:
		tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))))
	elif y <= -3.1e-278:
		tmp = x * 0.5
	elif y <= 2e-169:
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0)))
	else:
		tmp = 0.5 * (x + y)
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y * -0.5) + Float64(y * 1.5))
	tmp = 0.0
	if (y <= -4.8e-241)
		tmp = Float64(Float64(y * -0.5) - Float64(0.5 * Float64(x * Float64(-1.0 - Float64(2.0 * Float64(t_0 / y))))));
	elseif (y <= -3.1e-278)
		tmp = Float64(x * 0.5);
	elseif (y <= 2e-169)
		tmp = Float64(Float64(x * 1.5) - Float64(0.5 * Float64(Float64(y * 3.0) - Float64(2.0 * t_0))));
	else
		tmp = Float64(0.5 * Float64(x + y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y * -0.5) + (y * 1.5);
	tmp = 0.0;
	if (y <= -4.8e-241)
		tmp = (y * -0.5) - (0.5 * (x * (-1.0 - (2.0 * (t_0 / y)))));
	elseif (y <= -3.1e-278)
		tmp = x * 0.5;
	elseif (y <= 2e-169)
		tmp = (x * 1.5) - (0.5 * ((y * 3.0) - (2.0 * t_0)));
	else
		tmp = 0.5 * (x + y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * -0.5), $MachinePrecision] + N[(y * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e-241], N[(N[(y * -0.5), $MachinePrecision] - N[(0.5 * N[(x * N[(-1.0 - N[(2.0 * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.1e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2e-169], N[(N[(x * 1.5), $MachinePrecision] - N[(0.5 * N[(N[(y * 3.0), $MachinePrecision] - N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot -0.5 + y \cdot 1.5\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-241}:\\
\;\;\;\;y \cdot -0.5 - 0.5 \cdot \left(x \cdot \left(-1 - 2 \cdot \frac{t\_0}{y}\right)\right)\\

\mathbf{elif}\;y \leq -3.1 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\
\;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.8e-241

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+57.9%

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

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt10.7%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr10.7%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt13.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval13.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow213.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt10.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr10.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt45.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv45.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr13.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow213.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow213.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr13.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares15.3%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr15.3%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg15.3%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative15.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified15.3%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt11.4%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod56.7%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr56.6%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval56.6%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval56.6%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr56.7%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative56.7%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative56.7%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod47.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt50.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv50.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval50.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative50.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative50.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr50.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around 0 82.1%

      \[\leadsto \color{blue}{-0.5 \cdot y + 0.5 \cdot \left(x \cdot \left(1 + 2 \cdot \frac{-0.5 \cdot y + 1.5 \cdot y}{y}\right)\right)} \]

    if -4.8e-241 < y < -3.09999999999999992e-278

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt81.3%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr81.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt85.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval85.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr85.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 85.0%

      \[\leadsto \color{blue}{x + -0.5 \cdot x} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in85.0%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} \]
      2. metadata-eval85.0%

        \[\leadsto \color{blue}{0.5} \cdot x \]
      3. *-commutative85.0%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified85.0%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if -3.09999999999999992e-278 < y < 2.00000000000000004e-169

    1. Initial program 99.8%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+53.5%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num53.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv53.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt16.0%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr16.0%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt23.3%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval23.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow223.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt16.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr16.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt25.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv25.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr23.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow223.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow223.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval23.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr23.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr26.0%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(y + \color{blue}{-1 \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      5. distribute-lft-in26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative26.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified26.0%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt17.0%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod53.4%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative53.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod38.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt43.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv43.2%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval43.2%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative43.2%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative43.2%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr43.2%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around inf 71.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(2 \cdot \left(-0.5 \cdot y + 1.5 \cdot y\right) - 3 \cdot y\right) + 1.5 \cdot x} \]

    if 2.00000000000000004e-169 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt83.1%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr83.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt86.6%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval86.6%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr86.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 86.6%

      \[\leadsto \color{blue}{x + \left(-0.5 \cdot x + 0.5 \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-+r+86.7%

        \[\leadsto \color{blue}{\left(x + -0.5 \cdot x\right) + 0.5 \cdot y} \]
      2. distribute-rgt1-in86.7%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} + 0.5 \cdot y \]
      3. metadata-eval86.7%

        \[\leadsto \color{blue}{0.5} \cdot x + 0.5 \cdot y \]
      4. distribute-lft-out86.7%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-241}:\\ \;\;\;\;y \cdot -0.5 - 0.5 \cdot \left(x \cdot \left(-1 - 2 \cdot \frac{y \cdot -0.5 + y \cdot 1.5}{y}\right)\right)\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{-278}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-169}:\\ \;\;\;\;x \cdot 1.5 - 0.5 \cdot \left(y \cdot 3 - 2 \cdot \left(y \cdot -0.5 + y \cdot 1.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 58.8% accurate, 4.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-35}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{-51}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-106}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -2.7e-35)
   (* x 0.5)
   (if (<= x -9.2e-51)
     (* y 0.5)
     (if (<= x -1.55e-106)
       (* x 0.5)
       (if (<= x 1.8e-111) (* y 0.5) (* x 1.5))))))
double code(double x, double y) {
	double tmp;
	if (x <= -2.7e-35) {
		tmp = x * 0.5;
	} else if (x <= -9.2e-51) {
		tmp = y * 0.5;
	} else if (x <= -1.55e-106) {
		tmp = x * 0.5;
	} else if (x <= 1.8e-111) {
		tmp = y * 0.5;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.7d-35)) then
        tmp = x * 0.5d0
    else if (x <= (-9.2d-51)) then
        tmp = y * 0.5d0
    else if (x <= (-1.55d-106)) then
        tmp = x * 0.5d0
    else if (x <= 1.8d-111) then
        tmp = y * 0.5d0
    else
        tmp = x * 1.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.7e-35) {
		tmp = x * 0.5;
	} else if (x <= -9.2e-51) {
		tmp = y * 0.5;
	} else if (x <= -1.55e-106) {
		tmp = x * 0.5;
	} else if (x <= 1.8e-111) {
		tmp = y * 0.5;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -2.7e-35:
		tmp = x * 0.5
	elif x <= -9.2e-51:
		tmp = y * 0.5
	elif x <= -1.55e-106:
		tmp = x * 0.5
	elif x <= 1.8e-111:
		tmp = y * 0.5
	else:
		tmp = x * 1.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -2.7e-35)
		tmp = Float64(x * 0.5);
	elseif (x <= -9.2e-51)
		tmp = Float64(y * 0.5);
	elseif (x <= -1.55e-106)
		tmp = Float64(x * 0.5);
	elseif (x <= 1.8e-111)
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(x * 1.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.7e-35)
		tmp = x * 0.5;
	elseif (x <= -9.2e-51)
		tmp = y * 0.5;
	elseif (x <= -1.55e-106)
		tmp = x * 0.5;
	elseif (x <= 1.8e-111)
		tmp = y * 0.5;
	else
		tmp = x * 1.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -2.7e-35], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -9.2e-51], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, -1.55e-106], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 1.8e-111], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-35}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq -9.2 \cdot 10^{-51}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;x \leq -1.55 \cdot 10^{-106}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.6999999999999997e-35 or -9.20000000000000007e-51 < x < -1.54999999999999993e-106

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt87.3%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr87.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt87.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval87.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr87.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 79.9%

      \[\leadsto \color{blue}{x + -0.5 \cdot x} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in79.9%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} \]
      2. metadata-eval79.9%

        \[\leadsto \color{blue}{0.5} \cdot x \]
      3. *-commutative79.9%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified79.9%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if -2.6999999999999997e-35 < x < -9.20000000000000007e-51 or -1.54999999999999993e-106 < x < 1.80000000000000005e-111

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt57.9%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr57.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt59.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval59.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr59.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around inf 54.0%

      \[\leadsto \color{blue}{0.5 \cdot y} \]

    if 1.80000000000000005e-111 < x

    1. Initial program 99.7%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+56.9%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num56.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv56.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt11.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow211.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr11.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval11.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(y + \color{blue}{-1 \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      5. distribute-lft-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod55.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod54.3%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt54.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr54.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around inf 69.2%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    12. Step-by-step derivation
      1. *-commutative69.2%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    13. Simplified69.2%

      \[\leadsto \color{blue}{x \cdot 1.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-35}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{-51}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-106}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.0% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(x + y\right)\\ \mathbf{if}\;x \leq -3.3 \cdot 10^{-255}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -1.72 \cdot 10^{-307}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-111}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ x y))))
   (if (<= x -3.3e-255)
     t_0
     (if (<= x -1.72e-307) (* y -0.5) (if (<= x 1.15e-111) t_0 (* x 1.5))))))
double code(double x, double y) {
	double t_0 = 0.5 * (x + y);
	double tmp;
	if (x <= -3.3e-255) {
		tmp = t_0;
	} else if (x <= -1.72e-307) {
		tmp = y * -0.5;
	} else if (x <= 1.15e-111) {
		tmp = t_0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (x + y)
    if (x <= (-3.3d-255)) then
        tmp = t_0
    else if (x <= (-1.72d-307)) then
        tmp = y * (-0.5d0)
    else if (x <= 1.15d-111) then
        tmp = t_0
    else
        tmp = x * 1.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.5 * (x + y);
	double tmp;
	if (x <= -3.3e-255) {
		tmp = t_0;
	} else if (x <= -1.72e-307) {
		tmp = y * -0.5;
	} else if (x <= 1.15e-111) {
		tmp = t_0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.5 * (x + y)
	tmp = 0
	if x <= -3.3e-255:
		tmp = t_0
	elif x <= -1.72e-307:
		tmp = y * -0.5
	elif x <= 1.15e-111:
		tmp = t_0
	else:
		tmp = x * 1.5
	return tmp
function code(x, y)
	t_0 = Float64(0.5 * Float64(x + y))
	tmp = 0.0
	if (x <= -3.3e-255)
		tmp = t_0;
	elseif (x <= -1.72e-307)
		tmp = Float64(y * -0.5);
	elseif (x <= 1.15e-111)
		tmp = t_0;
	else
		tmp = Float64(x * 1.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.5 * (x + y);
	tmp = 0.0;
	if (x <= -3.3e-255)
		tmp = t_0;
	elseif (x <= -1.72e-307)
		tmp = y * -0.5;
	elseif (x <= 1.15e-111)
		tmp = t_0;
	else
		tmp = x * 1.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.3e-255], t$95$0, If[LessEqual[x, -1.72e-307], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.15e-111], t$95$0, N[(x * 1.5), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x + y\right)\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-255}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -1.72 \cdot 10^{-307}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 1.15 \cdot 10^{-111}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.29999999999999988e-255 or -1.72000000000000008e-307 < x < 1.15e-111

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      2. div-inv100.0%

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt73.8%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr73.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt75.2%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval75.2%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr75.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 75.2%

      \[\leadsto \color{blue}{x + \left(-0.5 \cdot x + 0.5 \cdot y\right)} \]
    6. Step-by-step derivation
      1. associate-+r+75.2%

        \[\leadsto \color{blue}{\left(x + -0.5 \cdot x\right) + 0.5 \cdot y} \]
      2. distribute-rgt1-in75.2%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} + 0.5 \cdot y \]
      3. metadata-eval75.2%

        \[\leadsto \color{blue}{0.5} \cdot x + 0.5 \cdot y \]
      4. distribute-lft-out75.2%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
    7. Simplified75.2%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]

    if -3.29999999999999988e-255 < x < -1.72000000000000008e-307

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+86.9%

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

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt14.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr14.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt15.4%

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

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt14.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr14.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt86.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv86.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr15.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow215.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow215.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares15.4%

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

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr15.4%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg15.4%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval15.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative15.4%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative15.4%

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

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt14.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod85.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative85.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod71.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt72.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv72.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval72.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative72.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative72.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr72.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in y around inf 85.9%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]

    if 1.15e-111 < x

    1. Initial program 99.7%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+56.9%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num56.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv56.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt11.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow211.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr4.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv23.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr11.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow211.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval11.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr11.9%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(y + \color{blue}{-1 \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      5. distribute-lft-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot x + 0.5 \cdot y\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      14. distribute-lft-out13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative13.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified13.8%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt4.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod55.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval55.4%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative55.5%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod54.3%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt54.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative54.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative54.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr54.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in x around inf 69.2%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    12. Step-by-step derivation
      1. *-commutative69.2%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    13. Simplified69.2%

      \[\leadsto \color{blue}{x \cdot 1.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification73.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-255}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq -1.72 \cdot 10^{-307}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-111}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 50.5% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-183}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -4.8e-183) (* y -0.5) (if (<= y 8e-116) x (* y 0.5))))
double code(double x, double y) {
	double tmp;
	if (y <= -4.8e-183) {
		tmp = y * -0.5;
	} else if (y <= 8e-116) {
		tmp = x;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-4.8d-183)) then
        tmp = y * (-0.5d0)
    else if (y <= 8d-116) then
        tmp = x
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -4.8e-183) {
		tmp = y * -0.5;
	} else if (y <= 8e-116) {
		tmp = x;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -4.8e-183:
		tmp = y * -0.5
	elif y <= 8e-116:
		tmp = x
	else:
		tmp = y * 0.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -4.8e-183)
		tmp = Float64(y * -0.5);
	elseif (y <= 8e-116)
		tmp = x;
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -4.8e-183)
		tmp = y * -0.5;
	elseif (y <= 8e-116)
		tmp = x;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -4.8e-183], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8e-116], x, N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-183}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq 8 \cdot 10^{-116}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.79999999999999986e-183

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+54.6%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num54.4%

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt7.8%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr7.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt10.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval10.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow210.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt7.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr7.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt46.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv46.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr10.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow210.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow210.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval10.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr10.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr11.6%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg11.6%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative11.6%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified11.6%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt8.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod53.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod47.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt49.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv49.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval49.9%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative49.9%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative49.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr49.9%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in y around inf 59.6%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]

    if -4.79999999999999986e-183 < y < 8e-116

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 19.3%

      \[\leadsto \color{blue}{x} \]

    if 8e-116 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt82.5%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr82.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt86.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval86.1%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr86.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around inf 71.8%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-183}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 60.1% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-32}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-113}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2.5e-32) (* y -0.5) (if (<= y 8.2e-113) (* x 0.5) (* y 0.5))))
double code(double x, double y) {
	double tmp;
	if (y <= -2.5e-32) {
		tmp = y * -0.5;
	} else if (y <= 8.2e-113) {
		tmp = x * 0.5;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-2.5d-32)) then
        tmp = y * (-0.5d0)
    else if (y <= 8.2d-113) then
        tmp = x * 0.5d0
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2.5e-32) {
		tmp = y * -0.5;
	} else if (y <= 8.2e-113) {
		tmp = x * 0.5;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2.5e-32:
		tmp = y * -0.5
	elif y <= 8.2e-113:
		tmp = x * 0.5
	else:
		tmp = y * 0.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2.5e-32)
		tmp = Float64(y * -0.5);
	elseif (y <= 8.2e-113)
		tmp = Float64(x * 0.5);
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2.5e-32)
		tmp = y * -0.5;
	elseif (y <= 8.2e-113)
		tmp = x * 0.5;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2.5e-32], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8.2e-113], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-32}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{-113}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.5e-32

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+51.7%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \frac{\left|y - x\right|}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}}} \]
      3. div-inv51.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt3.1%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr3.1%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt5.3%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval5.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow25.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt3.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr3.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt44.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv44.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr5.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow25.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow25.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval5.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr5.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares6.4%

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

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr6.4%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg6.4%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval6.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative6.4%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative6.4%

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

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt3.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod49.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr49.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval49.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval49.8%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr49.9%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative49.9%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative49.9%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod49.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt50.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv50.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval50.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative50.6%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative50.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr50.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in y around inf 70.0%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]

    if -2.5e-32 < y < 8.1999999999999999e-113

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt46.1%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr46.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt54.4%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval54.4%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr54.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around 0 53.5%

      \[\leadsto \color{blue}{x + -0.5 \cdot x} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in53.5%

        \[\leadsto \color{blue}{\left(-0.5 + 1\right) \cdot x} \]
      2. metadata-eval53.5%

        \[\leadsto \color{blue}{0.5} \cdot x \]
      3. *-commutative53.5%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified53.5%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if 8.1999999999999999e-113 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      4. add-sqr-sqrt82.5%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|, \frac{1}{2}, x\right) \]
      5. fabs-sqr82.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      6. add-sqr-sqrt86.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      7. metadata-eval86.1%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.5}, x\right) \]
    4. Applied egg-rr86.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \]
    5. Taylor expanded in y around inf 71.8%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification64.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-32}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-113}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 31.2% accurate, 13.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-182}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= y -1.9e-182) (* y -0.5) x))
double code(double x, double y) {
	double tmp;
	if (y <= -1.9e-182) {
		tmp = y * -0.5;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.9d-182)) then
        tmp = y * (-0.5d0)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.9e-182) {
		tmp = y * -0.5;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.9e-182:
		tmp = y * -0.5
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.9e-182)
		tmp = Float64(y * -0.5);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.9e-182)
		tmp = y * -0.5;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.9e-182], N[(y * -0.5), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-182}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;x\\


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

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+54.6%

        \[\leadsto \color{blue}{\frac{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}{x - \frac{\left|y - x\right|}{2}}} \]
      2. clear-num54.4%

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left|y - x\right| \cdot \frac{1}{2}}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      4. add-sqr-sqrt7.8%

        \[\leadsto \frac{1}{\frac{x - \left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right| \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      5. fabs-sqr7.8%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(\sqrt{y - x} \cdot \sqrt{y - x}\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      6. add-sqr-sqrt10.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right)} \cdot \frac{1}{2}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      7. metadata-eval10.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \color{blue}{0.5}}{x \cdot x - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      8. pow210.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{{x}^{2}} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|y - x\right|}{2}}} \]
      9. add-sqr-sqrt7.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}{2}}} \]
      10. fabs-sqr7.7%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}{2}}} \]
      11. add-sqr-sqrt46.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \frac{\color{blue}{y - x}}{2}}} \]
      12. div-inv46.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - \frac{\left|y - x\right|}{2} \cdot \color{blue}{\left(\left(y - x\right) \cdot \frac{1}{2}\right)}}} \]
    4. Applied egg-rr10.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{{x}^{2} - {\left(y - x\right)}^{2} \cdot 0.25}}} \]
    5. Step-by-step derivation
      1. unpow210.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{x \cdot x} - {\left(y - x\right)}^{2} \cdot 0.25}} \]
      2. unpow210.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right)} \cdot 0.25}} \]
      3. metadata-eval10.1%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(0.5 \cdot 0.5\right)}}} \]
      4. swap-sqr10.2%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{x \cdot x - \color{blue}{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}} \]
      5. difference-of-squares11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(x + \left(y - x\right) \cdot 0.5\right) \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}}} \]
      6. +-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      7. fma-undefine11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right)} \cdot \left(x - \left(y - x\right) \cdot 0.5\right)}} \]
      8. sub-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \color{blue}{\left(x + \left(-\left(y - x\right) \cdot 0.5\right)\right)}}} \]
      9. distribute-rgt-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \color{blue}{\left(y - x\right) \cdot \left(-0.5\right)}\right)}} \]
      10. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot \color{blue}{-0.5}\right)}} \]
    6. Applied egg-rr11.6%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\mathsf{fma}\left(y - x, 0.5, x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}}} \]
    7. Step-by-step derivation
      1. fma-define11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(\left(y - x\right) \cdot 0.5 + x\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      2. *-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{0.5 \cdot \left(y - x\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      3. sub-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \color{blue}{\left(y + \left(-x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      4. mul-1-neg11.6%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\color{blue}{\left(0.5 \cdot y + 0.5 \cdot \left(-1 \cdot x\right)\right)} + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      6. mul-1-neg11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + 0.5 \cdot \color{blue}{\left(-x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      7. distribute-rgt-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5 \cdot x\right)}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      8. distribute-lft-neg-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{\left(-0.5\right) \cdot x}\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      9. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(\left(0.5 \cdot y + \color{blue}{-0.5} \cdot x\right) + x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      10. associate-+r+11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot y + \left(-0.5 \cdot x + x\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      11. distribute-lft1-in11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{\left(-0.5 + 1\right) \cdot x}\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      12. metadata-eval11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot y + \color{blue}{0.5} \cdot x\right) \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      13. +-commutative11.6%

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right)} \cdot \left(x + \left(y - x\right) \cdot -0.5\right)}} \]
      15. *-commutative11.6%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + \color{blue}{-0.5 \cdot \left(y - x\right)}\right)}} \]
    8. Simplified11.6%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot 0.5}{\color{blue}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt8.6%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(y - x\right) \cdot 0.5} \cdot \sqrt{\left(y - x\right) \cdot 0.5}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      2. sqrt-unprod53.2%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{\left(\left(y - x\right) \cdot 0.5\right) \cdot \left(\left(y - x\right) \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      3. swap-sqr53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \left(0.5 \cdot 0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      4. metadata-eval53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{0.25}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      5. metadata-eval53.1%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(\left(y - x\right) \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      6. swap-sqr53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(\left(y - x\right) \cdot -0.5\right) \cdot \left(\left(y - x\right) \cdot -0.5\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      7. *-commutative53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)} \cdot \left(\left(y - x\right) \cdot -0.5\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      8. *-commutative53.2%

        \[\leadsto \frac{1}{\frac{x - \sqrt{\left(-0.5 \cdot \left(y - x\right)\right) \cdot \color{blue}{\left(-0.5 \cdot \left(y - x\right)\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      9. sqrt-unprod47.5%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\sqrt{-0.5 \cdot \left(y - x\right)} \cdot \sqrt{-0.5 \cdot \left(y - x\right)}}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      10. add-sqr-sqrt49.9%

        \[\leadsto \frac{1}{\frac{x - \color{blue}{-0.5 \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      11. cancel-sign-sub-inv49.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{x + \left(--0.5\right) \cdot \left(y - x\right)}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      12. metadata-eval49.9%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{0.5} \cdot \left(y - x\right)}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      13. *-commutative49.9%

        \[\leadsto \frac{1}{\frac{x + \color{blue}{\left(y - x\right) \cdot 0.5}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
      14. +-commutative49.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    10. Applied egg-rr49.9%

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(y - x\right) \cdot 0.5 + x}}{\left(0.5 \cdot \left(x + y\right)\right) \cdot \left(x + -0.5 \cdot \left(y - x\right)\right)}} \]
    11. Taylor expanded in y around inf 59.6%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]

    if -1.9000000000000002e-182 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 12.7%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-182}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 11.5% accurate, 107.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
	return x;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x
end function
public static double code(double x, double y) {
	return x;
}
def code(x, y):
	return x
function code(x, y)
	return x
end
function tmp = code(x, y)
	tmp = x;
end
code[x_, y_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{\left|y - x\right|}{2} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 11.7%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification11.7%

    \[\leadsto x \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024046 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  :precision binary64
  (+ x (/ (fabs (- y x)) 2.0)))