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

Percentage Accurate: 99.9% → 99.9%
Time: 2.6s
Alternatives: 7
Speedup: 0.9×

Specification

?
\[x + \frac{\left|y - x\right|}{2} \]
(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]
x + \frac{\left|y - x\right|}{2}

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 7 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?

\[x + \frac{\left|y - x\right|}{2} \]
(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]
x + \frac{\left|y - x\right|}{2}

Alternative 1: 99.9% accurate, 0.9× speedup?

\[0.5 \cdot \left(\left(\left|y - x\right| + x\right) + x\right) \]
(FPCore (x y) :precision binary64 (* 0.5 (+ (+ (fabs (- y x)) x) x)))
double code(double x, double y) {
	return 0.5 * ((fabs((y - x)) + x) + 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 = 0.5d0 * ((abs((y - x)) + x) + x)
end function
public static double code(double x, double y) {
	return 0.5 * ((Math.abs((y - x)) + x) + x);
}
def code(x, y):
	return 0.5 * ((math.fabs((y - x)) + x) + x)
function code(x, y)
	return Float64(0.5 * Float64(Float64(abs(Float64(y - x)) + x) + x))
end
function tmp = code(x, y)
	tmp = 0.5 * ((abs((y - x)) + x) + x);
end
code[x_, y_] := N[(0.5 * N[(N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
0.5 \cdot \left(\left(\left|y - x\right| + x\right) + x\right)
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(\left(\left|x - y\right| + x\right) + x\right)} \]
    6. lower-+.f6499.9%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(\left|x - y\right| + x\right) + x\right)} \]
    7. lift-fabs.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{2} \cdot \left(\left(\color{blue}{\left|\left(1 - \frac{x}{y}\right) \cdot y\right|} + x\right) + x\right) \]
    15. lift-fabs.f6488.0%

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

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

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

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

      \[\leadsto \frac{1}{2} \cdot \left(\left(\left|\color{blue}{y - x}\right| + x\right) + x\right) \]
    20. lower--.f6499.9%

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

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(\left|y - x\right| + x\right) + x\right)} \]
  6. Add Preprocessing

Alternative 2: 99.9% accurate, 1.1× speedup?

\[\mathsf{fma}\left(\left|x - y\right|, 0.5, x\right) \]
(FPCore (x y) :precision binary64 (fma (fabs (- x y)) 0.5 x))
double code(double x, double y) {
	return fma(fabs((x - y)), 0.5, x);
}
function code(x, y)
	return fma(abs(Float64(x - y)), 0.5, x)
