Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H

Percentage Accurate: 100.0% → 100.0%
Time: 3.4s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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 + y\right) \cdot \left(1 - z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
	return (x + y) * (1.0 - z);
}
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, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
	return (x + y) * (1.0 - z);
}
def code(x, y, z):
	return (x + y) * (1.0 - z)
function code(x, y, z)
	return Float64(Float64(x + y) * Float64(1.0 - z))
end
function tmp = code(x, y, z)
	tmp = (x + y) * (1.0 - z);
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 0.6× speedup?

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

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

    \[\left(x + y\right) \cdot \left(1 - z\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{y} \cdot \left(1 - z\right) \]
  4. Step-by-step derivation
    1. Applied rewrites53.6%

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

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

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

        \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
      4. flip3--N/A

        \[\leadsto \color{blue}{\frac{{1}^{3} - {z}^{3}}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}} \cdot y \]
      5. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\left({1}^{3} - {z}^{3}\right) \cdot y}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}} \]
      6. lower-/.f64N/A

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

        \[\leadsto \frac{\color{blue}{\left({1}^{3} - {z}^{3}\right) \cdot y}}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\left(\color{blue}{1} - {z}^{3}\right) \cdot y}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)} \]
      9. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{\left(1 - {z}^{3}\right)} \cdot y}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\left(1 - \color{blue}{{z}^{3}}\right) \cdot y}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)} \]
      11. metadata-evalN/A

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

        \[\leadsto \frac{\left(1 - {z}^{3}\right) \cdot y}{\color{blue}{\left(z \cdot z + 1 \cdot z\right) + 1}} \]
      13. lower-+.f64N/A

        \[\leadsto \frac{\left(1 - {z}^{3}\right) \cdot y}{\color{blue}{\left(z \cdot z + 1 \cdot z\right) + 1}} \]
      14. *-lft-identityN/A

        \[\leadsto \frac{\left(1 - {z}^{3}\right) \cdot y}{\left(z \cdot z + \color{blue}{z}\right) + 1} \]
      15. lower-fma.f6438.7

        \[\leadsto \frac{\left(1 - {z}^{3}\right) \cdot y}{\color{blue}{\mathsf{fma}\left(z, z, z\right)} + 1} \]
    3. Applied rewrites38.7%

      \[\leadsto \color{blue}{\frac{\left(1 - {z}^{3}\right) \cdot y}{\mathsf{fma}\left(z, z, z\right) + 1}} \]
    4. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \left(y + z \cdot \left(-1 \cdot \left(z \cdot \left(x + \left(y + -1 \cdot \left(x + y\right)\right)\right)\right) - \left(x + y\right)\right)\right)} \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0, z, -x\right) - y, z, y + x\right)} \]
    6. Add Preprocessing

    Alternative 2: 75.7% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-6} \lor \neg \left(z \leq 0.03\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z -1.7e+149)
       (* y (- z))
       (if (or (<= z -3.6e-6) (not (<= z 0.03))) (* x (- 1.0 z)) (+ y x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -1.7e+149) {
    		tmp = y * -z;
    	} else if ((z <= -3.6e-6) || !(z <= 0.03)) {
    		tmp = x * (1.0 - z);
    	} 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, z)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: tmp
        if (z <= (-1.7d+149)) then
            tmp = y * -z
        else if ((z <= (-3.6d-6)) .or. (.not. (z <= 0.03d0))) then
            tmp = x * (1.0d0 - z)
        else
            tmp = y + x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -1.7e+149) {
    		tmp = y * -z;
    	} else if ((z <= -3.6e-6) || !(z <= 0.03)) {
    		tmp = x * (1.0 - z);
    	} else {
    		tmp = y + x;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if z <= -1.7e+149:
    		tmp = y * -z
    	elif (z <= -3.6e-6) or not (z <= 0.03):
    		tmp = x * (1.0 - z)
    	else:
    		tmp = y + x
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= -1.7e+149)
    		tmp = Float64(y * Float64(-z));
    	elseif ((z <= -3.6e-6) || !(z <= 0.03))
    		tmp = Float64(x * Float64(1.0 - z));
    	else
    		tmp = Float64(y + x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (z <= -1.7e+149)
    		tmp = y * -z;
    	elseif ((z <= -3.6e-6) || ~((z <= 0.03)))
    		tmp = x * (1.0 - z);
    	else
    		tmp = y + x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[z, -1.7e+149], N[(y * (-z)), $MachinePrecision], If[Or[LessEqual[z, -3.6e-6], N[Not[LessEqual[z, 0.03]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\
    \;\;\;\;y \cdot \left(-z\right)\\
    
    \mathbf{elif}\;z \leq -3.6 \cdot 10^{-6} \lor \neg \left(z \leq 0.03\right):\\
    \;\;\;\;x \cdot \left(1 - z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;y + x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -1.6999999999999999e149

      1. Initial program 100.0%

        \[\left(x + y\right) \cdot \left(1 - z\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{y} \cdot \left(1 - z\right) \]
      4. Step-by-step derivation
        1. Applied rewrites46.8%

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

          \[\leadsto y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites46.8%

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

          if -1.6999999999999999e149 < z < -3.59999999999999984e-6 or 0.029999999999999999 < z

          1. Initial program 99.9%

            \[\left(x + y\right) \cdot \left(1 - z\right) \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
          4. Step-by-step derivation
            1. Applied rewrites49.4%

              \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]

            if -3.59999999999999984e-6 < z < 0.029999999999999999

            1. Initial program 100.0%

              \[\left(x + y\right) \cdot \left(1 - z\right) \]
            2. Add Preprocessing
            3. Taylor expanded in z around 0

              \[\leadsto \color{blue}{x + y} \]
            4. Step-by-step derivation
              1. Applied rewrites97.8%

                \[\leadsto \color{blue}{y + x} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification74.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-6} \lor \neg \left(z \leq 0.03\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
            7. Add Preprocessing

            Alternative 3: 74.5% accurate, 0.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= z -1.7e+149)
               (* y (- z))
               (if (or (<= z -1.36e+26) (not (<= z 1.0))) (* x (- z)) (+ y x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (z <= -1.7e+149) {
            		tmp = y * -z;
            	} else if ((z <= -1.36e+26) || !(z <= 1.0)) {
            		tmp = x * -z;
            	} 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, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: tmp
                if (z <= (-1.7d+149)) then
                    tmp = y * -z
                else if ((z <= (-1.36d+26)) .or. (.not. (z <= 1.0d0))) then
                    tmp = x * -z
                else
                    tmp = y + x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if (z <= -1.7e+149) {
            		tmp = y * -z;
            	} else if ((z <= -1.36e+26) || !(z <= 1.0)) {
            		tmp = x * -z;
            	} else {
            		tmp = y + x;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if z <= -1.7e+149:
            		tmp = y * -z
            	elif (z <= -1.36e+26) or not (z <= 1.0):
            		tmp = x * -z
            	else:
            		tmp = y + x
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if (z <= -1.7e+149)
            		tmp = Float64(y * Float64(-z));
            	elseif ((z <= -1.36e+26) || !(z <= 1.0))
            		tmp = Float64(x * Float64(-z));
            	else
            		tmp = Float64(y + x);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if (z <= -1.7e+149)
            		tmp = y * -z;
            	elseif ((z <= -1.36e+26) || ~((z <= 1.0)))
            		tmp = x * -z;
            	else
            		tmp = y + x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[LessEqual[z, -1.7e+149], N[(y * (-z)), $MachinePrecision], If[Or[LessEqual[z, -1.36e+26], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], N[(y + x), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\
            \;\;\;\;y \cdot \left(-z\right)\\
            
            \mathbf{elif}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\
            \;\;\;\;x \cdot \left(-z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;y + x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if z < -1.6999999999999999e149

              1. Initial program 100.0%

                \[\left(x + y\right) \cdot \left(1 - z\right) \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{y} \cdot \left(1 - z\right) \]
              4. Step-by-step derivation
                1. Applied rewrites46.8%

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

                  \[\leadsto y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
                3. Step-by-step derivation
                  1. Applied rewrites46.8%

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

                  if -1.6999999999999999e149 < z < -1.35999999999999993e26 or 1 < z

                  1. Initial program 100.0%

                    \[\left(x + y\right) \cdot \left(1 - z\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in x around inf

                    \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
                  4. Step-by-step derivation
                    1. Applied rewrites49.9%

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

                      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot z\right)} \]
                    3. Step-by-step derivation
                      1. Applied rewrites49.0%

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

                      if -1.35999999999999993e26 < z < 1

                      1. Initial program 100.0%

                        \[\left(x + y\right) \cdot \left(1 - z\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in z around 0

                        \[\leadsto \color{blue}{x + y} \]
                      4. Step-by-step derivation
                        1. Applied rewrites96.3%

                          \[\leadsto \color{blue}{y + x} \]
                      5. Recombined 3 regimes into one program.
                      6. Final simplification74.0%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 4: 74.4% accurate, 0.6× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (or (<= z -1.36e+26) (not (<= z 1.0))) (* x (- z)) (+ y x)))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if ((z <= -1.36e+26) || !(z <= 1.0)) {
                      		tmp = x * -z;
                      	} 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, z)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8) :: tmp
                          if ((z <= (-1.36d+26)) .or. (.not. (z <= 1.0d0))) then
                              tmp = x * -z
                          else
                              tmp = y + x
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if ((z <= -1.36e+26) || !(z <= 1.0)) {
                      		tmp = x * -z;
                      	} else {
                      		tmp = y + x;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if (z <= -1.36e+26) or not (z <= 1.0):
                      		tmp = x * -z
                      	else:
                      		tmp = y + x
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if ((z <= -1.36e+26) || !(z <= 1.0))
                      		tmp = Float64(x * Float64(-z));
                      	else
                      		tmp = Float64(y + x);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if ((z <= -1.36e+26) || ~((z <= 1.0)))
                      		tmp = x * -z;
                      	else
                      		tmp = y + x;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[Or[LessEqual[z, -1.36e+26], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], N[(y + x), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\
                      \;\;\;\;x \cdot \left(-z\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;y + x\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if z < -1.35999999999999993e26 or 1 < z

                        1. Initial program 100.0%

                          \[\left(x + y\right) \cdot \left(1 - z\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in x around inf

                          \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
                        4. Step-by-step derivation
                          1. Applied rewrites54.0%

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

                            \[\leadsto x \cdot \color{blue}{\left(-1 \cdot z\right)} \]
                          3. Step-by-step derivation
                            1. Applied rewrites53.3%

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

                            if -1.35999999999999993e26 < z < 1

                            1. Initial program 100.0%

                              \[\left(x + y\right) \cdot \left(1 - z\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in z around 0

                              \[\leadsto \color{blue}{x + y} \]
                            4. Step-by-step derivation
                              1. Applied rewrites96.3%

                                \[\leadsto \color{blue}{y + x} \]
                            5. Recombined 2 regimes into one program.
                            6. Final simplification76.3%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
                            7. Add Preprocessing

                            Alternative 5: 51.2% accurate, 0.7× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{-223}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
                            (FPCore (x y z)
                             :precision binary64
                             (if (<= (+ x y) -2e-223) (* x (- 1.0 z)) (* y (- 1.0 z))))
                            double code(double x, double y, double z) {
                            	double tmp;
                            	if ((x + y) <= -2e-223) {
                            		tmp = x * (1.0 - z);
                            	} else {
                            		tmp = y * (1.0 - z);
                            	}
                            	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, z)
                            use fmin_fmax_functions
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                real(8), intent (in) :: z
                                real(8) :: tmp
                                if ((x + y) <= (-2d-223)) then
                                    tmp = x * (1.0d0 - z)
                                else
                                    tmp = y * (1.0d0 - z)
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double y, double z) {
                            	double tmp;
                            	if ((x + y) <= -2e-223) {
                            		tmp = x * (1.0 - z);
                            	} else {
                            		tmp = y * (1.0 - z);
                            	}
                            	return tmp;
                            }
                            
                            def code(x, y, z):
                            	tmp = 0
                            	if (x + y) <= -2e-223:
                            		tmp = x * (1.0 - z)
                            	else:
                            		tmp = y * (1.0 - z)
                            	return tmp
                            
                            function code(x, y, z)
                            	tmp = 0.0
                            	if (Float64(x + y) <= -2e-223)
                            		tmp = Float64(x * Float64(1.0 - z));
                            	else
                            		tmp = Float64(y * Float64(1.0 - z));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, y, z)
                            	tmp = 0.0;
                            	if ((x + y) <= -2e-223)
                            		tmp = x * (1.0 - z);
                            	else
                            		tmp = y * (1.0 - z);
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-223], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;x + y \leq -2 \cdot 10^{-223}:\\
                            \;\;\;\;x \cdot \left(1 - z\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;y \cdot \left(1 - z\right)\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (+.f64 x y) < -1.9999999999999999e-223

                              1. Initial program 100.0%

                                \[\left(x + y\right) \cdot \left(1 - z\right) \]
                              2. Add Preprocessing
                              3. Taylor expanded in x around inf

                                \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
                              4. Step-by-step derivation
                                1. Applied rewrites51.0%

                                  \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]

                                if -1.9999999999999999e-223 < (+.f64 x y)

                                1. Initial program 100.0%

                                  \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                2. Add Preprocessing
                                3. Taylor expanded in x around 0

                                  \[\leadsto \color{blue}{y} \cdot \left(1 - z\right) \]
                                4. Step-by-step derivation
                                  1. Applied rewrites55.0%

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

                                Alternative 6: 26.5% accurate, 0.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -5 \cdot 10^{-194}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
                                (FPCore (x y z)
                                 :precision binary64
                                 (if (<= (* (+ x y) (- 1.0 z)) -5e-194) x y))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if (((x + y) * (1.0 - z)) <= -5e-194) {
                                		tmp = x;
                                	} else {
                                		tmp = 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, z)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    real(8), intent (in) :: z
                                    real(8) :: tmp
                                    if (((x + y) * (1.0d0 - z)) <= (-5d-194)) then
                                        tmp = x
                                    else
                                        tmp = y
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double tmp;
                                	if (((x + y) * (1.0 - z)) <= -5e-194) {
                                		tmp = x;
                                	} else {
                                		tmp = y;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	tmp = 0
                                	if ((x + y) * (1.0 - z)) <= -5e-194:
                                		tmp = x
                                	else:
                                		tmp = y
                                	return tmp
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if (Float64(Float64(x + y) * Float64(1.0 - z)) <= -5e-194)
                                		tmp = x;
                                	else
                                		tmp = y;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	tmp = 0.0;
                                	if (((x + y) * (1.0 - z)) <= -5e-194)
                                		tmp = x;
                                	else
                                		tmp = y;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], -5e-194], x, y]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -5 \cdot 10^{-194}:\\
                                \;\;\;\;x\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;y\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -5.0000000000000002e-194

                                  1. Initial program 100.0%

                                    \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in z around 0

                                    \[\leadsto \color{blue}{x + y} \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites56.2%

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

                                      \[\leadsto x \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites27.5%

                                        \[\leadsto x \]

                                      if -5.0000000000000002e-194 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z))

                                      1. Initial program 100.0%

                                        \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in z around 0

                                        \[\leadsto \color{blue}{x + y} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites50.0%

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

                                          \[\leadsto y \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites28.7%

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

                                        Alternative 7: 100.0% accurate, 1.0× speedup?

                                        \[\begin{array}{l} \\ \left(x + y\right) \cdot \left(1 - z\right) \end{array} \]
                                        (FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
                                        double code(double x, double y, double z) {
                                        	return (x + y) * (1.0 - z);
                                        }
                                        
                                        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, z)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            real(8), intent (in) :: z
                                            code = (x + y) * (1.0d0 - z)
                                        end function
                                        
                                        public static double code(double x, double y, double z) {
                                        	return (x + y) * (1.0 - z);
                                        }
                                        
                                        def code(x, y, z):
                                        	return (x + y) * (1.0 - z)
                                        
                                        function code(x, y, z)
                                        	return Float64(Float64(x + y) * Float64(1.0 - z))
                                        end
                                        
                                        function tmp = code(x, y, z)
                                        	tmp = (x + y) * (1.0 - z);
                                        end
                                        
                                        code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \left(x + y\right) \cdot \left(1 - z\right)
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 100.0%

                                          \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                        2. Add Preprocessing
                                        3. Add Preprocessing

                                        Alternative 8: 50.8% accurate, 3.0× speedup?

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

                                          \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in z around 0

                                          \[\leadsto \color{blue}{x + y} \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites52.9%

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

                                          Alternative 9: 26.3% accurate, 12.0× speedup?

                                          \[\begin{array}{l} \\ x \end{array} \]
                                          (FPCore (x y z) :precision binary64 x)
                                          double code(double x, double y, double z) {
                                          	return x;
                                          }
                                          
                                          module fmin_fmax_functions
                                              implicit none
                                              private
                                              public fmax
                                              public fmin
                                          
                                              interface fmax
                                                  module procedure fmax88
                                                  module procedure fmax44
                                                  module procedure fmax84
                                                  module procedure fmax48
                                              end interface
                                              interface fmin
                                                  module procedure fmin88
                                                  module procedure fmin44
                                                  module procedure fmin84
                                                  module procedure fmin48
                                              end interface
                                          contains
                                              real(8) function fmax88(x, y) result (res)
                                                  real(8), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                              end function
                                              real(4) function fmax44(x, y) result (res)
                                                  real(4), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                              end function
                                              real(8) function fmax84(x, y) result(res)
                                                  real(8), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                              end function
                                              real(8) function fmax48(x, y) result(res)
                                                  real(4), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                              end function
                                              real(8) function fmin88(x, y) result (res)
                                                  real(8), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                              end function
                                              real(4) function fmin44(x, y) result (res)
                                                  real(4), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                              end function
                                              real(8) function fmin84(x, y) result(res)
                                                  real(8), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                              end function
                                              real(8) function fmin48(x, y) result(res)
                                                  real(4), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                              end function
                                          end module
                                          
                                          real(8) function code(x, y, z)
                                          use fmin_fmax_functions
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              real(8), intent (in) :: z
                                              code = x
                                          end function
                                          
                                          public static double code(double x, double y, double z) {
                                          	return x;
                                          }
                                          
                                          def code(x, y, z):
                                          	return x
                                          
                                          function code(x, y, z)
                                          	return x
                                          end
                                          
                                          function tmp = code(x, y, z)
                                          	tmp = x;
                                          end
                                          
                                          code[x_, y_, z_] := x
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          x
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 100.0%

                                            \[\left(x + y\right) \cdot \left(1 - z\right) \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in z around 0

                                            \[\leadsto \color{blue}{x + y} \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites52.9%

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

                                              \[\leadsto x \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites25.6%

                                                \[\leadsto x \]
                                              2. Add Preprocessing

                                              Reproduce

                                              ?
                                              herbie shell --seed 2025022 
                                              (FPCore (x y z)
                                                :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
                                                :precision binary64
                                                (* (+ x y) (- 1.0 z)))