Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A

Percentage Accurate: 100.0% → 100.0%
Time: 2.3s
Alternatives: 10
Speedup: 1.3×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \end{array} \]
(FPCore (x y)
 :precision binary64
 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
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 * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y):
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y)
	return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673)
end
function tmp = code(x, y)
	tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \end{array} \]
(FPCore (x y)
 :precision binary64
 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
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 * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y):
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y)
	return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673)
end
function tmp = code(x, y)
	tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}

Alternative 1: 100.0% accurate, 1.3× speedup?

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

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

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Taylor expanded in y around 0

    \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
  3. Step-by-step derivation
    1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1100:\\ \;\;\;\;\mathsf{fma}\left(x - 0.5, y, -x\right)\\ \mathbf{elif}\;y \leq 2100000:\\ \;\;\;\;\mathsf{fma}\left(x, y, 0.918938533204673\right) - x\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.5\right) \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1100.0)
   (fma (- x 0.5) y (- x))
   (if (<= y 2100000.0) (- (fma x y 0.918938533204673) x) (* (- x 0.5) y))))
double code(double x, double y) {
	double tmp;
	if (y <= -1100.0) {
		tmp = fma((x - 0.5), y, -x);
	} else if (y <= 2100000.0) {
		tmp = fma(x, y, 0.918938533204673) - x;
	} else {
		tmp = (x - 0.5) * y;
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (y <= -1100.0)
		tmp = fma(Float64(x - 0.5), y, Float64(-x));
	elseif (y <= 2100000.0)
		tmp = Float64(fma(x, y, 0.918938533204673) - x);
	else
		tmp = Float64(Float64(x - 0.5) * y);
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -1100.0], N[(N[(x - 0.5), $MachinePrecision] * y + (-x)), $MachinePrecision], If[LessEqual[y, 2100000.0], N[(N[(x * y + 0.918938533204673), $MachinePrecision] - x), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1100:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, y, -x\right)\\

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

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


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

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1100 < y < 2.1e6

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, y, \frac{918938533204673}{1000000000000000} - x\right) \]
    6. Step-by-step derivation
      1. Applied rewrites98.4%

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

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

          \[\leadsto x \cdot y + \color{blue}{\left(\frac{918938533204673}{1000000000000000} - x\right)} \]
        3. associate-+r-N/A

          \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
        4. lower--.f64N/A

          \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
        5. lower-fma.f6498.4

          \[\leadsto \mathsf{fma}\left(x, y, 0.918938533204673\right) - x \]
      3. Applied rewrites98.4%

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

      if 2.1e6 < y

      1. Initial program 100.0%

        \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
      2. Taylor expanded in y around inf

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

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

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

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

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

    Alternative 3: 98.6% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.5\right) \cdot y\\ \mathbf{if}\;y \leq -210000000000:\\ \;\;\;\;t\_0 - x\\ \mathbf{elif}\;y \leq 2100000:\\ \;\;\;\;\mathsf{fma}\left(x, y, 0.918938533204673\right) - x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (* (- x 0.5) y)))
       (if (<= y -210000000000.0)
         (- t_0 x)
         (if (<= y 2100000.0) (- (fma x y 0.918938533204673) x) t_0))))
    double code(double x, double y) {
    	double t_0 = (x - 0.5) * y;
    	double tmp;
    	if (y <= -210000000000.0) {
    		tmp = t_0 - x;
    	} else if (y <= 2100000.0) {
    		tmp = fma(x, y, 0.918938533204673) - x;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	t_0 = Float64(Float64(x - 0.5) * y)
    	tmp = 0.0
    	if (y <= -210000000000.0)
    		tmp = Float64(t_0 - x);
    	elseif (y <= 2100000.0)
    		tmp = Float64(fma(x, y, 0.918938533204673) - x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(N[(x - 0.5), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -210000000000.0], N[(t$95$0 - x), $MachinePrecision], If[LessEqual[y, 2100000.0], N[(N[(x * y + 0.918938533204673), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(x - 0.5\right) \cdot y\\
    \mathbf{if}\;y \leq -210000000000:\\
    \;\;\;\;t\_0 - x\\
    
    \mathbf{elif}\;y \leq 2100000:\\
    \;\;\;\;\mathsf{fma}\left(x, y, 0.918938533204673\right) - x\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -2.1e11

      1. Initial program 100.0%

        \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
      2. Taylor expanded in y around 0

        \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
      3. Step-by-step derivation
        1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, y, \frac{918938533204673}{1000000000000000} - x\right) \]
      6. Step-by-step derivation
        1. Applied rewrites52.2%

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

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

            \[\leadsto x \cdot y + \color{blue}{\left(\frac{918938533204673}{1000000000000000} - x\right)} \]
          3. associate-+r-N/A

            \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
          4. lower--.f64N/A

            \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
          5. lower-fma.f6452.2

            \[\leadsto \mathsf{fma}\left(x, y, 0.918938533204673\right) - x \]
        3. Applied rewrites52.2%

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

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

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

            \[\leadsto \left(x - \frac{1}{2}\right) \cdot y - x \]
          3. lower--.f6499.8

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

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

        if -2.1e11 < y < 2.1e6

        1. Initial program 100.0%

          \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
        2. Taylor expanded in y around 0

          \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
        3. Step-by-step derivation
          1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, y, \frac{918938533204673}{1000000000000000} - x\right) \]
        6. Step-by-step derivation
          1. Applied rewrites97.7%

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

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

              \[\leadsto x \cdot y + \color{blue}{\left(\frac{918938533204673}{1000000000000000} - x\right)} \]
            3. associate-+r-N/A

              \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
            4. lower--.f64N/A

              \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
            5. lower-fma.f6497.7

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

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

          if 2.1e6 < y

          1. Initial program 100.0%

            \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
          2. Taylor expanded in y around inf

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

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

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

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

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

        Alternative 4: 98.6% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.5\right) \cdot y\\ \mathbf{if}\;y \leq -210000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 2100000:\\ \;\;\;\;\mathsf{fma}\left(x, y, 0.918938533204673\right) - x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (* (- x 0.5) y)))
           (if (<= y -210000000000.0)
             t_0
             (if (<= y 2100000.0) (- (fma x y 0.918938533204673) x) t_0))))
        double code(double x, double y) {
        	double t_0 = (x - 0.5) * y;
        	double tmp;
        	if (y <= -210000000000.0) {
        		tmp = t_0;
        	} else if (y <= 2100000.0) {
        		tmp = fma(x, y, 0.918938533204673) - x;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(x, y)
        	t_0 = Float64(Float64(x - 0.5) * y)
        	tmp = 0.0
        	if (y <= -210000000000.0)
        		tmp = t_0;
        	elseif (y <= 2100000.0)
        		tmp = Float64(fma(x, y, 0.918938533204673) - x);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(N[(x - 0.5), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -210000000000.0], t$95$0, If[LessEqual[y, 2100000.0], N[(N[(x * y + 0.918938533204673), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(x - 0.5\right) \cdot y\\
        \mathbf{if}\;y \leq -210000000000:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;y \leq 2100000:\\
        \;\;\;\;\mathsf{fma}\left(x, y, 0.918938533204673\right) - x\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -2.1e11 or 2.1e6 < y

          1. Initial program 100.0%

            \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
          2. Taylor expanded in y around inf

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

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

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

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

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

          if -2.1e11 < y < 2.1e6

          1. Initial program 100.0%

            \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
          2. Taylor expanded in y around 0

            \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + \left(-1 \cdot x + y \cdot \left(x - \frac{1}{2}\right)\right)} \]
          3. Step-by-step derivation
            1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(x, y, \frac{918938533204673}{1000000000000000} - x\right) \]
          6. Step-by-step derivation
            1. Applied rewrites97.7%

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

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

                \[\leadsto x \cdot y + \color{blue}{\left(\frac{918938533204673}{1000000000000000} - x\right)} \]
              3. associate-+r-N/A

                \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
              4. lower--.f64N/A

                \[\leadsto \left(x \cdot y + \frac{918938533204673}{1000000000000000}\right) - \color{blue}{x} \]
              5. lower-fma.f6497.7

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

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

          Alternative 5: 98.0% accurate, 1.1× speedup?

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

            1. Initial program 100.0%

              \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
            2. Taylor expanded in y around inf

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

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

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

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

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

            if -1.3999999999999999 < y < 1.3500000000000001

            1. Initial program 100.0%

              \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
            2. Taylor expanded in y around 0

              \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
            3. Step-by-step derivation
              1. fp-cancel-sign-sub-invN/A

                \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
              2. metadata-evalN/A

                \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
              3. *-lft-identityN/A

                \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
              4. lower--.f6498.0

                \[\leadsto 0.918938533204673 - \color{blue}{x} \]
            4. Applied rewrites98.0%

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

          Alternative 6: 74.1% accurate, 0.8× speedup?

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

            1. Initial program 100.0%

              \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
            2. Taylor expanded in y around inf

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

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

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

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

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

              \[\leadsto \frac{-1}{2} \cdot y \]
            6. Step-by-step derivation
              1. Applied rewrites50.7%

                \[\leadsto -0.5 \cdot y \]

              if -1.59999999999999997e151 < y < -16 or 2.9500000000000001e227 < y

              1. Initial program 100.0%

                \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
              2. Taylor expanded in x around inf

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

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

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

                  \[\leadsto \left(y - 1\right) \cdot x \]
              4. Applied rewrites51.2%

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

                \[\leadsto y \cdot x \]
              6. Step-by-step derivation
                1. Applied rewrites50.0%

                  \[\leadsto y \cdot x \]

                if -16 < y < 1.8500000000000001

                1. Initial program 100.0%

                  \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                2. Taylor expanded in y around 0

                  \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                3. Step-by-step derivation
                  1. fp-cancel-sign-sub-invN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                  2. metadata-evalN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                  3. *-lft-identityN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                  4. lower--.f6497.9

                    \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                4. Applied rewrites97.9%

                  \[\leadsto \color{blue}{0.918938533204673 - x} \]
              7. Recombined 3 regimes into one program.
              8. Add Preprocessing

              Alternative 7: 72.2% accurate, 1.3× speedup?

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

                1. Initial program 100.0%

                  \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                2. Taylor expanded in y around inf

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

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

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

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

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

                  \[\leadsto \frac{-1}{2} \cdot y \]
                6. Step-by-step derivation
                  1. Applied rewrites50.8%

                    \[\leadsto -0.5 \cdot y \]

                  if -8.00000000000000074e56 < y < 1.8500000000000001

                  1. Initial program 100.0%

                    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                  2. Taylor expanded in y around 0

                    \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                  3. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                    2. metadata-evalN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                    3. *-lft-identityN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                    4. lower--.f6489.9

                      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                  4. Applied rewrites89.9%

                    \[\leadsto \color{blue}{0.918938533204673 - x} \]
                7. Recombined 2 regimes into one program.
                8. Add Preprocessing

                Alternative 8: 50.6% accurate, 4.1× speedup?

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

                  \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                2. Taylor expanded in y around 0

                  \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                3. Step-by-step derivation
                  1. fp-cancel-sign-sub-invN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                  2. metadata-evalN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                  3. *-lft-identityN/A

                    \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                  4. lower--.f6450.6

                    \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                4. Applied rewrites50.6%

                  \[\leadsto \color{blue}{0.918938533204673 - x} \]
                5. Add Preprocessing

                Alternative 9: 49.4% accurate, 1.6× speedup?

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

                  1. Initial program 100.0%

                    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                  2. Taylor expanded in y around 0

                    \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                  3. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                    2. metadata-evalN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                    3. *-lft-identityN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                    4. lower--.f6451.2

                      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                  4. Applied rewrites51.2%

                    \[\leadsto \color{blue}{0.918938533204673 - x} \]
                  5. Taylor expanded in x around inf

                    \[\leadsto -1 \cdot \color{blue}{x} \]
                  6. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(x\right) \]
                    2. lower-neg.f6449.9

                      \[\leadsto -x \]
                  7. Applied rewrites49.9%

                    \[\leadsto -x \]

                  if -600 < x < 3.30000000000000017e-6

                  1. Initial program 100.0%

                    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                  2. Taylor expanded in y around 0

                    \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                  3. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                    2. metadata-evalN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                    3. *-lft-identityN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                    4. lower--.f6449.9

                      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                  4. Applied rewrites49.9%

                    \[\leadsto \color{blue}{0.918938533204673 - x} \]
                  5. Taylor expanded in x around 0

                    \[\leadsto \frac{918938533204673}{1000000000000000} \]
                  6. Step-by-step derivation
                    1. Applied rewrites48.9%

                      \[\leadsto 0.918938533204673 \]
                  7. Recombined 2 regimes into one program.
                  8. Add Preprocessing

                  Alternative 10: 25.7% accurate, 14.9× speedup?

                  \[\begin{array}{l} \\ 0.918938533204673 \end{array} \]
                  (FPCore (x y) :precision binary64 0.918938533204673)
                  double code(double x, double y) {
                  	return 0.918938533204673;
                  }
                  
                  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.918938533204673d0
                  end function
                  
                  public static double code(double x, double y) {
                  	return 0.918938533204673;
                  }
                  
                  def code(x, y):
                  	return 0.918938533204673
                  
                  function code(x, y)
                  	return 0.918938533204673
                  end
                  
                  function tmp = code(x, y)
                  	tmp = 0.918938533204673;
                  end
                  
                  code[x_, y_] := 0.918938533204673
                  
                  \begin{array}{l}
                  
                  \\
                  0.918938533204673
                  \end{array}
                  
                  Derivation
                  1. Initial program 100.0%

                    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
                  2. Taylor expanded in y around 0

                    \[\leadsto \color{blue}{\frac{918938533204673}{1000000000000000} + -1 \cdot x} \]
                  3. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                    2. metadata-evalN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - 1 \cdot x \]
                    3. *-lft-identityN/A

                      \[\leadsto \frac{918938533204673}{1000000000000000} - x \]
                    4. lower--.f6450.6

                      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
                  4. Applied rewrites50.6%

                    \[\leadsto \color{blue}{0.918938533204673 - x} \]
                  5. Taylor expanded in x around 0

                    \[\leadsto \frac{918938533204673}{1000000000000000} \]
                  6. Step-by-step derivation
                    1. Applied rewrites25.7%

                      \[\leadsto 0.918938533204673 \]
                    2. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025112 
                    (FPCore (x y)
                      :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
                      :precision binary64
                      (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))