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

Percentage Accurate: 99.9% → 99.9%
Time: 2.6s
Alternatives: 12
Speedup: 1.1×

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}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{\left|y - x\right|}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
	return x + (fabs((y - x)) / 2.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

Alternative 1: 99.9% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 84.8% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.4499999999999999e24

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4499999999999999e24 < x < 5.19999999999999998e-181

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|-1 \cdot y\right|, x\right) \]
    6. 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.8

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

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

    if 5.19999999999999998e-181 < x

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{2} \cdot y + \frac{3}{2} \cdot x \]
      8. lift-sqrt.f64N/A

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

        \[\leadsto \frac{-1}{2} \cdot y + \frac{3}{2} \cdot x \]
      10. lift-sqrt.f64N/A

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

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

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

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

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

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

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

Alternative 3: 82.6% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.4499999999999999e24

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4499999999999999e24 < x < 5.19999999999999998e-181

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|-1 \cdot y\right|, x\right) \]
    6. 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.8

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

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

    if 5.19999999999999998e-181 < x

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.6% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.49999999999999997e-96 < y < 6.4999999999999997e-106

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 6.4999999999999997e-106 < y

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
        7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 78.6% accurate, 1.0× speedup?

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

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(0.5, \left|\left(1 - \frac{y}{x}\right) \cdot x\right|, x\right) \]
      7. Applied rewrites87.2%

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

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

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

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

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

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

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

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

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

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

      if -2.0000000000000001e-293 < y

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
        7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 71.4% accurate, 0.8× speedup?

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

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(0.5, \left|\left(1 - \frac{y}{x}\right) \cdot x\right|, x\right) \]
      7. Applied rewrites87.9%

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

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

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

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

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

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

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

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

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

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

      if 1.04999999999999998e-288 < y < 7.9000000000000001e-107

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
        7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
      6. Applied rewrites42.3%

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

        \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
      8. Step-by-step derivation
        1. lift-sqrt.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        2. lift--.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        3. lift-sqrt.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        4. lift--.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        5. lift-*.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        6. lift-*.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        7. lift--.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        8. lift-sqrt.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        9. lift--.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        10. lift-sqrt.f64N/A

          \[\leadsto \frac{3}{2} \cdot x \]
        11. sqrt-unprodN/A

          \[\leadsto \frac{3}{2} \cdot x \]
        12. rem-sqrt-square-revN/A

          \[\leadsto \frac{3}{2} \cdot x \]
        13. lower-*.f6450.2

          \[\leadsto 1.5 \cdot x \]
      9. Applied rewrites50.2%

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

      if 7.9000000000000001e-107 < y

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
        7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{2}, y, x\right) \]
      8. Step-by-step derivation
        1. sqrt-unprod71.7

          \[\leadsto \mathsf{fma}\left(0.5, y, x\right) \]
        2. rem-sqrt-square-rev71.7

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

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

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

    Alternative 7: 62.5% accurate, 0.6× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
        7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
      6. Applied rewrites86.4%

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
      8. Step-by-step derivation
        1. lift-sqrt.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        2. lift--.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        3. lift-sqrt.f64N/A

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

          \[\leadsto \frac{-1}{2} \cdot y \]
        5. lift-*.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        6. lift-*.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        7. lift--.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        8. lift-sqrt.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        9. lift--.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        10. lift-sqrt.f64N/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        11. sqrt-unprodN/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        12. rem-sqrt-square-revN/A

          \[\leadsto \frac{-1}{2} \cdot y \]
        13. lower-*.f6473.6

          \[\leadsto -0.5 \cdot y \]
      9. Applied rewrites73.6%

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

      if -1.18e-11 < y < -5.99999999999999996e-148

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(1 - \frac{y}{x}\right) \cdot x\right|, x\right) \]
        7. lift-/.f6499.8

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{1}{2} \]
      12. Step-by-step derivation
        1. Applied rewrites37.2%

          \[\leadsto x \cdot 0.5 \]

        if -5.99999999999999996e-148 < y < 7.9000000000000001e-107

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
          7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
        8. Step-by-step derivation
          1. lift-sqrt.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          2. lift--.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          3. lift-sqrt.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          4. lift--.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          5. lift-*.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          6. lift-*.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          7. lift--.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          8. lift-sqrt.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          9. lift--.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          10. lift-sqrt.f64N/A

            \[\leadsto \frac{3}{2} \cdot x \]
          11. sqrt-unprodN/A

            \[\leadsto \frac{3}{2} \cdot x \]
          12. rem-sqrt-square-revN/A

            \[\leadsto \frac{3}{2} \cdot x \]
          13. lower-*.f6451.2

            \[\leadsto 1.5 \cdot x \]
        9. Applied rewrites51.2%

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

        if 7.9000000000000001e-107 < y

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
          7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, y, x\right) \]
        8. Step-by-step derivation
          1. sqrt-unprod71.7

            \[\leadsto \mathsf{fma}\left(0.5, y, x\right) \]
          2. rem-sqrt-square-rev71.7

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

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

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

      Alternative 8: 61.0% accurate, 0.7× speedup?

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

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
          7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
        6. Applied rewrites86.4%

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

          \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
        8. Step-by-step derivation
          1. lift-sqrt.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          2. lift--.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          3. lift-sqrt.f64N/A

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

            \[\leadsto \frac{-1}{2} \cdot y \]
          5. lift-*.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          6. lift-*.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          7. lift--.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          8. lift-sqrt.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          9. lift--.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          10. lift-sqrt.f64N/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          11. sqrt-unprodN/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          12. rem-sqrt-square-revN/A

            \[\leadsto \frac{-1}{2} \cdot y \]
          13. lower-*.f6473.6

            \[\leadsto -0.5 \cdot y \]
        9. Applied rewrites73.6%

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

        if -1.18e-11 < y < -5.99999999999999996e-148

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\left(1 - \frac{y}{x}\right) \cdot x\right|, x\right) \]
          7. lift-/.f6499.8

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \frac{1}{2} \]
        12. Step-by-step derivation
          1. Applied rewrites37.2%

            \[\leadsto x \cdot 0.5 \]

          if -5.99999999999999996e-148 < y < 4.2999999999999997e-71

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites47.7%

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

            \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            2. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            4. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            5. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            6. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            7. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            9. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            13. lower-*.f6450.2

              \[\leadsto 1.5 \cdot x \]
          9. Applied rewrites50.2%

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

          if 4.2999999999999997e-71 < y

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 9: 60.9% accurate, 0.9× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites86.4%

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

            \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            2. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            3. lift-sqrt.f64N/A

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

              \[\leadsto \frac{-1}{2} \cdot y \]
            5. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            6. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            7. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            9. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            13. lower-*.f6473.7

              \[\leadsto -0.5 \cdot y \]
          9. Applied rewrites73.7%

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

          if -1.4e-11 < y < 4.2999999999999997e-71

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right|, x\right) \]
            15. rem-sqrt-square-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right)}, x\right) \]
            16. sqrt-prodN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
            17. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites53.2%

            \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
          7. Taylor expanded in x around inf

            \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            2. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            4. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            5. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            6. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            7. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            9. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            13. lower-*.f6447.1

              \[\leadsto 1.5 \cdot x \]
          9. Applied rewrites47.1%

            \[\leadsto 1.5 \cdot \color{blue}{x} \]

          if 4.2999999999999997e-71 < y

          1. Initial program 99.9%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{1}{2} \cdot \left|y - x\right| + \color{blue}{x} \]
            2. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\left|y - x\right|}, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            6. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            7. lower-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            8. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            9. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            11. lower--.f6499.9

              \[\leadsto \mathsf{fma}\left(0.5, \left|x - y\right|, x\right) \]
          4. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \left|x - y\right|, x\right)} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            2. lift--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|y - x\right|, x\right) \]
            4. neg-fabsN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y - x\right)\right)\right|, x\right) \]
            5. flip--N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - x \cdot x}{y + x}\right)\right|, x\right) \]
            6. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            8. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            9. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + x}\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + 1 \cdot x}\right|, x\right) \]
            11. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + \left(\mathsf{neg}\left(-1\right)\right) \cdot x}\right|, x\right) \]
            12. fp-cancel-sub-sign-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y - -1 \cdot x}\right|, x\right) \]
            13. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}{y - -1 \cdot x}\right)\right|, x\right) \]
            14. flip-+N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right|, x\right) \]
            15. neg-fabsN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|y + -1 \cdot x\right|, x\right) \]
            16. rem-sqrt-square-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(y + -1 \cdot x\right) \cdot \left(y + -1 \cdot x\right)}, x\right) \]
            17. sqrt-prodN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{y + -1 \cdot x} \cdot \color{blue}{\sqrt{y + -1 \cdot x}}, x\right) \]
            18. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{y + -1 \cdot x} \cdot \color{blue}{\sqrt{y + -1 \cdot x}}, x\right) \]
          6. Applied rewrites84.7%

            \[\leadsto \mathsf{fma}\left(0.5, \sqrt{y - x} \cdot \color{blue}{\sqrt{y - x}}, x\right) \]
          7. Taylor expanded in x around 0

            \[\leadsto \frac{1}{2} \cdot \color{blue}{y} \]
          8. Step-by-step derivation
            1. lower-*.f6469.5

              \[\leadsto 0.5 \cdot y \]
          9. Applied rewrites69.5%

            \[\leadsto 0.5 \cdot \color{blue}{y} \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 10: 45.6% accurate, 1.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{-11}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
        (FPCore (x y) :precision binary64 (if (<= y -1.4e-11) (* -0.5 y) (* 1.5 x)))
        double code(double x, double y) {
        	double tmp;
        	if (y <= -1.4e-11) {
        		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 <= (-1.4d-11)) 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 <= -1.4e-11) {
        		tmp = -0.5 * y;
        	} else {
        		tmp = 1.5 * x;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	tmp = 0
        	if y <= -1.4e-11:
        		tmp = -0.5 * y
        	else:
        		tmp = 1.5 * x
        	return tmp
        
        function code(x, y)
        	tmp = 0.0
        	if (y <= -1.4e-11)
        		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 <= -1.4e-11)
        		tmp = -0.5 * y;
        	else
        		tmp = 1.5 * x;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := If[LessEqual[y, -1.4e-11], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -1.4 \cdot 10^{-11}:\\
        \;\;\;\;-0.5 \cdot y\\
        
        \mathbf{else}:\\
        \;\;\;\;1.5 \cdot x\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -1.4e-11

          1. Initial program 100.0%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{1}{2} \cdot \left|y - x\right| + \color{blue}{x} \]
            2. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\left|y - x\right|}, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            6. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            7. lower-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            8. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            9. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            11. lower--.f64100.0

              \[\leadsto \mathsf{fma}\left(0.5, \left|x - y\right|, x\right) \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \left|x - y\right|, x\right)} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            2. lift--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|y - x\right|, x\right) \]
            4. neg-fabsN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y - x\right)\right)\right|, x\right) \]
            5. flip--N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - x \cdot x}{y + x}\right)\right|, x\right) \]
            6. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            8. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            9. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + x}\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + 1 \cdot x}\right|, x\right) \]
            11. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + \left(\mathsf{neg}\left(-1\right)\right) \cdot x}\right|, x\right) \]
            12. fp-cancel-sub-sign-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y - -1 \cdot x}\right|, x\right) \]
            13. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}{y - -1 \cdot x}\right)\right|, x\right) \]
            14. flip-+N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right|, x\right) \]
            15. rem-sqrt-square-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right)}, x\right) \]
            16. sqrt-prodN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
            17. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites86.4%

            \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
          7. Taylor expanded in x around 0

            \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            2. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            4. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            5. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            6. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            7. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            9. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            13. lower-*.f6473.7

              \[\leadsto -0.5 \cdot y \]
          9. Applied rewrites73.7%

            \[\leadsto -0.5 \cdot \color{blue}{y} \]

          if -1.4e-11 < y

          1. Initial program 99.9%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{1}{2} \cdot \left|y - x\right| + \color{blue}{x} \]
            2. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\left|y - x\right|}, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            6. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            7. lower-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            8. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            9. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            11. lower--.f6499.9

              \[\leadsto \mathsf{fma}\left(0.5, \left|x - y\right|, x\right) \]
          4. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \left|x - y\right|, x\right)} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            2. lift--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|y - x\right|, x\right) \]
            4. neg-fabsN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y - x\right)\right)\right|, x\right) \]
            5. flip--N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - x \cdot x}{y + x}\right)\right|, x\right) \]
            6. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            8. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            9. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + x}\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + 1 \cdot x}\right|, x\right) \]
            11. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + \left(\mathsf{neg}\left(-1\right)\right) \cdot x}\right|, x\right) \]
            12. fp-cancel-sub-sign-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y - -1 \cdot x}\right|, x\right) \]
            13. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}{y - -1 \cdot x}\right)\right|, x\right) \]
            14. flip-+N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right|, x\right) \]
            15. rem-sqrt-square-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right)}, x\right) \]
            16. sqrt-prodN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
            17. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites37.2%

            \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
          7. Taylor expanded in x around inf

            \[\leadsto \frac{3}{2} \cdot \color{blue}{x} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            2. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            4. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            5. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            6. lift-*.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            7. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            9. lift--.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{3}{2} \cdot x \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{3}{2} \cdot x \]
            13. lower-*.f6435.4

              \[\leadsto 1.5 \cdot x \]
          9. Applied rewrites35.4%

            \[\leadsto 1.5 \cdot \color{blue}{x} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 11: 31.9% accurate, 1.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{-268}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
        (FPCore (x y) :precision binary64 (if (<= y -3.9e-268) (* -0.5 y) x))
        double code(double x, double y) {
        	double tmp;
        	if (y <= -3.9e-268) {
        		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 <= (-3.9d-268)) 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 <= -3.9e-268) {
        		tmp = -0.5 * y;
        	} else {
        		tmp = x;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	tmp = 0
        	if y <= -3.9e-268:
        		tmp = -0.5 * y
        	else:
        		tmp = x
        	return tmp
        
        function code(x, y)
        	tmp = 0.0
        	if (y <= -3.9e-268)
        		tmp = Float64(-0.5 * y);
        	else
        		tmp = x;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	tmp = 0.0;
        	if (y <= -3.9e-268)
        		tmp = -0.5 * y;
        	else
        		tmp = x;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := If[LessEqual[y, -3.9e-268], N[(-0.5 * y), $MachinePrecision], x]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -3.9 \cdot 10^{-268}:\\
        \;\;\;\;-0.5 \cdot y\\
        
        \mathbf{else}:\\
        \;\;\;\;x\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -3.8999999999999998e-268

          1. Initial program 99.9%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{x + \frac{1}{2} \cdot \left|y - x\right|} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{1}{2} \cdot \left|y - x\right| + \color{blue}{x} \]
            2. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\left|y - x\right|}, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            4. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            6. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            7. lower-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x + -1 \cdot y\right|, x\right) \]
            8. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - \left(\mathsf{neg}\left(-1\right)\right) \cdot y\right|, x\right) \]
            9. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - 1 \cdot y\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            11. lower--.f6499.9

              \[\leadsto \mathsf{fma}\left(0.5, \left|x - y\right|, x\right) \]
          4. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \left|x - y\right|, x\right)} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            2. lift--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|x - y\right|, x\right) \]
            3. fabs-subN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|y - x\right|, x\right) \]
            4. neg-fabsN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y - x\right)\right)\right|, x\right) \]
            5. flip--N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - x \cdot x}{y + x}\right)\right|, x\right) \]
            6. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - x \cdot x\right)\right)}{y + x}\right|, x\right) \]
            7. sqr-neg-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            8. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{y + x}\right|, x\right) \]
            9. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + x}\right|, x\right) \]
            10. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + 1 \cdot x}\right|, x\right) \]
            11. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y + \left(\mathsf{neg}\left(-1\right)\right) \cdot x}\right|, x\right) \]
            12. fp-cancel-sub-sign-invN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\frac{\mathsf{neg}\left(\left(y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{y - -1 \cdot x}\right|, x\right) \]
            13. distribute-neg-fracN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\frac{y \cdot y - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}{y - -1 \cdot x}\right)\right|, x\right) \]
            14. flip-+N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \left|\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right|, x\right) \]
            15. rem-sqrt-square-revN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)\right)}, x\right) \]
            16. sqrt-prodN/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
            17. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\left(y + -1 \cdot x\right)\right)}}, x\right) \]
          6. Applied rewrites76.1%

            \[\leadsto \mathsf{fma}\left(0.5, \sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, x\right) \]
          7. Taylor expanded in x around 0

            \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
          8. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            2. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            4. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            5. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            6. lift-*.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            7. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            8. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            9. lift--.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            10. lift-sqrt.f64N/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            11. sqrt-unprodN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            12. rem-sqrt-square-revN/A

              \[\leadsto \frac{-1}{2} \cdot y \]
            13. lower-*.f6454.1

              \[\leadsto -0.5 \cdot y \]
          9. Applied rewrites54.1%

            \[\leadsto -0.5 \cdot \color{blue}{y} \]

          if -3.8999999999999998e-268 < y

          1. Initial program 99.9%

            \[x + \frac{\left|y - x\right|}{2} \]
          2. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x} \]
          3. Step-by-step derivation
            1. Applied rewrites11.9%

              \[\leadsto \color{blue}{x} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 12: 11.4% accurate, 10.9× 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. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x} \]
          3. Step-by-step derivation
            1. Applied rewrites11.4%

              \[\leadsto \color{blue}{x} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2025115 
            (FPCore (x y)
              :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
              :precision binary64
              (+ x (/ (fabs (- y x)) 2.0)))