Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B

Percentage Accurate: 100.0% → 100.0%
Time: 2.1s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 98.4% accurate, 0.0× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\\ \mathbf{if}\;\left(\mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right) \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_0 + \mathsf{min}\left(x, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \mathsf{max}\left(x, y\right)\\ \end{array} \]
(FPCore (x y)
  :precision binary64
  (let* ((t_0 (* (fmax x y) (fmin x y))))
  (if (<=
       (+ (+ (* (fmin x y) (fmax x y)) (fmin x y)) (fmax x y))
       -5e-278)
    (+ t_0 (fmin x y))
    (+ t_0 (fmax x y)))))
double code(double x, double y) {
	double t_0 = fmax(x, y) * fmin(x, y);
	double tmp;
	if ((((fmin(x, y) * fmax(x, y)) + fmin(x, y)) + fmax(x, y)) <= -5e-278) {
		tmp = t_0 + fmin(x, y);
	} else {
		tmp = t_0 + fmax(x, y);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = fmax(x, y) * fmin(x, y)
    if ((((fmin(x, y) * fmax(x, y)) + fmin(x, y)) + fmax(x, y)) <= (-5d-278)) then
        tmp = t_0 + fmin(x, y)
    else
        tmp = t_0 + fmax(x, y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(x, y) * fmin(x, y);
	double tmp;
	if ((((fmin(x, y) * fmax(x, y)) + fmin(x, y)) + fmax(x, y)) <= -5e-278) {
		tmp = t_0 + fmin(x, y);
	} else {
		tmp = t_0 + fmax(x, y);
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(x, y) * fmin(x, y)
	tmp = 0
	if (((fmin(x, y) * fmax(x, y)) + fmin(x, y)) + fmax(x, y)) <= -5e-278:
		tmp = t_0 + fmin(x, y)
	else:
		tmp = t_0 + fmax(x, y)
	return tmp
function code(x, y)
	t_0 = Float64(fmax(x, y) * fmin(x, y))
	tmp = 0.0
	if (Float64(Float64(Float64(fmin(x, y) * fmax(x, y)) + fmin(x, y)) + fmax(x, y)) <= -5e-278)
		tmp = Float64(t_0 + fmin(x, y));
	else
		tmp = Float64(t_0 + fmax(x, y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(x, y) * min(x, y);
	tmp = 0.0;
	if ((((min(x, y) * max(x, y)) + min(x, y)) + max(x, y)) <= -5e-278)
		tmp = t_0 + min(x, y);
	else
		tmp = t_0 + max(x, y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -5e-278], N[(t$95$0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{if}\;\left(\mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right) \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_0 + \mathsf{min}\left(x, y\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 + \mathsf{max}\left(x, y\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.f64 (*.f64 x y) x) y) < -4.9999999999999998e-278

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{y} \]
    3. Step-by-step derivation
      1. Applied rewrites39.1%

        \[\leadsto \color{blue}{y} \]
      2. Taylor expanded in x around inf

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

          \[\leadsto x \cdot \color{blue}{\left(1 + y\right)} \]
        2. lower-+.f6462.4%

          \[\leadsto x \cdot \left(1 + \color{blue}{y}\right) \]
      4. Applied rewrites62.4%

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

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

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

          \[\leadsto \left(1 + y\right) \cdot x \]
        4. +-commutativeN/A

          \[\leadsto \left(y + 1\right) \cdot x \]
        5. distribute-lft1-inN/A

          \[\leadsto y \cdot x + \color{blue}{x} \]
        6. *-commutativeN/A

          \[\leadsto x \cdot y + x \]
        7. lift-*.f64N/A

          \[\leadsto x \cdot y + x \]
        8. lower-+.f6462.4%

          \[\leadsto x \cdot y + \color{blue}{x} \]
        9. lift-*.f64N/A

          \[\leadsto x \cdot y + x \]
        10. *-commutativeN/A

          \[\leadsto y \cdot x + x \]
        11. lift-*.f6462.4%

          \[\leadsto y \cdot x + x \]
      6. Applied rewrites62.4%

        \[\leadsto y \cdot x + \color{blue}{x} \]

      if -4.9999999999999998e-278 < (+.f64 (+.f64 (*.f64 x y) x) y)

      1. Initial program 100.0%

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

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

          \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
        2. lower-+.f6462.8%

          \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
      4. Applied rewrites62.8%

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

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

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

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

          \[\leadsto x \cdot y + \color{blue}{1 \cdot y} \]
        5. *-lft-identityN/A

          \[\leadsto x \cdot y + y \]
        6. lower-+.f64N/A

          \[\leadsto x \cdot y + \color{blue}{y} \]
        7. *-commutativeN/A

          \[\leadsto y \cdot x + y \]
        8. lower-*.f6462.8%

          \[\leadsto y \cdot x + y \]
      6. Applied rewrites62.8%

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

    Alternative 2: 98.4% accurate, 0.0× speedup?

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

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{y} \]
      3. Step-by-step derivation
        1. Applied rewrites39.1%

          \[\leadsto \color{blue}{y} \]
        2. Taylor expanded in x around inf

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

            \[\leadsto x \cdot \color{blue}{\left(1 + y\right)} \]
          2. lower-+.f6462.4%

            \[\leadsto x \cdot \left(1 + \color{blue}{y}\right) \]
        4. Applied rewrites62.4%

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

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

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

            \[\leadsto \left(1 + y\right) \cdot x \]
          4. +-commutativeN/A

            \[\leadsto \left(y + 1\right) \cdot x \]
          5. distribute-lft1-inN/A

            \[\leadsto y \cdot x + \color{blue}{x} \]
          6. *-commutativeN/A

            \[\leadsto x \cdot y + x \]
          7. lift-*.f64N/A

            \[\leadsto x \cdot y + x \]
          8. lower-+.f6462.4%

            \[\leadsto x \cdot y + \color{blue}{x} \]
          9. lift-*.f64N/A

            \[\leadsto x \cdot y + x \]
          10. *-commutativeN/A

            \[\leadsto y \cdot x + x \]
          11. lift-*.f6462.4%

            \[\leadsto y \cdot x + x \]
        6. Applied rewrites62.4%

          \[\leadsto y \cdot x + \color{blue}{x} \]

        if -4.9999999999999998e-278 < (+.f64 (+.f64 (*.f64 x y) x) y)

        1. Initial program 100.0%

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

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

            \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
          2. lower-+.f6462.8%

            \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
        4. Applied rewrites62.8%

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

      Alternative 3: 98.4% accurate, 0.0× speedup?

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

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{y} \]
        3. Step-by-step derivation
          1. Applied rewrites39.1%

            \[\leadsto \color{blue}{y} \]
          2. Taylor expanded in x around inf

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

              \[\leadsto x \cdot \color{blue}{\left(1 + y\right)} \]
            2. lower-+.f6462.4%

              \[\leadsto x \cdot \left(1 + \color{blue}{y}\right) \]
          4. Applied rewrites62.4%

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

          if -4.9999999999999998e-278 < (+.f64 (+.f64 (*.f64 x y) x) y)

          1. Initial program 100.0%

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

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

              \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
            2. lower-+.f6462.8%

              \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
          4. Applied rewrites62.8%

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

        Alternative 4: 91.8% accurate, 0.0× speedup?

        \[\begin{array}{l} t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\ t_1 := \left(t\_0 + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{max}\left(x, y\right)\right)\\ \mathbf{elif}\;t\_1 \leq 8 \cdot 10^{+298}:\\ \;\;\;\;\mathsf{max}\left(x, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
        (FPCore (x y)
          :precision binary64
          (let* ((t_0 (* (fmin x y) (fmax x y)))
               (t_1 (+ (+ t_0 (fmin x y)) (fmax x y))))
          (if (<= t_1 -5e-278)
            (* (fmin x y) (+ 1.0 (fmax x y)))
            (if (<= t_1 8e+298) (fmax x y) t_0))))
        double code(double x, double y) {
        	double t_0 = fmin(x, y) * fmax(x, y);
        	double t_1 = (t_0 + fmin(x, y)) + fmax(x, y);
        	double tmp;
        	if (t_1 <= -5e-278) {
        		tmp = fmin(x, y) * (1.0 + fmax(x, y));
        	} else if (t_1 <= 8e+298) {
        		tmp = fmax(x, y);
        	} 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) :: t_1
            real(8) :: tmp
            t_0 = fmin(x, y) * fmax(x, y)
            t_1 = (t_0 + fmin(x, y)) + fmax(x, y)
            if (t_1 <= (-5d-278)) then
                tmp = fmin(x, y) * (1.0d0 + fmax(x, y))
            else if (t_1 <= 8d+298) then
                tmp = fmax(x, y)
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = fmin(x, y) * fmax(x, y);
        	double t_1 = (t_0 + fmin(x, y)) + fmax(x, y);
        	double tmp;
        	if (t_1 <= -5e-278) {
        		tmp = fmin(x, y) * (1.0 + fmax(x, y));
        	} else if (t_1 <= 8e+298) {
        		tmp = fmax(x, y);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = fmin(x, y) * fmax(x, y)
        	t_1 = (t_0 + fmin(x, y)) + fmax(x, y)
        	tmp = 0
        	if t_1 <= -5e-278:
        		tmp = fmin(x, y) * (1.0 + fmax(x, y))
        	elif t_1 <= 8e+298:
        		tmp = fmax(x, y)
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(fmin(x, y) * fmax(x, y))
        	t_1 = Float64(Float64(t_0 + fmin(x, y)) + fmax(x, y))
        	tmp = 0.0
        	if (t_1 <= -5e-278)
        		tmp = Float64(fmin(x, y) * Float64(1.0 + fmax(x, y)));
        	elseif (t_1 <= 8e+298)
        		tmp = fmax(x, y);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = min(x, y) * max(x, y);
        	t_1 = (t_0 + min(x, y)) + max(x, y);
        	tmp = 0.0;
        	if (t_1 <= -5e-278)
        		tmp = min(x, y) * (1.0 + max(x, y));
        	elseif (t_1 <= 8e+298)
        		tmp = max(x, y);
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-278], N[(N[Min[x, y], $MachinePrecision] * N[(1.0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 8e+298], N[Max[x, y], $MachinePrecision], t$95$0]]]]
        
        \begin{array}{l}
        t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
        t_1 := \left(t\_0 + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right)\\
        \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\
        \;\;\;\;\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{max}\left(x, y\right)\right)\\
        
        \mathbf{elif}\;t\_1 \leq 8 \cdot 10^{+298}:\\
        \;\;\;\;\mathsf{max}\left(x, y\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 (+.f64 (*.f64 x y) x) y) < -4.9999999999999998e-278

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{y} \]
          3. Step-by-step derivation
            1. Applied rewrites39.1%

              \[\leadsto \color{blue}{y} \]
            2. Taylor expanded in x around inf

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

                \[\leadsto x \cdot \color{blue}{\left(1 + y\right)} \]
              2. lower-+.f6462.4%

                \[\leadsto x \cdot \left(1 + \color{blue}{y}\right) \]
            4. Applied rewrites62.4%

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

            if -4.9999999999999998e-278 < (+.f64 (+.f64 (*.f64 x y) x) y) < 7.9999999999999997e298

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{y} \]
            3. Step-by-step derivation
              1. Applied rewrites39.1%

                \[\leadsto \color{blue}{y} \]

              if 7.9999999999999997e298 < (+.f64 (+.f64 (*.f64 x y) x) y)

              1. Initial program 100.0%

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

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

                  \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
                2. lower-+.f6462.8%

                  \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
              4. Applied rewrites62.8%

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

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

                  \[\leadsto x \cdot y \]
              7. Applied rewrites26.1%

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

            Alternative 5: 85.8% accurate, 0.0× speedup?

            \[\begin{array}{l} t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\ t_1 := \left(t\_0 + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{min}\left(x, y\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq 8 \cdot 10^{+298}:\\ \;\;\;\;\mathsf{max}\left(x, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y)
              :precision binary64
              (let* ((t_0 (* (fmin x y) (fmax x y)))
                   (t_1 (+ (+ t_0 (fmin x y)) (fmax x y))))
              (if (<= t_1 (- INFINITY))
                t_0
                (if (<= t_1 -5e-278)
                  (* (fmin x y) 1.0)
                  (if (<= t_1 8e+298) (fmax x y) t_0)))))
            double code(double x, double y) {
            	double t_0 = fmin(x, y) * fmax(x, y);
            	double t_1 = (t_0 + fmin(x, y)) + fmax(x, y);
            	double tmp;
            	if (t_1 <= -((double) INFINITY)) {
            		tmp = t_0;
            	} else if (t_1 <= -5e-278) {
            		tmp = fmin(x, y) * 1.0;
            	} else if (t_1 <= 8e+298) {
            		tmp = fmax(x, y);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            public static double code(double x, double y) {
            	double t_0 = fmin(x, y) * fmax(x, y);
            	double t_1 = (t_0 + fmin(x, y)) + fmax(x, y);
            	double tmp;
            	if (t_1 <= -Double.POSITIVE_INFINITY) {
            		tmp = t_0;
            	} else if (t_1 <= -5e-278) {
            		tmp = fmin(x, y) * 1.0;
            	} else if (t_1 <= 8e+298) {
            		tmp = fmax(x, y);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y):
            	t_0 = fmin(x, y) * fmax(x, y)
            	t_1 = (t_0 + fmin(x, y)) + fmax(x, y)
            	tmp = 0
            	if t_1 <= -math.inf:
            		tmp = t_0
            	elif t_1 <= -5e-278:
            		tmp = fmin(x, y) * 1.0
            	elif t_1 <= 8e+298:
            		tmp = fmax(x, y)
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y)
            	t_0 = Float64(fmin(x, y) * fmax(x, y))
            	t_1 = Float64(Float64(t_0 + fmin(x, y)) + fmax(x, y))
            	tmp = 0.0
            	if (t_1 <= Float64(-Inf))
            		tmp = t_0;
            	elseif (t_1 <= -5e-278)
            		tmp = Float64(fmin(x, y) * 1.0);
            	elseif (t_1 <= 8e+298)
            		tmp = fmax(x, y);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y)
            	t_0 = min(x, y) * max(x, y);
            	t_1 = (t_0 + min(x, y)) + max(x, y);
            	tmp = 0.0;
            	if (t_1 <= -Inf)
            		tmp = t_0;
            	elseif (t_1 <= -5e-278)
            		tmp = min(x, y) * 1.0;
            	elseif (t_1 <= 8e+298)
            		tmp = max(x, y);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -5e-278], N[(N[Min[x, y], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, 8e+298], N[Max[x, y], $MachinePrecision], t$95$0]]]]]
            
            \begin{array}{l}
            t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
            t_1 := \left(t\_0 + \mathsf{min}\left(x, y\right)\right) + \mathsf{max}\left(x, y\right)\\
            \mathbf{if}\;t\_1 \leq -\infty:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\
            \;\;\;\;\mathsf{min}\left(x, y\right) \cdot 1\\
            
            \mathbf{elif}\;t\_1 \leq 8 \cdot 10^{+298}:\\
            \;\;\;\;\mathsf{max}\left(x, y\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (+.f64 (+.f64 (*.f64 x y) x) y) < -inf.0 or 7.9999999999999997e298 < (+.f64 (+.f64 (*.f64 x y) x) y)

              1. Initial program 100.0%

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

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

                  \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
                2. lower-+.f6462.8%

                  \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
              4. Applied rewrites62.8%

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

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

                  \[\leadsto x \cdot y \]
              7. Applied rewrites26.1%

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

              if -inf.0 < (+.f64 (+.f64 (*.f64 x y) x) y) < -4.9999999999999998e-278

              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{y} \]
              3. Step-by-step derivation
                1. Applied rewrites39.1%

                  \[\leadsto \color{blue}{y} \]
                2. Taylor expanded in x around inf

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

                    \[\leadsto x \cdot \color{blue}{\left(1 + y\right)} \]
                  2. lower-+.f6462.4%

                    \[\leadsto x \cdot \left(1 + \color{blue}{y}\right) \]
                4. Applied rewrites62.4%

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

                  \[\leadsto x \cdot 1 \]
                6. Step-by-step derivation
                  1. Applied rewrites38.7%

                    \[\leadsto x \cdot 1 \]

                  if -4.9999999999999998e-278 < (+.f64 (+.f64 (*.f64 x y) x) y) < 7.9999999999999997e298

                  1. Initial program 100.0%

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

                    \[\leadsto \color{blue}{y} \]
                  3. Step-by-step derivation
                    1. Applied rewrites39.1%

                      \[\leadsto \color{blue}{y} \]
                  4. Recombined 3 regimes into one program.
                  5. Add Preprocessing

                  Alternative 6: 61.2% accurate, 0.0× speedup?

                  \[\begin{array}{l} t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\ \mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -0.1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq 21500000000:\\ \;\;\;\;\mathsf{max}\left(x, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                  (FPCore (x y)
                    :precision binary64
                    (let* ((t_0 (* (fmin x y) (fmax x y))))
                    (if (<= (fmin x y) -0.1)
                      t_0
                      (if (<= (fmin x y) 21500000000.0) (fmax x y) t_0))))
                  double code(double x, double y) {
                  	double t_0 = fmin(x, y) * fmax(x, y);
                  	double tmp;
                  	if (fmin(x, y) <= -0.1) {
                  		tmp = t_0;
                  	} else if (fmin(x, y) <= 21500000000.0) {
                  		tmp = fmax(x, y);
                  	} 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 = fmin(x, y) * fmax(x, y)
                      if (fmin(x, y) <= (-0.1d0)) then
                          tmp = t_0
                      else if (fmin(x, y) <= 21500000000.0d0) then
                          tmp = fmax(x, y)
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y) {
                  	double t_0 = fmin(x, y) * fmax(x, y);
                  	double tmp;
                  	if (fmin(x, y) <= -0.1) {
                  		tmp = t_0;
                  	} else if (fmin(x, y) <= 21500000000.0) {
                  		tmp = fmax(x, y);
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y):
                  	t_0 = fmin(x, y) * fmax(x, y)
                  	tmp = 0
                  	if fmin(x, y) <= -0.1:
                  		tmp = t_0
                  	elif fmin(x, y) <= 21500000000.0:
                  		tmp = fmax(x, y)
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(x, y)
                  	t_0 = Float64(fmin(x, y) * fmax(x, y))
                  	tmp = 0.0
                  	if (fmin(x, y) <= -0.1)
                  		tmp = t_0;
                  	elseif (fmin(x, y) <= 21500000000.0)
                  		tmp = fmax(x, y);
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y)
                  	t_0 = min(x, y) * max(x, y);
                  	tmp = 0.0;
                  	if (min(x, y) <= -0.1)
                  		tmp = t_0;
                  	elseif (min(x, y) <= 21500000000.0)
                  		tmp = max(x, y);
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -0.1], t$95$0, If[LessEqual[N[Min[x, y], $MachinePrecision], 21500000000.0], N[Max[x, y], $MachinePrecision], t$95$0]]]
                  
                  \begin{array}{l}
                  t_0 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
                  \mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -0.1:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq 21500000000:\\
                  \;\;\;\;\mathsf{max}\left(x, y\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -0.10000000000000001 or 2.15e10 < x

                    1. Initial program 100.0%

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

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

                        \[\leadsto y \cdot \color{blue}{\left(1 + x\right)} \]
                      2. lower-+.f6462.8%

                        \[\leadsto y \cdot \left(1 + \color{blue}{x}\right) \]
                    4. Applied rewrites62.8%

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

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

                        \[\leadsto x \cdot y \]
                    7. Applied rewrites26.1%

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

                    if -0.10000000000000001 < x < 2.15e10

                    1. Initial program 100.0%

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

                      \[\leadsto \color{blue}{y} \]
                    3. Step-by-step derivation
                      1. Applied rewrites39.1%

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

                    Alternative 7: 38.4% accurate, 0.1× speedup?

                    \[\mathsf{max}\left(x, y\right) \]
                    (FPCore (x y)
                      :precision binary64
                      (fmax x y))
                    double code(double x, double y) {
                    	return fmax(x, 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 = fmax(x, y)
                    end function
                    
                    public static double code(double x, double y) {
                    	return fmax(x, y);
                    }
                    
                    def code(x, y):
                    	return fmax(x, y)
                    
                    function code(x, y)
                    	return fmax(x, y)
                    end
                    
                    function tmp = code(x, y)
                    	tmp = max(x, y);
                    end
                    
                    code[x_, y_] := N[Max[x, y], $MachinePrecision]
                    
                    \mathsf{max}\left(x, y\right)
                    
                    Derivation
                    1. Initial program 100.0%

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

                      \[\leadsto \color{blue}{y} \]
                    3. Step-by-step derivation
                      1. Applied rewrites39.1%

                        \[\leadsto \color{blue}{y} \]
                      2. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025258 
                      (FPCore (x y)
                        :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
                        :precision binary64
                        (+ (+ (* x y) x) y))