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

Percentage Accurate: 99.9% → 99.9%
Time: 2.9s
Alternatives: 12
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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    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 12 alternatives:

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

Initial Program: 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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    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(0.5, \left|y - x\right|, x\right) \end{array} \]
(FPCore (x y) :precision binary64 (fma 0.5 (fabs (- y x)) x))
double code(double x, double y) {
	return fma(0.5, fabs((y - x)), x);
}
function code(x, y)
	return fma(0.5, abs(Float64(y - x)), x)
end
code[x_, y_] := N[(0.5 * N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(0.5, \left|y - x\right|, 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 \frac{1}{2} \cdot \left|y - x\right| + \color{blue}{x} \]
    2. lower-fma.f64N/A

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
    4. *-lft-identityN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
    7. *-lft-identityN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
    8. *-lft-identityN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
    10. cancel-sign-subN/A

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
    12. fp-cancel-sign-sub-invN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
    14. *-lft-identityN/A

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

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

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

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

Alternative 2: 85.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 2.5 \cdot 10^{-171}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|x\right|, x\right)\\

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


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

    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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
      8. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
      10. cancel-sign-subN/A

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
      15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
      9. sqrt-pow1N/A

        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
      11. unpow1N/A

        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
      12. lift--.f6422.5

        \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
    7. Applied rewrites22.5%

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

        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
      2. unpow1N/A

        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
      4. sqrt-pow1N/A

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
      5. unpow2N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
    9. Applied rewrites81.3%

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

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

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

        \[\leadsto \frac{-1}{2} \cdot y + \frac{3}{2} \cdot x \]
      3. rem-square-sqrtN/A

        \[\leadsto \frac{-1}{2} \cdot y + \frac{3}{2} \cdot x \]
      4. sqrt-unprodN/A

        \[\leadsto \frac{-1}{2} \cdot y + \frac{3}{2} \cdot x \]
      5. rem-sqrt-square-revN/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{3}{2}, x, \frac{-1}{2} \cdot y\right) \]
      8. lower-*.f6485.0

        \[\leadsto \mathsf{fma}\left(1.5, x, -0.5 \cdot y\right) \]
    12. Applied rewrites85.0%

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

    if -1.60000000000000011e-151 < y < 2.49999999999999996e-171

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
      8. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
      10. cancel-sign-subN/A

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
      14. *-lft-identityN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x\right|, x\right) \]
    7. Step-by-step derivation
      1. Applied rewrites90.2%

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

      if 2.49999999999999996e-171 < y

      1. Initial program 99.9%

        \[x + \frac{\left|y - x\right|}{2} \]
      2. Add Preprocessing
      3. Applied rewrites59.8%

        \[\leadsto \color{blue}{\frac{\frac{{\left(y - x\right)}^{2}}{4} - x \cdot x}{\frac{\left|x - y\right|}{2} - x}} \]
      4. Taylor expanded in x around 0

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}} \]
        8. unpow2N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{{\left(y - x\right)}^{2}}} \]
        9. sqrt-pow1N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
        10. metadata-evalN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{1}} \]
        11. unpow1N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{y - \color{blue}{x}} \]
        12. lift--.f6446.8

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

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

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

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

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

          \[\leadsto 0.5 \cdot \left(x + y\right) \]
      9. Applied rewrites89.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left(x + y\right)} \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 3: 85.4% accurate, 1.0× speedup?

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

      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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
        4. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
        5. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
        6. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
        7. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
        8. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
        10. cancel-sign-subN/A

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
        12. fp-cancel-sign-sub-invN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
        14. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
        15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
        9. sqrt-pow1N/A

          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
        10. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
        11. unpow1N/A

          \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
        12. lift--.f6422.5

          \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
      7. Applied rewrites22.5%

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

          \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
        2. unpow1N/A

          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
        3. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
        4. sqrt-pow1N/A

          \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
        5. unpow2N/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
      9. Applied rewrites81.3%

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x - y, \frac{1}{2}, x\right) \]
        7. lift--.f6485.0

          \[\leadsto \mathsf{fma}\left(x - y, 0.5, x\right) \]
      11. Applied rewrites85.0%

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

      if -1.60000000000000011e-151 < y < 2.49999999999999996e-171

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
        4. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
        5. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
        6. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
        7. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
        8. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
        10. cancel-sign-subN/A

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
        12. fp-cancel-sign-sub-invN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
        14. *-lft-identityN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x\right|, x\right) \]
      7. Step-by-step derivation
        1. Applied rewrites90.2%

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

        if 2.49999999999999996e-171 < y

        1. Initial program 99.9%

          \[x + \frac{\left|y - x\right|}{2} \]
        2. Add Preprocessing
        3. Applied rewrites59.8%

          \[\leadsto \color{blue}{\frac{\frac{{\left(y - x\right)}^{2}}{4} - x \cdot x}{\frac{\left|x - y\right|}{2} - x}} \]
        4. Taylor expanded in x around 0

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}} \]
          8. unpow2N/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{{\left(y - x\right)}^{2}}} \]
          9. sqrt-pow1N/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
          10. metadata-evalN/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{1}} \]
          11. unpow1N/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{y - \color{blue}{x}} \]
          12. lift--.f6446.8

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

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

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

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

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

            \[\leadsto 0.5 \cdot \left(x + y\right) \]
        9. Applied rewrites89.6%

          \[\leadsto 0.5 \cdot \color{blue}{\left(x + y\right)} \]
      8. Recombined 3 regimes into one program.
      9. Add Preprocessing

      Alternative 4: 84.5% accurate, 1.0× speedup?

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

        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. lower-*.f64N/A

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

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          3. *-lft-identityN/A

            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
          4. metadata-evalN/A

            \[\leadsto \frac{1}{2} \cdot \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right| \]
          5. metadata-evalN/A

            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
          6. *-lft-identityN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          7. *-lft-identityN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
          8. metadata-evalN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
          9. cancel-sign-subN/A

            \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
          10. lower-fabs.f64N/A

            \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
          11. fp-cancel-sign-sub-invN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
          12. metadata-evalN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
          13. *-lft-identityN/A

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          14. lower--.f6467.3

            \[\leadsto 0.5 \cdot \left|x - y\right| \]
        5. Applied rewrites67.3%

          \[\leadsto \color{blue}{0.5 \cdot \left|x - y\right|} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

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

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

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

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

            \[\leadsto \left|y - x\right| \cdot \frac{1}{2} \]
          7. rem-sqrt-square-revN/A

            \[\leadsto \sqrt{\left(y - x\right) \cdot \left(y - x\right)} \cdot \frac{1}{2} \]
          8. unpow2N/A

            \[\leadsto \sqrt{{\left(y - x\right)}^{2}} \cdot \frac{1}{2} \]
          9. sqrt-pow1N/A

            \[\leadsto {\left(y - x\right)}^{\left(\frac{2}{2}\right)} \cdot \frac{1}{2} \]
          10. metadata-evalN/A

            \[\leadsto {\left(y - x\right)}^{1} \cdot \frac{1}{2} \]
          11. unpow1N/A

            \[\leadsto \left(y - x\right) \cdot \frac{1}{2} \]
          12. lift--.f640.8

            \[\leadsto \left(y - x\right) \cdot 0.5 \]
        7. Applied rewrites0.8%

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

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

            \[\leadsto -0.5 \cdot x \]
        10. Applied rewrites2.3%

          \[\leadsto -0.5 \cdot \color{blue}{x} \]
        11. Taylor expanded in x around 0

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

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          2. rem-sqrt-square-revN/A

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

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

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

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x - y\right)} \]
          6. lift--.f6484.1

            \[\leadsto 0.5 \cdot \left(x - \color{blue}{y}\right) \]
        13. Applied rewrites84.1%

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

        if -1.44999999999999998e-114 < y < 2.49999999999999996e-171

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
          4. *-lft-identityN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
          5. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
          6. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
          7. *-lft-identityN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
          8. *-lft-identityN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
          9. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
          10. cancel-sign-subN/A

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
          12. fp-cancel-sign-sub-invN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
          13. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
          14. *-lft-identityN/A

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x\right|, x\right) \]
        7. Step-by-step derivation
          1. Applied rewrites87.3%

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

          if 2.49999999999999996e-171 < y

          1. Initial program 99.9%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Add Preprocessing
          3. Applied rewrites59.8%

            \[\leadsto \color{blue}{\frac{\frac{{\left(y - x\right)}^{2}}{4} - x \cdot x}{\frac{\left|x - y\right|}{2} - x}} \]
          4. Taylor expanded in x around 0

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}} \]
            8. unpow2N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{{\left(y - x\right)}^{2}}} \]
            9. sqrt-pow1N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
            10. metadata-evalN/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{1}} \]
            11. unpow1N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{y - \color{blue}{x}} \]
            12. lift--.f6446.8

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

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

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

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

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

              \[\leadsto 0.5 \cdot \left(x + y\right) \]
          9. Applied rewrites89.6%

            \[\leadsto 0.5 \cdot \color{blue}{\left(x + y\right)} \]
        8. Recombined 3 regimes into one program.
        9. Add Preprocessing

        Alternative 5: 80.6% accurate, 1.0× speedup?

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

          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. lower-*.f64N/A

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            3. *-lft-identityN/A

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
            4. metadata-evalN/A

              \[\leadsto \frac{1}{2} \cdot \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right| \]
            5. metadata-evalN/A

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
            6. *-lft-identityN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            7. *-lft-identityN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
            8. metadata-evalN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
            9. cancel-sign-subN/A

              \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
            10. lower-fabs.f64N/A

              \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
            11. fp-cancel-sign-sub-invN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
            12. metadata-evalN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
            13. *-lft-identityN/A

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            14. lower--.f6467.3

              \[\leadsto 0.5 \cdot \left|x - y\right| \]
          5. Applied rewrites67.3%

            \[\leadsto \color{blue}{0.5 \cdot \left|x - y\right|} \]
          6. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

              \[\leadsto \left|y - x\right| \cdot \frac{1}{2} \]
            7. rem-sqrt-square-revN/A

              \[\leadsto \sqrt{\left(y - x\right) \cdot \left(y - x\right)} \cdot \frac{1}{2} \]
            8. unpow2N/A

              \[\leadsto \sqrt{{\left(y - x\right)}^{2}} \cdot \frac{1}{2} \]
            9. sqrt-pow1N/A

              \[\leadsto {\left(y - x\right)}^{\left(\frac{2}{2}\right)} \cdot \frac{1}{2} \]
            10. metadata-evalN/A

              \[\leadsto {\left(y - x\right)}^{1} \cdot \frac{1}{2} \]
            11. unpow1N/A

              \[\leadsto \left(y - x\right) \cdot \frac{1}{2} \]
            12. lift--.f640.8

              \[\leadsto \left(y - x\right) \cdot 0.5 \]
          7. Applied rewrites0.8%

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

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

              \[\leadsto -0.5 \cdot x \]
          10. Applied rewrites2.3%

            \[\leadsto -0.5 \cdot \color{blue}{x} \]
          11. Taylor expanded in x around 0

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            2. rem-sqrt-square-revN/A

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

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

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

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x - y\right)} \]
            6. lift--.f6484.1

              \[\leadsto 0.5 \cdot \left(x - \color{blue}{y}\right) \]
          13. Applied rewrites84.1%

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

          if -1.44999999999999998e-114 < y < 1.15e-46

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
            6. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
            7. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            8. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            9. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            10. cancel-sign-subN/A

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            12. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            13. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            14. *-lft-identityN/A

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x\right|, x\right) \]
          7. Step-by-step derivation
            1. Applied rewrites81.4%

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

            if 1.15e-46 < 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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
              4. *-lft-identityN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
              5. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
              6. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
              7. *-lft-identityN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
              8. *-lft-identityN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
              10. cancel-sign-subN/A

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

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
              12. fp-cancel-sign-sub-invN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
              13. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
              14. *-lft-identityN/A

                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
              15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
              9. sqrt-pow1N/A

                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
              10. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
              11. unpow1N/A

                \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
              12. lift--.f6492.9

                \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
            7. Applied rewrites92.9%

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

              \[\leadsto \mathsf{fma}\left(y, \frac{1}{2}, x\right) \]
            9. Step-by-step derivation
              1. Applied rewrites78.7%

                \[\leadsto \mathsf{fma}\left(y, 0.5, x\right) \]
            10. Recombined 3 regimes into one program.
            11. Add Preprocessing

            Alternative 6: 62.7% accurate, 1.1× speedup?

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

              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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                4. *-lft-identityN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                5. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                6. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                7. *-lft-identityN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                8. *-lft-identityN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                9. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                10. cancel-sign-subN/A

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

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                12. fp-cancel-sign-sub-invN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                13. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                14. *-lft-identityN/A

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                9. sqrt-pow1N/A

                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                10. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                11. unpow1N/A

                  \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                12. lift--.f6420.5

                  \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
              7. Applied rewrites20.5%

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

                  \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                2. unpow1N/A

                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                3. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                4. sqrt-pow1N/A

                  \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                5. unpow2N/A

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
              9. Applied rewrites82.5%

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

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
              11. Step-by-step derivation
                1. Applied rewrites65.2%

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

                if -1.69999999999999991e-114 < y < 5.1000000000000002e-166

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

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                  4. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                  5. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                  6. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                  7. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                  8. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                  9. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                  10. cancel-sign-subN/A

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                  12. fp-cancel-sign-sub-invN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                  13. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                  14. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                  9. sqrt-pow1N/A

                    \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                  11. unpow1N/A

                    \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                  12. lift--.f6459.4

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

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

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

                    \[\leadsto 0.5 \cdot x \]
                10. Applied rewrites55.0%

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

                if 5.1000000000000002e-166 < y

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

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                  4. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                  5. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                  6. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                  7. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                  8. *-lft-identityN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                  9. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                  10. cancel-sign-subN/A

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                  12. fp-cancel-sign-sub-invN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                  13. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                  14. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                  9. sqrt-pow1N/A

                    \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                  11. unpow1N/A

                    \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                  12. lift--.f6489.5

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

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

                  \[\leadsto \mathsf{fma}\left(y, \frac{1}{2}, x\right) \]
                9. Step-by-step derivation
                  1. Applied rewrites73.0%

                    \[\leadsto \mathsf{fma}\left(y, 0.5, x\right) \]
                10. Recombined 3 regimes into one program.
                11. Add Preprocessing

                Alternative 7: 60.3% accurate, 1.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-114}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot y\\ \end{array} \end{array} \]
                (FPCore (x y)
                 :precision binary64
                 (if (<= y -1.7e-114) (* -0.5 y) (if (<= y 3e-164) (* 0.5 x) (* 0.5 y))))
                double code(double x, double y) {
                	double tmp;
                	if (y <= -1.7e-114) {
                		tmp = -0.5 * y;
                	} else if (y <= 3e-164) {
                		tmp = 0.5 * x;
                	} else {
                		tmp = 0.5 * y;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8) :: tmp
                    if (y <= (-1.7d-114)) then
                        tmp = (-0.5d0) * y
                    else if (y <= 3d-164) 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 <= -1.7e-114) {
                		tmp = -0.5 * y;
                	} else if (y <= 3e-164) {
                		tmp = 0.5 * x;
                	} else {
                		tmp = 0.5 * y;
                	}
                	return tmp;
                }
                
                def code(x, y):
                	tmp = 0
                	if y <= -1.7e-114:
                		tmp = -0.5 * y
                	elif y <= 3e-164:
                		tmp = 0.5 * x
                	else:
                		tmp = 0.5 * y
                	return tmp
                
                function code(x, y)
                	tmp = 0.0
                	if (y <= -1.7e-114)
                		tmp = Float64(-0.5 * y);
                	elseif (y <= 3e-164)
                		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 <= -1.7e-114)
                		tmp = -0.5 * y;
                	elseif (y <= 3e-164)
                		tmp = 0.5 * x;
                	else
                		tmp = 0.5 * y;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_] := If[LessEqual[y, -1.7e-114], N[(-0.5 * y), $MachinePrecision], If[LessEqual[y, 3e-164], N[(0.5 * x), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq -1.7 \cdot 10^{-114}:\\
                \;\;\;\;-0.5 \cdot y\\
                
                \mathbf{elif}\;y \leq 3 \cdot 10^{-164}:\\
                \;\;\;\;0.5 \cdot x\\
                
                \mathbf{else}:\\
                \;\;\;\;0.5 \cdot y\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if y < -1.69999999999999991e-114

                  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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                    4. *-lft-identityN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                    5. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                    6. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                    7. *-lft-identityN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                    8. *-lft-identityN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                    9. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                    10. cancel-sign-subN/A

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

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                    12. fp-cancel-sign-sub-invN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                    13. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                    14. *-lft-identityN/A

                      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                    15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                    9. sqrt-pow1N/A

                      \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                    10. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                    11. unpow1N/A

                      \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                    12. lift--.f6420.5

                      \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                  7. Applied rewrites20.5%

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

                      \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                    2. unpow1N/A

                      \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                    3. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                    4. sqrt-pow1N/A

                      \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                    5. unpow2N/A

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
                  9. Applied rewrites82.5%

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

                    \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
                  11. Step-by-step derivation
                    1. Applied rewrites65.2%

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

                    if -1.69999999999999991e-114 < y < 3.0000000000000001e-164

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      4. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      5. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                      6. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      7. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      8. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      9. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      10. cancel-sign-subN/A

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                      12. fp-cancel-sign-sub-invN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      13. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      14. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                      9. sqrt-pow1N/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                      10. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                      11. unpow1N/A

                        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                      12. lift--.f6459.4

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

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

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

                        \[\leadsto 0.5 \cdot x \]
                    10. Applied rewrites55.0%

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

                    if 3.0000000000000001e-164 < y

                    1. Initial program 99.9%

                      \[x + \frac{\left|y - x\right|}{2} \]
                    2. Add Preprocessing
                    3. Applied rewrites59.5%

                      \[\leadsto \color{blue}{\frac{\frac{{\left(y - x\right)}^{2}}{4} - x \cdot x}{\frac{\left|x - y\right|}{2} - x}} \]
                    4. Taylor expanded in x around 0

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

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

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

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

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

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

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

                        \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{\left(y - x\right) \cdot \left(y - x\right)}} \]
                      8. unpow2N/A

                        \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{\sqrt{{\left(y - x\right)}^{2}}} \]
                      9. sqrt-pow1N/A

                        \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{\color{blue}{\left(\frac{2}{2}\right)}}} \]
                      10. metadata-evalN/A

                        \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{{\left(y - x\right)}^{1}} \]
                      11. unpow1N/A

                        \[\leadsto \frac{\frac{1}{2} \cdot \left(y \cdot y\right)}{y - \color{blue}{x}} \]
                      12. lift--.f6447.2

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

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

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

                        \[\leadsto 0.5 \cdot y \]
                    9. Applied rewrites67.5%

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

                  Alternative 8: 57.9% accurate, 1.1× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.04 \cdot 10^{-100}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-109}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
                  (FPCore (x y)
                   :precision binary64
                   (if (<= x -1.04e-100) (* 0.5 x) (if (<= x 8e-109) (* -0.5 y) (* 1.5 x))))
                  double code(double x, double y) {
                  	double tmp;
                  	if (x <= -1.04e-100) {
                  		tmp = 0.5 * x;
                  	} else if (x <= 8e-109) {
                  		tmp = -0.5 * y;
                  	} else {
                  		tmp = 1.5 * x;
                  	}
                  	return tmp;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8) :: tmp
                      if (x <= (-1.04d-100)) then
                          tmp = 0.5d0 * x
                      else if (x <= 8d-109) 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 <= -1.04e-100) {
                  		tmp = 0.5 * x;
                  	} else if (x <= 8e-109) {
                  		tmp = -0.5 * y;
                  	} else {
                  		tmp = 1.5 * x;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y):
                  	tmp = 0
                  	if x <= -1.04e-100:
                  		tmp = 0.5 * x
                  	elif x <= 8e-109:
                  		tmp = -0.5 * y
                  	else:
                  		tmp = 1.5 * x
                  	return tmp
                  
                  function code(x, y)
                  	tmp = 0.0
                  	if (x <= -1.04e-100)
                  		tmp = Float64(0.5 * x);
                  	elseif (x <= 8e-109)
                  		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 <= -1.04e-100)
                  		tmp = 0.5 * x;
                  	elseif (x <= 8e-109)
                  		tmp = -0.5 * y;
                  	else
                  		tmp = 1.5 * x;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_] := If[LessEqual[x, -1.04e-100], N[(0.5 * x), $MachinePrecision], If[LessEqual[x, 8e-109], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -1.04 \cdot 10^{-100}:\\
                  \;\;\;\;0.5 \cdot x\\
                  
                  \mathbf{elif}\;x \leq 8 \cdot 10^{-109}:\\
                  \;\;\;\;-0.5 \cdot y\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;1.5 \cdot x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if x < -1.04e-100

                    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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      4. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      5. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                      6. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      7. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      8. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      9. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      10. cancel-sign-subN/A

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                      12. fp-cancel-sign-sub-invN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      13. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      14. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                      9. sqrt-pow1N/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                      10. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                      11. unpow1N/A

                        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                      12. lift--.f6492.6

                        \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                    7. Applied rewrites92.6%

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

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

                        \[\leadsto 0.5 \cdot x \]
                    10. Applied rewrites71.4%

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

                    if -1.04e-100 < x < 7.9999999999999999e-109

                    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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      4. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      5. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                      6. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                      7. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      8. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      9. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      10. cancel-sign-subN/A

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                      12. fp-cancel-sign-sub-invN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                      13. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                      14. *-lft-identityN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                      9. sqrt-pow1N/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                      10. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                      11. unpow1N/A

                        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                      12. lift--.f6455.0

                        \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                    7. Applied rewrites55.0%

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

                        \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                      2. unpow1N/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                      3. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                      4. sqrt-pow1N/A

                        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                      5. unpow2N/A

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
                    9. Applied rewrites46.5%

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

                      \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
                    11. Step-by-step derivation
                      1. Applied rewrites41.6%

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

                      if 7.9999999999999999e-109 < x

                      1. Initial program 99.8%

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

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

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                        4. *-lft-identityN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                        5. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                        6. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                        7. *-lft-identityN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                        8. *-lft-identityN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                        9. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                        10. cancel-sign-subN/A

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

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                        12. fp-cancel-sign-sub-invN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                        13. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                        14. *-lft-identityN/A

                          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                        15. lower--.f6499.8

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                        9. sqrt-pow1N/A

                          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                        10. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                        11. unpow1N/A

                          \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                        12. lift--.f6432.3

                          \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                      7. Applied rewrites32.3%

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

                          \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                        2. unpow1N/A

                          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                        3. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                        4. sqrt-pow1N/A

                          \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                        5. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
                      11. Step-by-step derivation
                        1. Applied rewrites65.2%

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

                      Alternative 9: 70.9% accurate, 1.3× speedup?

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

                        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}{\frac{1}{2} \cdot \left|y - x\right|} \]
                        4. Step-by-step derivation
                          1. lower-*.f64N/A

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

                            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
                          3. *-lft-identityN/A

                            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
                          4. metadata-evalN/A

                            \[\leadsto \frac{1}{2} \cdot \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right| \]
                          5. metadata-evalN/A

                            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot x - y\right| \]
                          6. *-lft-identityN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
                          7. *-lft-identityN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
                          8. metadata-evalN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
                          9. cancel-sign-subN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
                          10. lower-fabs.f64N/A

                            \[\leadsto \frac{1}{2} \cdot \left|x + -1 \cdot y\right| \]
                          11. fp-cancel-sign-sub-invN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right| \]
                          12. metadata-evalN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - 1 \cdot y\right| \]
                          13. *-lft-identityN/A

                            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
                          14. lower--.f6442.7

                            \[\leadsto 0.5 \cdot \left|x - y\right| \]
                        5. Applied rewrites42.7%

                          \[\leadsto \color{blue}{0.5 \cdot \left|x - y\right|} \]
                        6. Step-by-step derivation
                          1. lift-*.f64N/A

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

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

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

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

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

                            \[\leadsto \left|y - x\right| \cdot \frac{1}{2} \]
                          7. rem-sqrt-square-revN/A

                            \[\leadsto \sqrt{\left(y - x\right) \cdot \left(y - x\right)} \cdot \frac{1}{2} \]
                          8. unpow2N/A

                            \[\leadsto \sqrt{{\left(y - x\right)}^{2}} \cdot \frac{1}{2} \]
                          9. sqrt-pow1N/A

                            \[\leadsto {\left(y - x\right)}^{\left(\frac{2}{2}\right)} \cdot \frac{1}{2} \]
                          10. metadata-evalN/A

                            \[\leadsto {\left(y - x\right)}^{1} \cdot \frac{1}{2} \]
                          11. unpow1N/A

                            \[\leadsto \left(y - x\right) \cdot \frac{1}{2} \]
                          12. lift--.f642.9

                            \[\leadsto \left(y - x\right) \cdot 0.5 \]
                        7. Applied rewrites2.9%

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

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

                            \[\leadsto -0.5 \cdot x \]
                        10. Applied rewrites2.3%

                          \[\leadsto -0.5 \cdot \color{blue}{x} \]
                        11. Taylor expanded in x around 0

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

                            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
                          2. rem-sqrt-square-revN/A

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

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

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

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

                            \[\leadsto 0.5 \cdot \left(x - \color{blue}{y}\right) \]
                        13. Applied rewrites72.6%

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

                        if 5.1000000000000002e-166 < y

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

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

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                          4. *-lft-identityN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                          5. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                          6. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                          7. *-lft-identityN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                          8. *-lft-identityN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                          9. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                          10. cancel-sign-subN/A

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

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                          12. fp-cancel-sign-sub-invN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                          13. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                          14. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                          9. sqrt-pow1N/A

                            \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                          10. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                          11. unpow1N/A

                            \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                          12. lift--.f6489.5

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

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

                          \[\leadsto \mathsf{fma}\left(y, \frac{1}{2}, x\right) \]
                        9. Step-by-step derivation
                          1. Applied rewrites73.0%

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

                        Alternative 10: 45.4% accurate, 1.7× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{-101}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
                        (FPCore (x y) :precision binary64 (if (<= y -7.5e-101) (* -0.5 y) (* 1.5 x)))
                        double code(double x, double y) {
                        	double tmp;
                        	if (y <= -7.5e-101) {
                        		tmp = -0.5 * y;
                        	} else {
                        		tmp = 1.5 * x;
                        	}
                        	return tmp;
                        }
                        
                        module fmin_fmax_functions
                            implicit none
                            private
                            public fmax
                            public fmin
                        
                            interface fmax
                                module procedure fmax88
                                module procedure fmax44
                                module procedure fmax84
                                module procedure fmax48
                            end interface
                            interface fmin
                                module procedure fmin88
                                module procedure fmin44
                                module procedure fmin84
                                module procedure fmin48
                            end interface
                        contains
                            real(8) function fmax88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmax44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmax84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmax48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                            end function
                            real(8) function fmin88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmin44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmin84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmin48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                            end function
                        end module
                        
                        real(8) function code(x, y)
                        use fmin_fmax_functions
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8) :: tmp
                            if (y <= (-7.5d-101)) 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 <= -7.5e-101) {
                        		tmp = -0.5 * y;
                        	} else {
                        		tmp = 1.5 * x;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y):
                        	tmp = 0
                        	if y <= -7.5e-101:
                        		tmp = -0.5 * y
                        	else:
                        		tmp = 1.5 * x
                        	return tmp
                        
                        function code(x, y)
                        	tmp = 0.0
                        	if (y <= -7.5e-101)
                        		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 <= -7.5e-101)
                        		tmp = -0.5 * y;
                        	else
                        		tmp = 1.5 * x;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_] := If[LessEqual[y, -7.5e-101], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;y \leq -7.5 \cdot 10^{-101}:\\
                        \;\;\;\;-0.5 \cdot y\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;1.5 \cdot x\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if y < -7.5000000000000001e-101

                          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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
                          4. Step-by-step derivation
                            1. +-commutativeN/A

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

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

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                            4. *-lft-identityN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                            5. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                            6. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                            7. *-lft-identityN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                            8. *-lft-identityN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                            9. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                            10. cancel-sign-subN/A

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

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                            12. fp-cancel-sign-sub-invN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                            13. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                            14. *-lft-identityN/A

                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                            15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                            9. sqrt-pow1N/A

                              \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                            10. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                            11. unpow1N/A

                              \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                            12. lift--.f6421.1

                              \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                          7. Applied rewrites21.1%

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

                              \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                            2. unpow1N/A

                              \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                            3. metadata-evalN/A

                              \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                            4. sqrt-pow1N/A

                              \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                            5. unpow2N/A

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
                          9. Applied rewrites81.6%

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

                            \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
                          11. Step-by-step derivation
                            1. Applied rewrites65.9%

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

                            if -7.5000000000000001e-101 < y

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

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

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                              4. *-lft-identityN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                              5. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                              6. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                              7. *-lft-identityN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                              8. *-lft-identityN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                              9. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                              10. cancel-sign-subN/A

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

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                              12. fp-cancel-sign-sub-invN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                              13. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                              14. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                              9. sqrt-pow1N/A

                                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                              10. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                              11. unpow1N/A

                                \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                              12. lift--.f6475.1

                                \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                            7. Applied rewrites75.1%

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

                                \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                              2. unpow1N/A

                                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                              3. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                              4. sqrt-pow1N/A

                                \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                              5. unpow2N/A

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
                            9. Applied rewrites29.4%

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

                              \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
                            11. Step-by-step derivation
                              1. Applied rewrites32.0%

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

                            Alternative 11: 31.2% accurate, 1.7× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{-152}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                            (FPCore (x y) :precision binary64 (if (<= y -1.8e-152) (* -0.5 y) x))
                            double code(double x, double y) {
                            	double tmp;
                            	if (y <= -1.8e-152) {
                            		tmp = -0.5 * y;
                            	} else {
                            		tmp = x;
                            	}
                            	return tmp;
                            }
                            
                            module fmin_fmax_functions
                                implicit none
                                private
                                public fmax
                                public fmin
                            
                                interface fmax
                                    module procedure fmax88
                                    module procedure fmax44
                                    module procedure fmax84
                                    module procedure fmax48
                                end interface
                                interface fmin
                                    module procedure fmin88
                                    module procedure fmin44
                                    module procedure fmin84
                                    module procedure fmin48
                                end interface
                            contains
                                real(8) function fmax88(x, y) result (res)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                end function
                                real(4) function fmax44(x, y) result (res)
                                    real(4), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                end function
                                real(8) function fmax84(x, y) result(res)
                                    real(8), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                end function
                                real(8) function fmax48(x, y) result(res)
                                    real(4), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                end function
                                real(8) function fmin88(x, y) result (res)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                end function
                                real(4) function fmin44(x, y) result (res)
                                    real(4), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                end function
                                real(8) function fmin84(x, y) result(res)
                                    real(8), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                end function
                                real(8) function fmin48(x, y) result(res)
                                    real(4), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                end function
                            end module
                            
                            real(8) function code(x, y)
                            use fmin_fmax_functions
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                real(8) :: tmp
                                if (y <= (-1.8d-152)) then
                                    tmp = (-0.5d0) * y
                                else
                                    tmp = x
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double y) {
                            	double tmp;
                            	if (y <= -1.8e-152) {
                            		tmp = -0.5 * y;
                            	} else {
                            		tmp = x;
                            	}
                            	return tmp;
                            }
                            
                            def code(x, y):
                            	tmp = 0
                            	if y <= -1.8e-152:
                            		tmp = -0.5 * y
                            	else:
                            		tmp = x
                            	return tmp
                            
                            function code(x, y)
                            	tmp = 0.0
                            	if (y <= -1.8e-152)
                            		tmp = Float64(-0.5 * y);
                            	else
                            		tmp = x;
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, y)
                            	tmp = 0.0;
                            	if (y <= -1.8e-152)
                            		tmp = -0.5 * y;
                            	else
                            		tmp = x;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, y_] := If[LessEqual[y, -1.8e-152], N[(-0.5 * y), $MachinePrecision], x]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;y \leq -1.8 \cdot 10^{-152}:\\
                            \;\;\;\;-0.5 \cdot y\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;x\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if y < -1.8e-152

                              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}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
                              4. Step-by-step derivation
                                1. +-commutativeN/A

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

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

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                                4. *-lft-identityN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                                5. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(\mathsf{neg}\left(-1\right)\right) \cdot x - y\right|, x\right) \]
                                6. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|1 \cdot x - y\right|, x\right) \]
                                7. *-lft-identityN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                                8. *-lft-identityN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                                9. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                                10. cancel-sign-subN/A

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

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
                                12. fp-cancel-sign-sub-invN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
                                13. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
                                14. *-lft-identityN/A

                                  \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                                15. lower--.f64100.0

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                                9. sqrt-pow1N/A

                                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                                10. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                                11. unpow1N/A

                                  \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                                12. lift--.f6422.5

                                  \[\leadsto \mathsf{fma}\left(y - x, 0.5, x\right) \]
                              7. Applied rewrites22.5%

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

                                  \[\leadsto \mathsf{fma}\left(y - x, \frac{1}{2}, x\right) \]
                                2. unpow1N/A

                                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{1}, \frac{1}{2}, x\right) \]
                                3. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left({\left(y - x\right)}^{\left(\frac{2}{2}\right)}, \frac{1}{2}, x\right) \]
                                4. sqrt-pow1N/A

                                  \[\leadsto \mathsf{fma}\left(\sqrt{{\left(y - x\right)}^{2}}, \frac{1}{2}, x\right) \]
                                5. unpow2N/A

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \sqrt{x - y}, 0.5, x\right) \]
                              9. Applied rewrites81.3%

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

                                \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
                              11. Step-by-step derivation
                                1. Applied rewrites60.8%

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

                                if -1.8e-152 < y

                                1. Initial program 99.9%

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

                                  \[\leadsto \color{blue}{x} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites12.3%

                                    \[\leadsto \color{blue}{x} \]
                                5. Recombined 2 regimes into one program.
                                6. Add Preprocessing

                                Alternative 12: 11.3% accurate, 20.0× speedup?

                                \[\begin{array}{l} \\ x \end{array} \]
                                (FPCore (x y) :precision binary64 x)
                                double code(double x, double y) {
                                	return x;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(x, y)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    code = x
                                end function
                                
                                public static double code(double x, double y) {
                                	return x;
                                }
                                
                                def code(x, y):
                                	return x
                                
                                function code(x, y)
                                	return x
                                end
                                
                                function tmp = code(x, y)
                                	tmp = x;
                                end
                                
                                code[x_, y_] := x
                                
                                \begin{array}{l}
                                
                                \\
                                x
                                \end{array}
                                
                                Derivation
                                1. Initial program 99.9%

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

                                  \[\leadsto \color{blue}{x} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites11.4%

                                    \[\leadsto \color{blue}{x} \]
                                  2. Add Preprocessing

                                  Reproduce

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