end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] * 0.5 + x), $MachinePrecision]
\mathsf{fma}\left(\left|x - y\right|, 0.5, x\right)
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 71.6% accurate, 0.9× speedup?

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.0999999999999999e-24

    1. Initial program 99.9%

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

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    3. Step-by-step derivation
      1. Applied rewrites58.7%

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

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

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

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

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

          \[\leadsto \left|y\right| \cdot \color{blue}{\frac{1}{2}} + x \]
        6. lower-fma.f6458.7%

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

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

      if 2.0999999999999999e-24 < x

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
        3. sub-to-mult-revN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
        8. sub-negate-revN/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
        16. add-flip-revN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
        21. lower-/.f6488.0%

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
        5. associate-/l*N/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
        14. *-rgt-identity55.2%

          \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
        15. rem-square-sqrtN/A

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
        18. lift-*.f6450.3%

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

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

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

    Alternative 4: 68.1% accurate, 1.0× speedup?

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

      1. Initial program 99.9%

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

        \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
      3. Step-by-step derivation
        1. Applied rewrites58.7%

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

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

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

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

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

            \[\leadsto \left|y\right| \cdot \color{blue}{\frac{1}{2}} + x \]
          6. lower-fma.f6458.7%

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

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

        if 2.0999999999999999e-24 < x

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
          3. sub-to-mult-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
          8. sub-negate-revN/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
          16. add-flip-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
          21. lower-/.f6488.0%

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
          5. associate-/l*N/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
          14. *-rgt-identity55.2%

            \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
          15. rem-square-sqrtN/A

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

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

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
          18. lift-*.f6450.3%

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

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

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

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

            \[\leadsto 1.5 \cdot \color{blue}{x} \]
        10. Applied rewrites30.7%

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

      Alternative 5: 47.7% accurate, 1.1× speedup?

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

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
          3. sub-to-mult-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
          8. sub-negate-revN/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
          16. add-flip-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
          21. lower-/.f6488.0%

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
          5. associate-/l*N/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
          14. *-rgt-identity55.2%

            \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
          15. rem-square-sqrtN/A

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

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

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
          18. lift-*.f6450.3%

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

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

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

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

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

          if 2.2499999999999999e-51 < x

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
            3. sub-to-mult-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
            8. sub-negate-revN/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
            16. add-flip-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
            21. lower-/.f6488.0%

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
            5. associate-/l*N/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
            14. *-rgt-identity55.2%

              \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
            15. rem-square-sqrtN/A

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

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

              \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
            18. lift-*.f6450.3%

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

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

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

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

              \[\leadsto 1.5 \cdot \color{blue}{x} \]
          10. Applied rewrites30.7%

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

        Alternative 6: 44.0% accurate, 0.9× speedup?

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

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
            3. sub-to-mult-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
            8. sub-negate-revN/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
            16. add-flip-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
            21. lower-/.f6488.0%

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
            5. associate-/l*N/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
            14. *-rgt-identity55.2%

              \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
            15. rem-square-sqrtN/A

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

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

              \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
            18. lift-*.f6450.3%

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

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

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

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

              \[\leadsto 1.5 \cdot \color{blue}{x} \]
          10. Applied rewrites30.7%

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

          if -1.0600000000000001e125 < x < 2.7e-113

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
            3. sub-to-mult-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
            8. sub-negate-revN/A

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
            16. add-flip-revN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
            21. lower-/.f6488.0%

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
            5. associate-/l*N/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
            14. *-rgt-identity55.2%

              \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
            15. rem-square-sqrtN/A

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

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

              \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
            18. lift-*.f6450.3%

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

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

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

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

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

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

        Alternative 7: 26.9% accurate, 2.7× speedup?

        \[-0.5 \cdot y \]
        (FPCore (x y) :precision binary64 (* -0.5 y))
        double code(double x, double y) {
        	return -0.5 * y;
        }
        
        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 = (-0.5d0) * y
        end function
        
        public static double code(double x, double y) {
        	return -0.5 * y;
        }
        
        def code(x, y):
        	return -0.5 * y
        
        function code(x, y)
        	return Float64(-0.5 * y)
        end
        
        function tmp = code(x, y)
        	tmp = -0.5 * y;
        end
        
        code[x_, y_] := N[(-0.5 * y), $MachinePrecision]
        
        -0.5 \cdot y
        
        Derivation
        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\mathsf{neg}\left(\left(y - x\right)\right)}\right|, \frac{1}{2}, x\right) \]
          3. sub-to-mult-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\left(\mathsf{neg}\left(\color{blue}{\left(1 - \frac{x}{y}\right)}\right)\right) \cdot y\right|, \frac{1}{2}, x\right) \]
          8. sub-negate-revN/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{1 \cdot \left(\mathsf{neg}\left(y\right)\right) - \left(\mathsf{neg}\left(x\right)\right)}{\color{blue}{y}} \cdot y\right|, \frac{1}{2}, x\right) \]
          16. add-flip-revN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\frac{\color{blue}{x - y}}{y} \cdot y\right|, \frac{1}{2}, x\right) \]
          21. lower-/.f6488.0%

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left|\color{blue}{\frac{\left(x - y\right) \cdot y}{y}}\right|, \frac{1}{2}, x\right) \]
          5. associate-/l*N/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(x - y\right) \cdot \color{blue}{1}, \frac{1}{2}, x\right) \]
          14. *-rgt-identity55.2%

            \[\leadsto \mathsf{fma}\left(\color{blue}{x - y}, 0.5, x\right) \]
          15. rem-square-sqrtN/A

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

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

            \[\leadsto \mathsf{fma}\left(\sqrt{x - y} \cdot \color{blue}{\sqrt{x - y}}, \frac{1}{2}, x\right) \]
          18. lift-*.f6450.3%

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

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

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

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

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

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

        Reproduce

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