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

Percentage Accurate: 99.9% → 99.9%
Time: 6.7s
Alternatives: 8
Speedup: 1.7×

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 8 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.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left|x - y\right|, 0.5, x\right) \end{array} \]
(FPCore (x y) :precision binary64 (fma (fabs (- x y)) 0.5 x))
double code(double x, double y) {
	return fma(fabs((x - y)), 0.5, x);
}
function code(x, y)
	return fma(abs(Float64(x - y)), 0.5, x)
end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] * 0.5 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left|x - y\right|, 0.5, x\right)
\end{array}
Derivation
  1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left|y - x\right| + x} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
    3. sub-negN/A

      \[\leadsto \left|\color{blue}{y + \left(\mathsf{neg}\left(x\right)\right)}\right| \cdot \frac{1}{2} + x \]
    4. mul-1-negN/A

      \[\leadsto \left|y + \color{blue}{-1 \cdot x}\right| \cdot \frac{1}{2} + x \]
    5. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y + -1 \cdot x\right|, \frac{1}{2}, x\right)} \]
    6. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left|y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right|, \frac{1}{2}, x\right) \]
    7. remove-double-negN/A

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
    8. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
    9. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(-1 \cdot y + x\right)\right)}\right|, \frac{1}{2}, x\right) \]
    10. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left|\mathsf{neg}\left(\color{blue}{\left(x + -1 \cdot y\right)}\right)\right|, \frac{1}{2}, x\right) \]
    11. lower-fabs.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left|\mathsf{neg}\left(\left(x + -1 \cdot y\right)\right)\right|}, \frac{1}{2}, x\right) \]
    12. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left|\mathsf{neg}\left(\color{blue}{\left(-1 \cdot y + x\right)}\right)\right|, \frac{1}{2}, x\right) \]
    13. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\left(\mathsf{neg}\left(-1 \cdot y\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right|, \frac{1}{2}, x\right) \]
    14. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
    15. remove-double-negN/A

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
    16. sub-negN/A

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y - x}\right|, \frac{1}{2}, x\right) \]
    17. lower--.f6499.9

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y - x}\right|, 0.5, x\right) \]
  5. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, 0.5, x\right)} \]
  6. Final simplification99.9%

    \[\leadsto \mathsf{fma}\left(\left|x - y\right|, 0.5, x\right) \]
  7. Add Preprocessing

