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

Percentage Accurate: 99.9% → 99.9%
Time: 9.6s
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|y - x\right|, 0.5, x\right) \end{array} \]
(FPCore (x y) :precision binary64 (fma (fabs (- y x)) 0.5 x))
double code(double x, double y) {
	return fma(fabs((y - x)), 0.5, x);
}
function code(x, y)
	return fma(abs(Float64(y - x)), 0.5, x)
end
code[x_, y_] := N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left|y - x\right|, 0.5, x\right)
\end{array}
Derivation
  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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
    2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

Alternative 2: 73.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + \frac{\left|y - x\right|}{2} \leq 4 \cdot 10^{-160}:\\
\;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) < 4e-160

    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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(x\right)}\right|, \frac{1}{2}, x\right) \]
      2. lower-neg.f6493.2

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
    7. Applied rewrites93.2%

      \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
    8. Step-by-step derivation
      1. neg-fabsN/A

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
    9. Applied rewrites93.2%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]

    if 4e-160 < (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64)))

    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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
      2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{\left|y - x\right|}{x} + 1\right)} \cdot x \]
      3. distribute-lft1-inN/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{\left|y - x\right|}{x}\right) \cdot x + x} \]
    7. Applied rewrites99.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{0.5} \cdot \left|x - y\right|, \sqrt{0.5}, x\right)} \]
      2. Step-by-step derivation
        1. lift-sqrt.f64N/A

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

          \[\leadsto \left(\sqrt{\frac{1}{2}} \cdot \left|\color{blue}{x - y}\right|\right) \cdot \sqrt{\frac{1}{2}} + x \]
        3. rem-sqrt-squareN/A

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

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

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

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

          \[\leadsto \left(\left(x - y\right) \cdot \sqrt{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt{\frac{1}{2}}} + x \]
        8. associate-*l*N/A

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\sqrt{x - y} \cdot \sqrt{x - y}\right)} \cdot \frac{1}{2} + x \]
        16. lift-fma.f6460.6

          \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right)} \]
      3. Applied rewrites61.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x - y, 0.5, x\right)} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 3: 79.8% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(x, 1.5, y \cdot -0.5\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y -2.6e-154)
       (fma x 1.5 (* y -0.5))
       (if (<= y 5.4e-105) (fma (fabs x) 0.5 x) (* (fabs (- y x)) 0.5))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -2.6e-154) {
    		tmp = fma(x, 1.5, (y * -0.5));
    	} else if (y <= 5.4e-105) {
    		tmp = fma(fabs(x), 0.5, x);
    	} else {
    		tmp = fabs((y - x)) * 0.5;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -2.6e-154)
    		tmp = fma(x, 1.5, Float64(y * -0.5));
    	elseif (y <= 5.4e-105)
    		tmp = fma(abs(x), 0.5, x);
    	else
    		tmp = Float64(abs(Float64(y - x)) * 0.5);
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, -2.6e-154], N[(x * 1.5 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e-105], N[(N[Abs[x], $MachinePrecision] * 0.5 + x), $MachinePrecision], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\
    \;\;\;\;\mathsf{fma}\left(x, 1.5, y \cdot -0.5\right)\\
    
    \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\
    \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|y - x\right| \cdot 0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -2.6e-154

      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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
      6. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
        14. lower-sqrt.f6483.0

          \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, 0.5, x\right) \]
      7. Applied rewrites83.0%

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{3}{2}, \frac{-1}{2} \cdot y\right)} \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(x, \frac{3}{2}, \color{blue}{y \cdot \frac{-1}{2}}\right) \]
        5. lower-*.f6486.5

          \[\leadsto \mathsf{fma}\left(x, 1.5, \color{blue}{y \cdot -0.5}\right) \]
      10. Applied rewrites86.5%

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

      if -2.6e-154 < y < 5.39999999999999985e-105

      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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(x\right)}\right|, \frac{1}{2}, x\right) \]
        2. lower-neg.f6490.3

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
      7. Applied rewrites90.3%

        \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
      8. Step-by-step derivation
        1. neg-fabsN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, \frac{1}{2}, x\right) \]
        2. lift-fabs.f6490.3

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
      9. Applied rewrites90.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]

      if 5.39999999999999985e-105 < y

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{2} \cdot \left|\color{blue}{y - x}\right| \]
        15. lower--.f6471.3

          \[\leadsto 0.5 \cdot \left|\color{blue}{y - x}\right| \]
      5. Applied rewrites71.3%

        \[\leadsto \color{blue}{0.5 \cdot \left|y - x\right|} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification81.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(x, 1.5, y \cdot -0.5\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 79.8% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y -2.6e-154)
       (fma (- x y) 0.5 x)
       (if (<= y 5.4e-105) (fma (fabs x) 0.5 x) (* (fabs (- y x)) 0.5))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -2.6e-154) {
    		tmp = fma((x - y), 0.5, x);
    	} else if (y <= 5.4e-105) {
    		tmp = fma(fabs(x), 0.5, x);
    	} else {
    		tmp = fabs((y - x)) * 0.5;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -2.6e-154)
    		tmp = fma(Float64(x - y), 0.5, x);
    	elseif (y <= 5.4e-105)
    		tmp = fma(abs(x), 0.5, x);
    	else
    		tmp = Float64(abs(Float64(y - x)) * 0.5);
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, -2.6e-154], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], If[LessEqual[y, 5.4e-105], N[(N[Abs[x], $MachinePrecision] * 0.5 + x), $MachinePrecision], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\
    \;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
    
    \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\
    \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|y - x\right| \cdot 0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -2.6e-154

      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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{\left|y - x\right|}{x} + 1\right)} \cdot x \]
        3. distribute-lft1-inN/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{\left|y - x\right|}{x}\right) \cdot x + x} \]
      7. Applied rewrites99.8%

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{0.5} \cdot \left|x - y\right|, \sqrt{0.5}, x\right)} \]
        2. Step-by-step derivation
          1. lift-sqrt.f64N/A

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

            \[\leadsto \left(\sqrt{\frac{1}{2}} \cdot \left|\color{blue}{x - y}\right|\right) \cdot \sqrt{\frac{1}{2}} + x \]
          3. rem-sqrt-squareN/A

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

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

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

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

            \[\leadsto \left(\left(x - y\right) \cdot \sqrt{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt{\frac{1}{2}}} + x \]
          8. associate-*l*N/A

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(\sqrt{x - y} \cdot \sqrt{x - y}\right)} \cdot \frac{1}{2} + x \]
          16. lift-fma.f6483.0

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

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

        if -2.6e-154 < y < 5.39999999999999985e-105

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(x\right)}\right|, \frac{1}{2}, x\right) \]
          2. lower-neg.f6490.3

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        7. Applied rewrites90.3%

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        8. Step-by-step derivation
          1. neg-fabsN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, \frac{1}{2}, x\right) \]
          2. lift-fabs.f6490.3

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
        9. Applied rewrites90.3%

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]

        if 5.39999999999999985e-105 < y

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left|\color{blue}{y - x}\right| \]
          15. lower--.f6471.3

            \[\leadsto 0.5 \cdot \left|\color{blue}{y - x}\right| \]
        5. Applied rewrites71.3%

          \[\leadsto \color{blue}{0.5 \cdot \left|y - x\right|} \]
      9. Recombined 3 regimes into one program.
      10. Final simplification81.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-105}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left|y - x\right| \cdot 0.5\\ \end{array} \]
      11. Add Preprocessing

      Alternative 5: 63.9% accurate, 1.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-54}:\\ \;\;\;\;\mathsf{fma}\left(-y, 0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (<= y -5e-54) (fma (- y) 0.5 x) (fma (fabs x) 0.5 x)))
      double code(double x, double y) {
      	double tmp;
      	if (y <= -5e-54) {
      		tmp = fma(-y, 0.5, x);
      	} else {
      		tmp = fma(fabs(x), 0.5, x);
      	}
      	return tmp;
      }
      
      function code(x, y)
      	tmp = 0.0
      	if (y <= -5e-54)
      		tmp = fma(Float64(-y), 0.5, x);
      	else
      		tmp = fma(abs(x), 0.5, x);
      	end
      	return tmp
      end
      
      code[x_, y_] := If[LessEqual[y, -5e-54], N[((-y) * 0.5 + x), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * 0.5 + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -5 \cdot 10^{-54}:\\
      \;\;\;\;\mathsf{fma}\left(-y, 0.5, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -5.00000000000000015e-54

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
        6. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
          14. lower-sqrt.f6486.1

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, 0.5, x\right) \]
        7. Applied rewrites86.1%

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{-1 \cdot y}, \frac{1}{2}, x\right) \]
        9. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(y\right)}, \frac{1}{2}, x\right) \]
          2. lower-neg.f6471.7

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

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

        if -5.00000000000000015e-54 < y

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(x\right)}\right|, \frac{1}{2}, x\right) \]
          2. lower-neg.f6458.1

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        7. Applied rewrites58.1%

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        8. Step-by-step derivation
          1. neg-fabsN/A

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
        9. Applied rewrites58.1%

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 6: 62.7% accurate, 1.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.68 \cdot 10^{-47}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (<= y -1.68e-47) (* y -0.5) (fma (fabs x) 0.5 x)))
      double code(double x, double y) {
      	double tmp;
      	if (y <= -1.68e-47) {
      		tmp = y * -0.5;
      	} else {
      		tmp = fma(fabs(x), 0.5, x);
      	}
      	return tmp;
      }
      
      function code(x, y)
      	tmp = 0.0
      	if (y <= -1.68e-47)
      		tmp = Float64(y * -0.5);
      	else
      		tmp = fma(abs(x), 0.5, x);
      	end
      	return tmp
      end
      
      code[x_, y_] := If[LessEqual[y, -1.68e-47], N[(y * -0.5), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * 0.5 + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -1.68 \cdot 10^{-47}:\\
      \;\;\;\;y \cdot -0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\left|x\right|, 0.5, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.67999999999999991e-47

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
        6. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
          14. lower-sqrt.f6487.3

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, 0.5, x\right) \]
        7. Applied rewrites87.3%

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

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

            \[\leadsto \color{blue}{y \cdot \frac{-1}{2}} \]
          2. lower-*.f6467.3

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

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

        if -1.67999999999999991e-47 < y

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(x\right)}\right|, \frac{1}{2}, x\right) \]
          2. lower-neg.f6458.1

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        7. Applied rewrites58.1%

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{-x}\right|, 0.5, x\right) \]
        8. Step-by-step derivation
          1. neg-fabsN/A

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
        9. Applied rewrites58.1%

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left|x\right|}, 0.5, x\right) \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 7: 45.7% accurate, 1.7× speedup?

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

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
        6. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
          14. lower-sqrt.f6486.1

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, 0.5, x\right) \]
        7. Applied rewrites86.1%

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

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

            \[\leadsto \color{blue}{y \cdot \frac{-1}{2}} \]
          2. lower-*.f6466.7

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

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

        if -2.40000000000000013e-54 < y

        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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
          2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
        6. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

            \[\leadsto \mathsf{fma}\left(\sqrt{\left|y - x\right|} \cdot \sqrt{\color{blue}{\left|y - x\right|}}, \frac{1}{2}, x\right) \]
          5. rem-square-sqrt100.0

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
          14. lower-sqrt.f6432.0

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, 0.5, x\right) \]
        7. Applied rewrites32.0%

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

          \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
        9. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{x \cdot \frac{3}{2}} \]
          2. lower-*.f6434.8

            \[\leadsto \color{blue}{x \cdot 1.5} \]
        10. Applied rewrites34.8%

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

      Alternative 8: 29.9% accurate, 3.3× speedup?

      \[\begin{array}{l} \\ x \cdot 1.5 \end{array} \]
      (FPCore (x y) :precision binary64 (* x 1.5))
      double code(double x, double y) {
      	return x * 1.5;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = x * 1.5d0
      end function
      
      public static double code(double x, double y) {
      	return x * 1.5;
      }
      
      def code(x, y):
      	return x * 1.5
      
      function code(x, y)
      	return Float64(x * 1.5)
      end
      
      function tmp = code(x, y)
      	tmp = x * 1.5;
      end
      
      code[x_, y_] := N[(x * 1.5), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      x \cdot 1.5
      \end{array}
      
      Derivation
      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 x + \frac{\left|\color{blue}{y - x}\right|}{2} \]
        2. lift-fabs.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{\left|y - x\right|} \cdot \sqrt{\left|y - x\right|}}, 0.5, x\right) \]
      6. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{\left|y - x\right|} \cdot \sqrt{\color{blue}{\left|y - x\right|}}, \frac{1}{2}, x\right) \]
        5. rem-square-sqrt100.0

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{x - y}} \cdot \sqrt{x - y}, \frac{1}{2}, x\right) \]
        14. lower-sqrt.f6444.7

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

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

        \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
      9. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{x \cdot \frac{3}{2}} \]
        2. lower-*.f6431.6

          \[\leadsto \color{blue}{x \cdot 1.5} \]
      10. Applied rewrites31.6%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
      11. Add Preprocessing

      Reproduce

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