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

Percentage Accurate: 99.9% → 99.9%
Time: 5.3s
Alternatives: 14
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 14 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) \]
  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: 65.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-80}:\\
\;\;\;\;y \cdot 0.5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 5.59999999999999987e-272

    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. /-rgt-identityN/A

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
      7. fabs-mulN/A

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

        \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
      9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \left|x - y\right| \]
    5. Applied rewrites49.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
      11. lift--.f6482.2

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

      \[\leadsto \left(x - y\right) \cdot 0.5 \]

    if 5.59999999999999987e-272 < x < 5.4999999999999997e-80

    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. /-rgt-identityN/A

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
      7. fabs-mulN/A

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

        \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
      9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
      25. lower--.f6485.0

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

      \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{1}{2} \]
    9. Step-by-step derivation
      1. Applied rewrites62.2%

        \[\leadsto y \cdot 0.5 \]

      if 5.4999999999999997e-80 < x < 34000

      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) \]
      5. Applied rewrites99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left|x + -1 \cdot y\right|\right)\right) \cdot \frac{1}{2}} \]
      11. Applied rewrites70.9%

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

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

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

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

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

      if 34000 < x

      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) \]
      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-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
        6. associate-*r*N/A

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

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

          \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot x\right) \]
        9. associate-*r*N/A

          \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
      10. Applied rewrites76.1%

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

    Alternative 3: 65.6% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - y\right) \cdot 0.5\\ \mathbf{if}\;x \leq 5.6 \cdot 10^{-272}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-80}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq 34000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (* (- x y) 0.5)))
       (if (<= x 5.6e-272)
         t_0
         (if (<= x 5.5e-80) (* y 0.5) (if (<= x 34000.0) t_0 (* 1.5 x))))))
    double code(double x, double y) {
    	double t_0 = (x - y) * 0.5;
    	double tmp;
    	if (x <= 5.6e-272) {
    		tmp = t_0;
    	} else if (x <= 5.5e-80) {
    		tmp = y * 0.5;
    	} else if (x <= 34000.0) {
    		tmp = t_0;
    	} 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) :: t_0
        real(8) :: tmp
        t_0 = (x - y) * 0.5d0
        if (x <= 5.6d-272) then
            tmp = t_0
        else if (x <= 5.5d-80) then
            tmp = y * 0.5d0
        else if (x <= 34000.0d0) then
            tmp = t_0
        else
            tmp = 1.5d0 * x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double t_0 = (x - y) * 0.5;
    	double tmp;
    	if (x <= 5.6e-272) {
    		tmp = t_0;
    	} else if (x <= 5.5e-80) {
    		tmp = y * 0.5;
    	} else if (x <= 34000.0) {
    		tmp = t_0;
    	} else {
    		tmp = 1.5 * x;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	t_0 = (x - y) * 0.5
    	tmp = 0
    	if x <= 5.6e-272:
    		tmp = t_0
    	elif x <= 5.5e-80:
    		tmp = y * 0.5
    	elif x <= 34000.0:
    		tmp = t_0
    	else:
    		tmp = 1.5 * x
    	return tmp
    
    function code(x, y)
    	t_0 = Float64(Float64(x - y) * 0.5)
    	tmp = 0.0
    	if (x <= 5.6e-272)
    		tmp = t_0;
    	elseif (x <= 5.5e-80)
    		tmp = Float64(y * 0.5);
    	elseif (x <= 34000.0)
    		tmp = t_0;
    	else
    		tmp = Float64(1.5 * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	t_0 = (x - y) * 0.5;
    	tmp = 0.0;
    	if (x <= 5.6e-272)
    		tmp = t_0;
    	elseif (x <= 5.5e-80)
    		tmp = y * 0.5;
    	elseif (x <= 34000.0)
    		tmp = t_0;
    	else
    		tmp = 1.5 * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, 5.6e-272], t$95$0, If[LessEqual[x, 5.5e-80], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 34000.0], t$95$0, N[(1.5 * x), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(x - y\right) \cdot 0.5\\
    \mathbf{if}\;x \leq 5.6 \cdot 10^{-272}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 5.5 \cdot 10^{-80}:\\
    \;\;\;\;y \cdot 0.5\\
    
    \mathbf{elif}\;x \leq 34000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;1.5 \cdot x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < 5.59999999999999987e-272 or 5.4999999999999997e-80 < x < 34000

      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. /-rgt-identityN/A

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

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

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

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

          \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
        7. fabs-mulN/A

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

          \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
        9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
        25. lower--.f6453.9

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

        \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
        11. lift--.f6477.3

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

        \[\leadsto \left(x - y\right) \cdot 0.5 \]

      if 5.59999999999999987e-272 < x < 5.4999999999999997e-80

      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. /-rgt-identityN/A

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

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

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

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

          \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
        7. fabs-mulN/A

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

          \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
        9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
        25. lower--.f6485.0

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

        \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{1}{2} \]
      9. Step-by-step derivation
        1. Applied rewrites62.2%

          \[\leadsto y \cdot 0.5 \]

        if 34000 < x

        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) \]
        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-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
          6. associate-*r*N/A

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

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

            \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot x\right) \]
          9. associate-*r*N/A

            \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
        10. Applied rewrites76.1%

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

      Alternative 4: 82.3% accurate, 0.9× speedup?

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

        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. /-rgt-identityN/A

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
          7. fabs-mulN/A

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

            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
          9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          25. lower--.f6415.9

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

          \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(x - y\right) \cdot 0.5 \]

        if -195000 < x < 2.3e14

        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) \]
        5. Applied rewrites100.0%

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

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

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

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

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

        if 2.3e14 < x

        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) \]
        5. Applied rewrites99.9%

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(y\right)\right|, x\right) \]
          2. lower-neg.f6438.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left|x + -1 \cdot y\right|\right)\right) \cdot \frac{1}{2}} \]
        11. Applied rewrites87.2%

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

      Alternative 5: 82.0% accurate, 0.9× speedup?

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

        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. /-rgt-identityN/A

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
          7. fabs-mulN/A

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

            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
          9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          25. lower--.f6433.1

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

          \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
          11. lift--.f6487.7

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

          \[\leadsto \left(x - y\right) \cdot 0.5 \]

        if -4.0000000000000002e-141 < x < 2.3e14

        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. /-rgt-identityN/A

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
          7. fabs-mulN/A

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

            \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
          9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
          25. lower--.f6482.2

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

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

        if 2.3e14 < x

        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) \]
        5. Applied rewrites99.9%

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(y\right)\right|, x\right) \]
          2. lower-neg.f6438.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left|x + -1 \cdot y\right|\right)\right) \cdot \frac{1}{2}} \]
        11. Applied rewrites87.2%

          \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, x - y, x\right)} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification85.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-141}:\\ \;\;\;\;\left(x - y\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+14}:\\ \;\;\;\;0.5 \cdot \left|y - x\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, x - y, x\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 6: 85.3% accurate, 0.9× speedup?

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

        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) \]
        5. Applied rewrites99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left|x + -1 \cdot y\right|\right)\right) \cdot \frac{1}{2}} \]
        11. Applied rewrites87.6%

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

        if -2.09999999999999997e-131 < y < 3.7e-137

        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) \]
        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.0%

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

          if 3.7e-137 < 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) \]
          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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 81.2% accurate, 0.9× speedup?

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

          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. /-rgt-identityN/A

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
            7. fabs-mulN/A

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

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
            9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            25. lower--.f6433.1

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

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
            11. lift--.f6487.7

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

            \[\leadsto \left(x - y\right) \cdot 0.5 \]

          if -4.0000000000000002e-141 < x < 2.3e14

          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. /-rgt-identityN/A

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
            7. fabs-mulN/A

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

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
            9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            25. lower--.f6482.2

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

            \[\leadsto \color{blue}{0.5 \cdot \left|x - y\right|} \]
          6. Taylor expanded in x around 0

            \[\leadsto \frac{1}{2} \cdot \left|-1 \cdot y\right| \]
          7. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \frac{1}{2} \cdot \left|\mathsf{neg}\left(y\right)\right| \]
            2. lower-neg.f6480.8

              \[\leadsto 0.5 \cdot \left|-y\right| \]
          8. Applied rewrites80.8%

            \[\leadsto 0.5 \cdot \left|-y\right| \]

          if 2.3e14 < x

          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) \]
          5. Applied rewrites99.9%

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(y\right)\right|, x\right) \]
            2. lower-neg.f6438.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left|x + -1 \cdot y\right|\right)\right) \cdot \frac{1}{2}} \]
          11. Applied rewrites87.2%

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

        Alternative 8: 78.0% accurate, 0.9× speedup?

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

          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. /-rgt-identityN/A

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
            7. fabs-mulN/A

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

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
            9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            25. lower--.f6433.1

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

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
            11. lift--.f6487.7

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

            \[\leadsto \left(x - y\right) \cdot 0.5 \]

          if -4.0000000000000002e-141 < x < 6.00000000000000058e42

          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. /-rgt-identityN/A

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
            7. fabs-mulN/A

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

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
            9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            25. lower--.f6480.6

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

            \[\leadsto \color{blue}{0.5 \cdot \left|x - y\right|} \]
          6. Taylor expanded in x around 0

            \[\leadsto \frac{1}{2} \cdot \left|-1 \cdot y\right| \]
          7. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \frac{1}{2} \cdot \left|\mathsf{neg}\left(y\right)\right| \]
            2. lower-neg.f6479.0

              \[\leadsto 0.5 \cdot \left|-y\right| \]
          8. Applied rewrites79.0%

            \[\leadsto 0.5 \cdot \left|-y\right| \]

          if 6.00000000000000058e42 < 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) \]
          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-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
            6. associate-*r*N/A

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

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

              \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot x\right) \]
            9. associate-*r*N/A

              \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
          10. Applied rewrites81.8%

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

        Alternative 9: 77.4% accurate, 1.0× speedup?

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

          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. /-rgt-identityN/A

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
            7. fabs-mulN/A

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

              \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
            9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
            25. lower--.f6460.1

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

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(x - y\right) \cdot 0.5 \]

          if -2.5000000000000001e-251 < y < 2.3000000000000001e-24

          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) \]
          5. Applied rewrites100.0%

            \[\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 rewrites82.5%

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

            if 2.3000000000000001e-24 < 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}{\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. /-rgt-identityN/A

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

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

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

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

                \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
              7. fabs-mulN/A

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

                \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
              9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
              25. lower--.f6470.6

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

              \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto y \cdot \frac{1}{2} \]
            9. Step-by-step derivation
              1. Applied rewrites68.2%

                \[\leadsto y \cdot 0.5 \]
            10. Recombined 3 regimes into one program.
            11. Add Preprocessing

            Alternative 10: 60.4% accurate, 1.1× speedup?

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

              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) \]
              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-fabs.f64N/A

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

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

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

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

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

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

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

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

                  \[\leadsto -0.5 \cdot y \]
              10. Applied rewrites68.8%

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

              if -2.30000000000000022e-131 < y < 1.05e-89

              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. /-rgt-identityN/A

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

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

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

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

                  \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
                7. fabs-mulN/A

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

                  \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
                9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{1}{2} \cdot \left|x - y\right| \]
                25. lower--.f6420.6

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

                \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
                11. lift--.f6463.1

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

                \[\leadsto \left(x - y\right) \cdot 0.5 \]
              10. Taylor expanded in x around inf

                \[\leadsto x \cdot \frac{1}{2} \]
              11. Step-by-step derivation
                1. Applied rewrites57.5%

                  \[\leadsto x \cdot 0.5 \]

                if 1.05e-89 < 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}{\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. /-rgt-identityN/A

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

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

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

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

                    \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
                  7. fabs-mulN/A

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

                    \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
                  9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto y \cdot 0.5 \]
                10. Recombined 3 regimes into one program.
                11. Add Preprocessing

                Alternative 11: 57.0% accurate, 1.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.092:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 34000:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
                (FPCore (x y)
                 :precision binary64
                 (if (<= x -0.092) (* x 0.5) (if (<= x 34000.0) (* -0.5 y) (* 1.5 x))))
                double code(double x, double y) {
                	double tmp;
                	if (x <= -0.092) {
                		tmp = x * 0.5;
                	} else if (x <= 34000.0) {
                		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 <= (-0.092d0)) then
                        tmp = x * 0.5d0
                    else if (x <= 34000.0d0) 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 <= -0.092) {
                		tmp = x * 0.5;
                	} else if (x <= 34000.0) {
                		tmp = -0.5 * y;
                	} else {
                		tmp = 1.5 * x;
                	}
                	return tmp;
                }
                
                def code(x, y):
                	tmp = 0
                	if x <= -0.092:
                		tmp = x * 0.5
                	elif x <= 34000.0:
                		tmp = -0.5 * y
                	else:
                		tmp = 1.5 * x
                	return tmp
                
                function code(x, y)
                	tmp = 0.0
                	if (x <= -0.092)
                		tmp = Float64(x * 0.5);
                	elseif (x <= 34000.0)
                		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 <= -0.092)
                		tmp = x * 0.5;
                	elseif (x <= 34000.0)
                		tmp = -0.5 * y;
                	else
                		tmp = 1.5 * x;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_] := If[LessEqual[x, -0.092], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 34000.0], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \leq -0.092:\\
                \;\;\;\;x \cdot 0.5\\
                
                \mathbf{elif}\;x \leq 34000:\\
                \;\;\;\;-0.5 \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;1.5 \cdot x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if x < -0.091999999999999998

                  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. /-rgt-identityN/A

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

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

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

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

                      \[\leadsto \frac{1}{2} \cdot \left(\left|y - x\right| \cdot \left|1\right|\right) \]
                    7. fabs-mulN/A

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

                      \[\leadsto \frac{1}{2} \cdot \left|1 \cdot \left(y - x\right)\right| \]
                    9. distribute-lft-out--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto 0.5 \cdot \left|x - y\right| \]
                  5. Applied rewrites17.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(x - y\right) \cdot \frac{1}{2} \]
                    11. lift--.f6492.3

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

                    \[\leadsto \left(x - y\right) \cdot 0.5 \]
                  10. Taylor expanded in x around inf

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

                      \[\leadsto x \cdot 0.5 \]

                    if -0.091999999999999998 < x < 34000

                    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) \]
                    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-fabs.f64N/A

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

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

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

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

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

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

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

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

                        \[\leadsto -0.5 \cdot y \]
                    10. Applied rewrites44.4%

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

                    if 34000 < x

                    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) \]
                    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-fabs.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
                      6. associate-*r*N/A

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

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

                        \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot x\right) \]
                      9. associate-*r*N/A

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
                    10. Applied rewrites76.1%

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

                  Alternative 12: 46.7% accurate, 1.7× speedup?

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

                    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) \]
                    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-fabs.f64N/A

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

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

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

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

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

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

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

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

                        \[\leadsto -0.5 \cdot y \]
                    10. Applied rewrites68.8%

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

                    if -2.15000000000000009e-131 < 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) \]
                    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-fabs.f64N/A

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

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{x - y} \cdot \sqrt{\color{blue}{x - y}}, x\right) \]
                      6. lower-sqrt.f6431.1

                        \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \sqrt{x - y}, x\right) \]
                    7. Applied rewrites31.1%

                      \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
                    8. Taylor expanded in x around inf

                      \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
                    9. Step-by-step derivation
                      1. metadata-evalN/A

                        \[\leadsto \left(-1 \cdot \frac{-3}{2}\right) \cdot x \]
                      2. metadata-evalN/A

                        \[\leadsto \left(-1 \cdot \left(\frac{-1}{2} - 1\right)\right) \cdot x \]
                      3. metadata-evalN/A

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot -1 - 1\right)\right) \cdot x \]
                      4. rem-square-sqrtN/A

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot \left(\sqrt{-1} \cdot \sqrt{-1}\right) - 1\right)\right) \cdot x \]
                      5. unpow2N/A

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
                      6. associate-*r*N/A

                        \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot \color{blue}{x}\right) \]
                      7. *-commutativeN/A

                        \[\leadsto -1 \cdot \left(x \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - \color{blue}{1}\right)\right) \]
                      8. *-commutativeN/A

                        \[\leadsto -1 \cdot \left(\left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right) \cdot x\right) \]
                      9. associate-*r*N/A

                        \[\leadsto \left(-1 \cdot \left(\frac{1}{2} \cdot {\left(\sqrt{-1}\right)}^{2} - 1\right)\right) \cdot x \]
                    10. Applied rewrites34.8%

                      \[\leadsto 1.5 \cdot \color{blue}{x} \]
                  3. Recombined 2 regimes into one program.
                  4. Add Preprocessing

                  Alternative 13: 31.9% accurate, 1.7× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-251}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                  (FPCore (x y) :precision binary64 (if (<= y -2.4e-251) (* -0.5 y) x))
                  double code(double x, double y) {
                  	double tmp;
                  	if (y <= -2.4e-251) {
                  		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 <= (-2.4d-251)) 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 <= -2.4e-251) {
                  		tmp = -0.5 * y;
                  	} else {
                  		tmp = x;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y):
                  	tmp = 0
                  	if y <= -2.4e-251:
                  		tmp = -0.5 * y
                  	else:
                  		tmp = x
                  	return tmp
                  
                  function code(x, y)
                  	tmp = 0.0
                  	if (y <= -2.4e-251)
                  		tmp = Float64(-0.5 * y);
                  	else
                  		tmp = x;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y)
                  	tmp = 0.0;
                  	if (y <= -2.4e-251)
                  		tmp = -0.5 * y;
                  	else
                  		tmp = x;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_] := If[LessEqual[y, -2.4e-251], N[(-0.5 * y), $MachinePrecision], x]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -2.4 \cdot 10^{-251}:\\
                  \;\;\;\;-0.5 \cdot y\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -2.39999999999999996e-251

                    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) \]
                    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-fabs.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
                      2. rem-sqrt-square-revN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(x - y\right) \cdot \left(x - y\right)}, x\right) \]
                      3. sqrt-prodN/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
                      4. lower-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{x - y} \cdot \sqrt{\color{blue}{x - y}}, x\right) \]
                      6. lower-sqrt.f6474.4

                        \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \sqrt{x - y}, x\right) \]
                    7. Applied rewrites74.4%

                      \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
                    8. Taylor expanded in x around 0

                      \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
                    9. Step-by-step derivation
                      1. lower-*.f6458.0

                        \[\leadsto -0.5 \cdot y \]
                    10. Applied rewrites58.0%

                      \[\leadsto -0.5 \cdot \color{blue}{y} \]

                    if -2.39999999999999996e-251 < 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.7%

                        \[\leadsto \color{blue}{x} \]
                    5. Recombined 2 regimes into one program.
                    6. Add Preprocessing

                    Alternative 14: 11.4% 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 2025026 
                      (FPCore (x y)
                        :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
                        :precision binary64
                        (+ x (/ (fabs (- y x)) 2.0)))