Alternative 2: 59.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\
\;\;\;\;-0.5 \cdot y\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-41}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.25e38

    1. Initial program 100.0%

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

        \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
      2. lift--.f64N/A

        \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      3. fabs-subN/A

        \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
      4. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
      5. sqrt-prodN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. lower-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      7. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      8. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      9. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      10. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      11. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      12. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      13. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      14. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      15. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      16. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      17. lower-sqrt.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
      18. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      19. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      20. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      21. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      22. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      23. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      24. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      25. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      26. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      27. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      28. lower--.f64N/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
    4. Applied rewrites93.7%

      \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f648.5

        \[\leadsto \color{blue}{1.5 \cdot x} \]
    7. Applied rewrites8.5%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    8. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
    9. Step-by-step derivation
      1. lower-*.f6486.4

        \[\leadsto \color{blue}{-0.5 \cdot y} \]
    10. Applied rewrites86.4%

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

    if -3.25e38 < y < 3.79999999999999979e-41

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      3. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
      4. div-invN/A

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      6. lift-fabs.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
      7. rem-sqrt-square-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      9. rem-square-sqrtN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - x}, \frac{1}{2}, x\right) \]
      10. metadata-eval62.5

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6455.4

        \[\leadsto \color{blue}{0.5 \cdot x} \]
    7. Applied rewrites55.4%

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

    if 3.79999999999999979e-41 < y

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      3. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
      4. div-invN/A

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      6. lift-fabs.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
      7. rem-sqrt-square-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      9. rem-square-sqrtN/A

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f6475.6

        \[\leadsto \color{blue}{0.5 \cdot y} \]
    7. Applied rewrites75.6%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 58.0% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;x \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;-0.5 \cdot y\\

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


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

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
      3. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
      4. div-invN/A

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
      6. lift-fabs.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
      7. rem-sqrt-square-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
      8. sqrt-prodN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
      9. rem-square-sqrtN/A

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6468.9

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

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

    if -7.59999999999999995e-100 < x < 1.0999999999999999e-9

    1. Initial program 99.9%

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

        \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
      2. lift--.f64N/A

        \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      3. fabs-subN/A

        \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
      4. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
      5. sqrt-prodN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. lower-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      7. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      8. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      9. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      10. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      11. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      12. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      13. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      14. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      15. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      16. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      17. lower-sqrt.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
      18. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      19. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      20. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      21. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      22. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      23. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      24. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      25. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      26. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      27. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      28. lower--.f64N/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
    4. Applied rewrites52.0%

      \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6417.0

        \[\leadsto \color{blue}{1.5 \cdot x} \]
    7. Applied rewrites17.0%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    8. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
    9. Step-by-step derivation
      1. lower-*.f6439.8

        \[\leadsto \color{blue}{-0.5 \cdot y} \]
    10. Applied rewrites39.8%

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

    if 1.0999999999999999e-9 < x

    1. Initial program 99.8%

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

        \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
      2. lift--.f64N/A

        \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      3. fabs-subN/A

        \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
      4. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
      5. sqrt-prodN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. lower-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      7. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      8. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      9. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      10. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      11. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      12. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      13. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      14. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      15. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      16. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      17. lower-sqrt.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
      18. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      19. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      20. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      21. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      22. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      23. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      24. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      25. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      26. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      27. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      28. lower--.f64N/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
    4. Applied rewrites88.4%

      \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6475.3

        \[\leadsto \color{blue}{1.5 \cdot x} \]
    7. Applied rewrites75.3%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 77.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-134}:\\ \;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.9e-134) (fma (- x y) 0.5 x) (* (+ y x) 0.5)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.9e-134) {
		tmp = fma((x - y), 0.5, x);
	} else {
		tmp = (y + x) * 0.5;
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (y <= -1.9e-134)
		tmp = fma(Float64(x - y), 0.5, x);
	else
		tmp = Float64(Float64(y + x) * 0.5);
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -1.9e-134], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-134}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\

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


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left|y - x\right| + x} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
      3. sub-negN/A

        \[\leadsto \left|\color{blue}{y + \left(\mathsf{neg}\left(x\right)\right)}\right| \cdot \frac{1}{2} + x \]
      4. mul-1-negN/A

        \[\leadsto \left|y + \color{blue}{-1 \cdot x}\right| \cdot \frac{1}{2} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y + -1 \cdot x\right|, \frac{1}{2}, x\right)} \]
      6. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left|y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right|, \frac{1}{2}, x\right) \]
      7. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
      9. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(-1 \cdot y + x\right)\right)}\right|, \frac{1}{2}, x\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left|\mathsf{neg}\left(\color{blue}{\left(x + -1 \cdot y\right)}\right)\right|, \frac{1}{2}, x\right) \]
      11. lower-fabs.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|\mathsf{neg}\left(\left(x + -1 \cdot y\right)\right)\right|}, \frac{1}{2}, x\right) \]
      12. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left|\mathsf{neg}\left(\color{blue}{\left(-1 \cdot y + x\right)}\right)\right|, \frac{1}{2}, x\right) \]
      13. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\left(\mathsf{neg}\left(-1 \cdot y\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right|, \frac{1}{2}, x\right) \]
      14. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
      15. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)\right|, \frac{1}{2}, x\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y - x}\right|, \frac{1}{2}, x\right) \]
      17. lower--.f6499.9

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{y - x}\right|, 0.5, x\right) \]
    5. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, 0.5, x\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites82.9%

        \[\leadsto \mathsf{fma}\left(x - y, 0.5, x\right) \]

      if -1.90000000000000001e-134 < y

      1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
        3. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
        4. div-invN/A

          \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
        5. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
        6. lift-fabs.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
        7. rem-sqrt-square-revN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
        9. rem-square-sqrtN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + \frac{1}{2} \cdot y} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        3. lower-+.f6476.6

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

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification78.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-134}:\\ \;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) \cdot 0.5\\ \end{array} \]
    9. Add Preprocessing

    Alternative 5: 70.2% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-7}:\\ \;\;\;\;-0.5 \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) \cdot 0.5\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y -1.5e-7) (+ (* -0.5 y) x) (* (+ y x) 0.5)))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -1.5e-7) {
    		tmp = (-0.5 * y) + x;
    	} else {
    		tmp = (y + x) * 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 <= (-1.5d-7)) then
            tmp = ((-0.5d0) * y) + x
        else
            tmp = (y + x) * 0.5d0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= -1.5e-7) {
    		tmp = (-0.5 * y) + x;
    	} else {
    		tmp = (y + x) * 0.5;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= -1.5e-7:
    		tmp = (-0.5 * y) + x
    	else:
    		tmp = (y + x) * 0.5
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -1.5e-7)
    		tmp = Float64(Float64(-0.5 * y) + x);
    	else
    		tmp = Float64(Float64(y + x) * 0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= -1.5e-7)
    		tmp = (-0.5 * y) + x;
    	else
    		tmp = (y + x) * 0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, -1.5e-7], N[(N[(-0.5 * y), $MachinePrecision] + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -1.5 \cdot 10^{-7}:\\
    \;\;\;\;-0.5 \cdot y + x\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(y + x\right) \cdot 0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -1.4999999999999999e-7

      1. Initial program 99.9%

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

          \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
        2. lift--.f64N/A

          \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        3. fabs-subN/A

          \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
        4. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
        5. sqrt-prodN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        6. lower-*.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        7. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        8. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        9. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        10. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        11. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        12. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        13. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        14. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        15. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        16. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        17. lower-sqrt.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
        18. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        19. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        20. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        21. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        22. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        23. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        24. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        25. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        26. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        27. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
        28. lower--.f64N/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      4. Applied rewrites91.0%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      5. Taylor expanded in x around 0

        \[\leadsto x + \color{blue}{\frac{-1}{2} \cdot y} \]
      6. Step-by-step derivation
        1. lower-*.f6482.9

          \[\leadsto x + \color{blue}{-0.5 \cdot y} \]
      7. Applied rewrites82.9%

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

      if -1.4999999999999999e-7 < y

      1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
        3. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
        4. div-invN/A

          \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
        5. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
        6. lift-fabs.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
        7. rem-sqrt-square-revN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
        9. rem-square-sqrtN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + \frac{1}{2} \cdot y} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        3. lower-+.f6473.4

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

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

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

    Alternative 6: 68.2% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) \cdot 0.5\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y -3.25e+38) (* -0.5 y) (* (+ y x) 0.5)))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -3.25e+38) {
    		tmp = -0.5 * y;
    	} else {
    		tmp = (y + x) * 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 <= (-3.25d+38)) then
            tmp = (-0.5d0) * y
        else
            tmp = (y + x) * 0.5d0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= -3.25e+38) {
    		tmp = -0.5 * y;
    	} else {
    		tmp = (y + x) * 0.5;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= -3.25e+38:
    		tmp = -0.5 * y
    	else:
    		tmp = (y + x) * 0.5
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -3.25e+38)
    		tmp = Float64(-0.5 * y);
    	else
    		tmp = Float64(Float64(y + x) * 0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= -3.25e+38)
    		tmp = -0.5 * y;
    	else
    		tmp = (y + x) * 0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, -3.25e+38], N[(-0.5 * y), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * 0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\
    \;\;\;\;-0.5 \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(y + x\right) \cdot 0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -3.25e38

      1. Initial program 100.0%

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

          \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
        2. lift--.f64N/A

          \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        3. fabs-subN/A

          \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
        4. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
        5. sqrt-prodN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        6. lower-*.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        7. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        8. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        9. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        10. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        11. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        12. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        13. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        14. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        15. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        16. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        17. lower-sqrt.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
        18. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        19. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        20. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        21. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        22. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        23. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        24. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        25. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        26. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        27. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
        28. lower--.f64N/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      4. Applied rewrites93.7%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
      6. Step-by-step derivation
        1. lower-*.f648.5

          \[\leadsto \color{blue}{1.5 \cdot x} \]
      7. Applied rewrites8.5%

        \[\leadsto \color{blue}{1.5 \cdot x} \]
      8. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
      9. Step-by-step derivation
        1. lower-*.f6486.4

          \[\leadsto \color{blue}{-0.5 \cdot y} \]
      10. Applied rewrites86.4%

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

      if -3.25e38 < y

      1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x + \frac{\left|y - x\right|}{2}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x} \]
        3. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2}} + x \]
        4. div-invN/A

          \[\leadsto \color{blue}{\left|y - x\right| \cdot \frac{1}{2}} + x \]
        5. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left|y - x\right|, \frac{1}{2}, x\right)} \]
        6. lift-fabs.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|y - x\right|}, \frac{1}{2}, x\right) \]
        7. rem-sqrt-square-revN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}, \frac{1}{2}, x\right) \]
        8. sqrt-prodN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}, \frac{1}{2}, x\right) \]
        9. rem-square-sqrtN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + \frac{1}{2} \cdot y} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)} \]
        3. lower-+.f6472.2

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.25 \cdot 10^{+38}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) \cdot 0.5\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 44.2% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+28}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
    (FPCore (x y) :precision binary64 (if (<= y -5e+28) (* -0.5 y) (* 1.5 x)))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -5e+28) {
    		tmp = -0.5 * y;
    	} else {
    		tmp = 1.5 * x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (y <= (-5d+28)) then
            tmp = (-0.5d0) * y
        else
            tmp = 1.5d0 * x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= -5e+28) {
    		tmp = -0.5 * y;
    	} else {
    		tmp = 1.5 * x;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= -5e+28:
    		tmp = -0.5 * y
    	else:
    		tmp = 1.5 * x
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -5e+28)
    		tmp = Float64(-0.5 * y);
    	else
    		tmp = Float64(1.5 * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= -5e+28)
    		tmp = -0.5 * y;
    	else
    		tmp = 1.5 * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, -5e+28], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -5 \cdot 10^{+28}:\\
    \;\;\;\;-0.5 \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;1.5 \cdot x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -4.99999999999999957e28

      1. Initial program 100.0%

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

          \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
        2. lift--.f64N/A

          \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        3. fabs-subN/A

          \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
        4. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
        5. sqrt-prodN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        6. lower-*.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        7. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        8. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        9. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        10. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        11. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        12. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        13. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        14. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        15. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        16. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        17. lower-sqrt.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
        18. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        19. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        20. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        21. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        22. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        23. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        24. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        25. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        26. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        27. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
        28. lower--.f64N/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      4. Applied rewrites92.0%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
      6. Step-by-step derivation
        1. lower-*.f648.6

          \[\leadsto \color{blue}{1.5 \cdot x} \]
      7. Applied rewrites8.6%

        \[\leadsto \color{blue}{1.5 \cdot x} \]
      8. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
      9. Step-by-step derivation
        1. lower-*.f6485.1

          \[\leadsto \color{blue}{-0.5 \cdot y} \]
      10. Applied rewrites85.1%

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

      if -4.99999999999999957e28 < y

      1. Initial program 99.9%

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

          \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
        2. lift--.f64N/A

          \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        3. fabs-subN/A

          \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
        4. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
        5. sqrt-prodN/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        6. lower-*.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
        7. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        8. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        9. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        10. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        11. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        12. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        13. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        14. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        15. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        16. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        17. lower-sqrt.f64N/A

          \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
        18. lift-fabs.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
        19. rem-sqrt-square-revN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
        20. sqrt-prodN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
        21. rem-square-sqrtN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        22. lift--.f64N/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        23. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        24. +-commutativeN/A

          \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
        25. distribute-neg-inN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
        26. remove-double-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
        27. sub-negN/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
        28. lower--.f64N/A

          \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      4. Applied rewrites32.2%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
      6. Step-by-step derivation
        1. lower-*.f6432.5

          \[\leadsto \color{blue}{1.5 \cdot x} \]
      7. Applied rewrites32.5%

        \[\leadsto \color{blue}{1.5 \cdot x} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 8: 25.9% accurate, 3.3× speedup?

    \[\begin{array}{l} \\ -0.5 \cdot y \end{array} \]
    (FPCore (x y) :precision binary64 (* -0.5 y))
    double code(double x, double y) {
    	return -0.5 * y;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        code = (-0.5d0) * y
    end function
    
    public static double code(double x, double y) {
    	return -0.5 * y;
    }
    
    def code(x, y):
    	return -0.5 * y
    
    function code(x, y)
    	return Float64(-0.5 * y)
    end
    
    function tmp = code(x, y)
    	tmp = -0.5 * y;
    end
    
    code[x_, y_] := N[(-0.5 * y), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    -0.5 \cdot y
    \end{array}
    
    Derivation
    1. Initial program 99.9%

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

        \[\leadsto x + \frac{\color{blue}{\left|y - x\right|}}{2} \]
      2. lift--.f64N/A

        \[\leadsto x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      3. fabs-subN/A

        \[\leadsto x + \frac{\color{blue}{\left|x - y\right|}}{2} \]
      4. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{2} \]
      5. sqrt-prodN/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. lower-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      7. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      8. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      9. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      10. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      11. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      12. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      13. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      14. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      15. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      16. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      17. lower-sqrt.f64N/A

        \[\leadsto x + \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\left|y - x\right|\right)}} \cdot \sqrt{x - y}}{2} \]
      18. lift-fabs.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left|y - x\right|}\right)} \cdot \sqrt{x - y}}{2} \]
      19. rem-sqrt-square-revN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}}\right)} \cdot \sqrt{x - y}}{2} \]
      20. sqrt-prodN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right)} \cdot \sqrt{x - y}}{2} \]
      21. rem-square-sqrtN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      22. lift--.f64N/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y - x\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      23. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      24. +-commutativeN/A

        \[\leadsto x + \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + y\right)}\right)} \cdot \sqrt{x - y}}{2} \]
      25. distribute-neg-inN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}} \cdot \sqrt{x - y}}{2} \]
      26. remove-double-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x} + \left(\mathsf{neg}\left(y\right)\right)} \cdot \sqrt{x - y}}{2} \]
      27. sub-negN/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
      28. lower--.f64N/A

        \[\leadsto x + \frac{\sqrt{\color{blue}{x - y}} \cdot \sqrt{x - y}}{2} \]
    4. Applied rewrites45.1%

      \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6427.3

        \[\leadsto \color{blue}{1.5 \cdot x} \]
    7. Applied rewrites27.3%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    8. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
    9. Step-by-step derivation
      1. lower-*.f6425.3

        \[\leadsto \color{blue}{-0.5 \cdot y} \]
    10. Applied rewrites25.3%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    11. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024298 
    (FPCore (x y)
      :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
      :precision binary64
      (+ x (/ (fabs (- y x)) 2.0)))