Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, C

Percentage Accurate: 99.9% → 100.0%
Time: 5.1s
Alternatives: 11
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(y + z\right) + z \cdot 5 \end{array} \]
(FPCore (x y z) :precision binary64 (+ (* x (+ y z)) (* z 5.0)))
double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * (y + z)) + (z * 5.0d0)
end function
public static double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
def code(x, y, z):
	return (x * (y + z)) + (z * 5.0)
function code(x, y, z)
	return Float64(Float64(x * Float64(y + z)) + Float64(z * 5.0))
end
function tmp = code(x, y, z)
	tmp = (x * (y + z)) + (z * 5.0);
end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(z * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(y + z\right) + z \cdot 5
\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 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(y + z\right) + z \cdot 5 \end{array} \]
(FPCore (x y z) :precision binary64 (+ (* x (+ y z)) (* z 5.0)))
double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * (y + z)) + (z * 5.0d0)
end function
public static double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
def code(x, y, z):
	return (x * (y + z)) + (z * 5.0)
function code(x, y, z)
	return Float64(Float64(x * Float64(y + z)) + Float64(z * 5.0))
end
function tmp = code(x, y, z)
	tmp = (x * (y + z)) + (z * 5.0);
end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(z * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 1.1× speedup?

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

\\
\mathsf{fma}\left(z, 5, \left(z + y\right) \cdot x\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[x \cdot \left(y + z\right) + z \cdot 5 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

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

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

      \[\leadsto \color{blue}{z \cdot 5} + x \cdot \left(y + z\right) \]
    4. lower-fma.f64100.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, 5, x \cdot \left(y + z\right)\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{x \cdot \left(y + z\right)}\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
    7. lower-*.f64100.0

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
    8. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right)} \cdot x\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
    10. lower-+.f64100.0

      \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
  4. Applied rewrites100.0%

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

Alternative 2: 84.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -650000000 \lor \neg \left(x \leq 2.5 \cdot 10^{-81}\right):\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -650000000.0) (not (<= x 2.5e-81)))
   (* (+ y z) x)
   (fma z 5.0 (* x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -650000000.0) || !(x <= 2.5e-81)) {
		tmp = (y + z) * x;
	} else {
		tmp = fma(z, 5.0, (x * z));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((x <= -650000000.0) || !(x <= 2.5e-81))
		tmp = Float64(Float64(y + z) * x);
	else
		tmp = fma(z, 5.0, Float64(x * z));
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[x, -650000000.0], N[Not[LessEqual[x, 2.5e-81]], $MachinePrecision]], N[(N[(y + z), $MachinePrecision] * x), $MachinePrecision], N[(z * 5.0 + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -650000000 \lor \neg \left(x \leq 2.5 \cdot 10^{-81}\right):\\
\;\;\;\;\left(y + z\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5e8 or 2.4999999999999999e-81 < x

    1. Initial program 99.9%

      \[x \cdot \left(y + z\right) + z \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
      7. lift-*.f64N/A

        \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
      8. distribute-lft-outN/A

        \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
      11. lower-*.f6499.2

        \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
    4. Applied rewrites99.2%

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
      2. distribute-lft-inN/A

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

        \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
      5. remove-double-negN/A

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

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

        \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
      8. lower-+.f6494.8

        \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
    7. Applied rewrites94.8%

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

    if -6.5e8 < x < 2.4999999999999999e-81

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
    4. Step-by-step derivation
      1. distribute-rgt-inN/A

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

        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
      4. lower-+.f6472.9

        \[\leadsto \color{blue}{\left(5 + x\right)} \cdot z \]
    5. Applied rewrites72.9%

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

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{5}, x \cdot z\right) \]
    7. Recombined 2 regimes into one program.
    8. Final simplification84.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -650000000 \lor \neg \left(x \leq 2.5 \cdot 10^{-81}\right):\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 62.0% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+49}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -5:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-56}:\\ \;\;\;\;5 \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= x -1.85e+49)
       (* y x)
       (if (<= x -5.0) (* x z) (if (<= x 3e-56) (* 5.0 z) (* y x)))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (x <= -1.85e+49) {
    		tmp = y * x;
    	} else if (x <= -5.0) {
    		tmp = x * z;
    	} else if (x <= 3e-56) {
    		tmp = 5.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 (x <= (-1.85d+49)) then
            tmp = y * x
        else if (x <= (-5.0d0)) then
            tmp = x * z
        else if (x <= 3d-56) then
            tmp = 5.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 (x <= -1.85e+49) {
    		tmp = y * x;
    	} else if (x <= -5.0) {
    		tmp = x * z;
    	} else if (x <= 3e-56) {
    		tmp = 5.0 * z;
    	} else {
    		tmp = y * x;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if x <= -1.85e+49:
    		tmp = y * x
    	elif x <= -5.0:
    		tmp = x * z
    	elif x <= 3e-56:
    		tmp = 5.0 * z
    	else:
    		tmp = y * x
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (x <= -1.85e+49)
    		tmp = Float64(y * x);
    	elseif (x <= -5.0)
    		tmp = Float64(x * z);
    	elseif (x <= 3e-56)
    		tmp = Float64(5.0 * z);
    	else
    		tmp = Float64(y * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (x <= -1.85e+49)
    		tmp = y * x;
    	elseif (x <= -5.0)
    		tmp = x * z;
    	elseif (x <= 3e-56)
    		tmp = 5.0 * z;
    	else
    		tmp = y * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[x, -1.85e+49], N[(y * x), $MachinePrecision], If[LessEqual[x, -5.0], N[(x * z), $MachinePrecision], If[LessEqual[x, 3e-56], N[(5.0 * z), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -1.85 \cdot 10^{+49}:\\
    \;\;\;\;y \cdot x\\
    
    \mathbf{elif}\;x \leq -5:\\
    \;\;\;\;x \cdot z\\
    
    \mathbf{elif}\;x \leq 3 \cdot 10^{-56}:\\
    \;\;\;\;5 \cdot z\\
    
    \mathbf{else}:\\
    \;\;\;\;y \cdot x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < -1.85000000000000009e49 or 2.99999999999999989e-56 < x

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x \cdot y} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{y \cdot x} \]
        2. lower-*.f6459.2

          \[\leadsto \color{blue}{y \cdot x} \]
      5. Applied rewrites59.2%

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

      if -1.85000000000000009e49 < x < -5

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
      4. Step-by-step derivation
        1. distribute-rgt-inN/A

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

          \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
        4. lower-+.f6481.1

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

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

        \[\leadsto x \cdot \color{blue}{z} \]
      7. Step-by-step derivation
        1. Applied rewrites70.1%

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

        if -5 < x < 2.99999999999999989e-56

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{5 \cdot z} \]
        4. Step-by-step derivation
          1. lower-*.f6470.9

            \[\leadsto \color{blue}{5 \cdot z} \]
        5. Applied rewrites70.9%

          \[\leadsto \color{blue}{5 \cdot z} \]
      8. Recombined 3 regimes into one program.
      9. Final simplification65.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+49}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -5:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-56}:\\ \;\;\;\;5 \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
      10. Add Preprocessing

      Alternative 4: 98.2% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5:\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{elif}\;x \leq 0.000235:\\ \;\;\;\;\mathsf{fma}\left(5, z, y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= x -5.0)
         (* (+ y z) x)
         (if (<= x 0.000235) (fma 5.0 z (* y x)) (fma z x (* x y)))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (x <= -5.0) {
      		tmp = (y + z) * x;
      	} else if (x <= 0.000235) {
      		tmp = fma(5.0, z, (y * x));
      	} else {
      		tmp = fma(z, x, (x * y));
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (x <= -5.0)
      		tmp = Float64(Float64(y + z) * x);
      	elseif (x <= 0.000235)
      		tmp = fma(5.0, z, Float64(y * x));
      	else
      		tmp = fma(z, x, Float64(x * y));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[x, -5.0], N[(N[(y + z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 0.000235], N[(5.0 * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(z * x + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -5:\\
      \;\;\;\;\left(y + z\right) \cdot x\\
      
      \mathbf{elif}\;x \leq 0.000235:\\
      \;\;\;\;\mathsf{fma}\left(5, z, y \cdot x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < -5

        1. Initial program 99.9%

          \[x \cdot \left(y + z\right) + z \cdot 5 \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

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

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

            \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
          7. lift-*.f64N/A

            \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
          8. distribute-lft-outN/A

            \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
          9. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
          10. lower-+.f64N/A

            \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
          11. lower-*.f6498.1

            \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
        4. Applied rewrites98.1%

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

          \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
        6. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
          2. distribute-lft-inN/A

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

            \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
          4. mul-1-negN/A

            \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
          5. remove-double-negN/A

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

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

            \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
          8. lower-+.f6497.9

            \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
        7. Applied rewrites97.9%

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

        if -5 < x < 2.34999999999999993e-4

        1. Initial program 99.9%

          \[x \cdot \left(y + z\right) + z \cdot 5 \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

            \[\leadsto \color{blue}{z \cdot 5} + x \cdot \left(y + z\right) \]
          4. lower-fma.f64100.0

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, 5, x \cdot \left(y + z\right)\right)} \]
          5. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{x \cdot \left(y + z\right)}\right) \]
          6. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
          7. lower-*.f64100.0

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
          8. lift-+.f64N/A

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right)} \cdot x\right) \]
          9. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
          10. lower-+.f64100.0

            \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
        4. Applied rewrites100.0%

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(y \cdot x + z \cdot x\right)} + z \cdot 5 \]
          8. lift-*.f64N/A

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

            \[\leadsto \color{blue}{y \cdot x + \left(z \cdot x + z \cdot 5\right)} \]
          10. distribute-lft-inN/A

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

            \[\leadsto y \cdot x + z \cdot \color{blue}{\left(x + 5\right)} \]
          12. lift-*.f64N/A

            \[\leadsto \color{blue}{y \cdot x} + z \cdot \left(x + 5\right) \]
          13. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, z \cdot \left(x + 5\right)\right)} \]
          14. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
          15. lower-*.f6499.9

            \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
        6. Applied rewrites99.9%

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

          \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{5} \cdot z\right) \]
        8. Step-by-step derivation
          1. Applied rewrites99.1%

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

              \[\leadsto \color{blue}{y \cdot x + 5 \cdot z} \]
            2. +-commutativeN/A

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

              \[\leadsto \color{blue}{5 \cdot z} + y \cdot x \]
            4. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(5, z, y \cdot x\right)} \]
            5. lower-*.f6499.1

              \[\leadsto \mathsf{fma}\left(5, z, \color{blue}{y \cdot x}\right) \]
          3. Applied rewrites99.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(5, z, y \cdot x\right)} \]

          if 2.34999999999999993e-4 < x

          1. Initial program 99.9%

            \[x \cdot \left(y + z\right) + z \cdot 5 \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-+.f64N/A

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

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

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

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

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

              \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
            7. lift-*.f64N/A

              \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
            8. distribute-lft-outN/A

              \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
            9. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
            10. lower-+.f64N/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
            11. lower-*.f64100.0

              \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
          4. Applied rewrites100.0%

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

            \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
          6. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
            2. distribute-lft-inN/A

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

              \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
            4. mul-1-negN/A

              \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
            5. remove-double-negN/A

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

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

              \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
            8. lower-+.f6499.9

              \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
          7. Applied rewrites99.9%

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

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x \cdot y\right) \]
          9. Recombined 3 regimes into one program.
          10. Add Preprocessing

          Alternative 5: 98.2% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5:\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{elif}\;x \leq 0.000235:\\ \;\;\;\;\mathsf{fma}\left(y, x, 5 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= x -5.0)
             (* (+ y z) x)
             (if (<= x 0.000235) (fma y x (* 5.0 z)) (fma z x (* x y)))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (x <= -5.0) {
          		tmp = (y + z) * x;
          	} else if (x <= 0.000235) {
          		tmp = fma(y, x, (5.0 * z));
          	} else {
          		tmp = fma(z, x, (x * y));
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (x <= -5.0)
          		tmp = Float64(Float64(y + z) * x);
          	elseif (x <= 0.000235)
          		tmp = fma(y, x, Float64(5.0 * z));
          	else
          		tmp = fma(z, x, Float64(x * y));
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[x, -5.0], N[(N[(y + z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 0.000235], N[(y * x + N[(5.0 * z), $MachinePrecision]), $MachinePrecision], N[(z * x + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -5:\\
          \;\;\;\;\left(y + z\right) \cdot x\\
          
          \mathbf{elif}\;x \leq 0.000235:\\
          \;\;\;\;\mathsf{fma}\left(y, x, 5 \cdot z\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x < -5

            1. Initial program 99.9%

              \[x \cdot \left(y + z\right) + z \cdot 5 \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-+.f64N/A

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

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

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

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

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

                \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
              7. lift-*.f64N/A

                \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
              8. distribute-lft-outN/A

                \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
              9. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
              10. lower-+.f64N/A

                \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
              11. lower-*.f6498.1

                \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
            4. Applied rewrites98.1%

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

              \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
              2. distribute-lft-inN/A

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

                \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
              4. mul-1-negN/A

                \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
              5. remove-double-negN/A

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

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

                \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
              8. lower-+.f6497.9

                \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
            7. Applied rewrites97.9%

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

            if -5 < x < 2.34999999999999993e-4

            1. Initial program 99.9%

              \[x \cdot \left(y + z\right) + z \cdot 5 \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-+.f64N/A

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

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

                \[\leadsto \color{blue}{z \cdot 5} + x \cdot \left(y + z\right) \]
              4. lower-fma.f64100.0

                \[\leadsto \color{blue}{\mathsf{fma}\left(z, 5, x \cdot \left(y + z\right)\right)} \]
              5. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{x \cdot \left(y + z\right)}\right) \]
              6. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
              7. lower-*.f64100.0

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
              8. lift-+.f64N/A

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right)} \cdot x\right) \]
              9. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
              10. lower-+.f64100.0

                \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
            4. Applied rewrites100.0%

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left(y \cdot x + z \cdot x\right)} + z \cdot 5 \]
              8. lift-*.f64N/A

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

                \[\leadsto \color{blue}{y \cdot x + \left(z \cdot x + z \cdot 5\right)} \]
              10. distribute-lft-inN/A

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

                \[\leadsto y \cdot x + z \cdot \color{blue}{\left(x + 5\right)} \]
              12. lift-*.f64N/A

                \[\leadsto \color{blue}{y \cdot x} + z \cdot \left(x + 5\right) \]
              13. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, z \cdot \left(x + 5\right)\right)} \]
              14. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
              15. lower-*.f6499.9

                \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
            6. Applied rewrites99.9%

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

              \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{5} \cdot z\right) \]
            8. Step-by-step derivation
              1. Applied rewrites99.1%

                \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{5} \cdot z\right) \]

              if 2.34999999999999993e-4 < x

              1. Initial program 99.9%

                \[x \cdot \left(y + z\right) + z \cdot 5 \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-+.f64N/A

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
                7. lift-*.f64N/A

                  \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
                8. distribute-lft-outN/A

                  \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
                9. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
                10. lower-+.f64N/A

                  \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
                11. lower-*.f64100.0

                  \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
              4. Applied rewrites100.0%

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

                \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                2. distribute-lft-inN/A

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

                  \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
                4. mul-1-negN/A

                  \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
                5. remove-double-negN/A

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

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

                  \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
                8. lower-+.f6499.9

                  \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
              7. Applied rewrites99.9%

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

                  \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x \cdot y\right) \]
              9. Recombined 3 regimes into one program.
              10. Add Preprocessing

              Alternative 6: 83.8% accurate, 0.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -650000000:\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-81}:\\ \;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= x -650000000.0)
                 (* (+ y z) x)
                 (if (<= x 2.5e-81) (fma z 5.0 (* x z)) (fma z x (* x y)))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -650000000.0) {
              		tmp = (y + z) * x;
              	} else if (x <= 2.5e-81) {
              		tmp = fma(z, 5.0, (x * z));
              	} else {
              		tmp = fma(z, x, (x * y));
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -650000000.0)
              		tmp = Float64(Float64(y + z) * x);
              	elseif (x <= 2.5e-81)
              		tmp = fma(z, 5.0, Float64(x * z));
              	else
              		tmp = fma(z, x, Float64(x * y));
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -650000000.0], N[(N[(y + z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.5e-81], N[(z * 5.0 + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(z * x + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \leq -650000000:\\
              \;\;\;\;\left(y + z\right) \cdot x\\
              
              \mathbf{elif}\;x \leq 2.5 \cdot 10^{-81}:\\
              \;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < -6.5e8

                1. Initial program 99.9%

                  \[x \cdot \left(y + z\right) + z \cdot 5 \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-+.f64N/A

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

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

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

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

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

                    \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
                  7. lift-*.f64N/A

                    \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
                  8. distribute-lft-outN/A

                    \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
                  9. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
                  10. lower-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
                  11. lower-*.f6498.0

                    \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
                4. Applied rewrites98.0%

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

                  \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                6. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                  2. distribute-lft-inN/A

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

                    \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
                  4. mul-1-negN/A

                    \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
                  5. remove-double-negN/A

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

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

                    \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
                  8. lower-+.f6499.9

                    \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
                7. Applied rewrites99.9%

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

                if -6.5e8 < x < 2.4999999999999999e-81

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
                4. Step-by-step derivation
                  1. distribute-rgt-inN/A

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

                    \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                  3. lower-*.f64N/A

                    \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                  4. lower-+.f6472.9

                    \[\leadsto \color{blue}{\left(5 + x\right)} \cdot z \]
                5. Applied rewrites72.9%

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

                    \[\leadsto \mathsf{fma}\left(z, \color{blue}{5}, x \cdot z\right) \]

                  if 2.4999999999999999e-81 < x

                  1. Initial program 99.9%

                    \[x \cdot \left(y + z\right) + z \cdot 5 \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-+.f64N/A

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
                    7. lift-*.f64N/A

                      \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
                    8. distribute-lft-outN/A

                      \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
                    9. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
                    10. lower-+.f64N/A

                      \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
                    11. lower-*.f6499.9

                      \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
                  4. Applied rewrites99.9%

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

                    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                  6. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                    2. distribute-lft-inN/A

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

                      \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
                    4. mul-1-negN/A

                      \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
                    5. remove-double-negN/A

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

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

                      \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
                    8. lower-+.f6491.6

                      \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
                  7. Applied rewrites91.6%

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

                      \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x \cdot y\right) \]
                  9. Recombined 3 regimes into one program.
                  10. Final simplification84.4%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -650000000:\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-81}:\\ \;\;\;\;\mathsf{fma}\left(z, 5, x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x \cdot y\right)\\ \end{array} \]
                  11. Add Preprocessing

                  Alternative 7: 84.4% accurate, 0.8× speedup?

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

                    1. Initial program 99.9%

                      \[x \cdot \left(y + z\right) + z \cdot 5 \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(z \cdot x + z \cdot 5\right) + y \cdot x} \]
                      7. lift-*.f64N/A

                        \[\leadsto \left(z \cdot x + \color{blue}{z \cdot 5}\right) + y \cdot x \]
                      8. distribute-lft-outN/A

                        \[\leadsto \color{blue}{z \cdot \left(x + 5\right)} + y \cdot x \]
                      9. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(z, x + 5, y \cdot x\right)} \]
                      10. lower-+.f64N/A

                        \[\leadsto \mathsf{fma}\left(z, \color{blue}{x + 5}, y \cdot x\right) \]
                      11. lower-*.f6499.2

                        \[\leadsto \mathsf{fma}\left(z, x + 5, \color{blue}{y \cdot x}\right) \]
                    4. Applied rewrites99.2%

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

                      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                    6. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(-1 \cdot y + -1 \cdot z\right)\right)} \]
                      2. distribute-lft-inN/A

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

                        \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(-1 \cdot \left(y + z\right)\right)\right)} \]
                      4. mul-1-negN/A

                        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y + z\right)\right)\right)}\right)\right) \]
                      5. remove-double-negN/A

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

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

                        \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
                      8. lower-+.f6494.8

                        \[\leadsto \color{blue}{\left(y + z\right)} \cdot x \]
                    7. Applied rewrites94.8%

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

                    if -6.5e8 < x < 2.4999999999999999e-81

                    1. Initial program 99.9%

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

                      \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
                    4. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      3. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      4. lower-+.f6472.9

                        \[\leadsto \color{blue}{\left(5 + x\right)} \cdot z \]
                    5. Applied rewrites72.9%

                      \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification84.4%

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

                  Alternative 8: 74.8% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+99} \lor \neg \left(y \leq 2.05 \cdot 10^{+36}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(5 + x\right) \cdot z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= y -9.5e+99) (not (<= y 2.05e+36))) (* y x) (* (+ 5.0 x) z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((y <= -9.5e+99) || !(y <= 2.05e+36)) {
                  		tmp = y * x;
                  	} else {
                  		tmp = (5.0 + x) * 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 ((y <= (-9.5d+99)) .or. (.not. (y <= 2.05d+36))) then
                          tmp = y * x
                      else
                          tmp = (5.0d0 + x) * z
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if ((y <= -9.5e+99) || !(y <= 2.05e+36)) {
                  		tmp = y * x;
                  	} else {
                  		tmp = (5.0 + x) * z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if (y <= -9.5e+99) or not (y <= 2.05e+36):
                  		tmp = y * x
                  	else:
                  		tmp = (5.0 + x) * z
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((y <= -9.5e+99) || !(y <= 2.05e+36))
                  		tmp = Float64(y * x);
                  	else
                  		tmp = Float64(Float64(5.0 + x) * z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if ((y <= -9.5e+99) || ~((y <= 2.05e+36)))
                  		tmp = y * x;
                  	else
                  		tmp = (5.0 + x) * z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e+99], N[Not[LessEqual[y, 2.05e+36]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(N[(5.0 + x), $MachinePrecision] * z), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -9.5 \cdot 10^{+99} \lor \neg \left(y \leq 2.05 \cdot 10^{+36}\right):\\
                  \;\;\;\;y \cdot x\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left(5 + x\right) \cdot z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -9.49999999999999908e99 or 2.05000000000000006e36 < y

                    1. Initial program 99.9%

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

                      \[\leadsto \color{blue}{x \cdot y} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{y \cdot x} \]
                      2. lower-*.f6473.0

                        \[\leadsto \color{blue}{y \cdot x} \]
                    5. Applied rewrites73.0%

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

                    if -9.49999999999999908e99 < y < 2.05000000000000006e36

                    1. Initial program 99.9%

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

                      \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
                    4. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      3. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      4. lower-+.f6478.2

                        \[\leadsto \color{blue}{\left(5 + x\right)} \cdot z \]
                    5. Applied rewrites78.2%

                      \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification76.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+99} \lor \neg \left(y \leq 2.05 \cdot 10^{+36}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(5 + x\right) \cdot z\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 9: 61.2% accurate, 0.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \lor \neg \left(x \leq 8200000000000\right):\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;5 \cdot z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= x -5.0) (not (<= x 8200000000000.0))) (* x z) (* 5.0 z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((x <= -5.0) || !(x <= 8200000000000.0)) {
                  		tmp = x * z;
                  	} else {
                  		tmp = 5.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 <= (-5.0d0)) .or. (.not. (x <= 8200000000000.0d0))) then
                          tmp = x * z
                      else
                          tmp = 5.0d0 * z
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if ((x <= -5.0) || !(x <= 8200000000000.0)) {
                  		tmp = x * z;
                  	} else {
                  		tmp = 5.0 * z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if (x <= -5.0) or not (x <= 8200000000000.0):
                  		tmp = x * z
                  	else:
                  		tmp = 5.0 * z
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((x <= -5.0) || !(x <= 8200000000000.0))
                  		tmp = Float64(x * z);
                  	else
                  		tmp = Float64(5.0 * z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if ((x <= -5.0) || ~((x <= 8200000000000.0)))
                  		tmp = x * z;
                  	else
                  		tmp = 5.0 * z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[x, -5.0], N[Not[LessEqual[x, 8200000000000.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(5.0 * z), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -5 \lor \neg \left(x \leq 8200000000000\right):\\
                  \;\;\;\;x \cdot z\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;5 \cdot z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -5 or 8.2e12 < x

                    1. Initial program 99.9%

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

                      \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
                    4. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      3. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      4. lower-+.f6446.6

                        \[\leadsto \color{blue}{\left(5 + x\right)} \cdot z \]
                    5. Applied rewrites46.6%

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

                      \[\leadsto x \cdot \color{blue}{z} \]
                    7. Step-by-step derivation
                      1. Applied rewrites45.6%

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

                      if -5 < x < 8.2e12

                      1. Initial program 99.9%

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

                        \[\leadsto \color{blue}{5 \cdot z} \]
                      4. Step-by-step derivation
                        1. lower-*.f6467.2

                          \[\leadsto \color{blue}{5 \cdot z} \]
                      5. Applied rewrites67.2%

                        \[\leadsto \color{blue}{5 \cdot z} \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification57.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \lor \neg \left(x \leq 8200000000000\right):\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;5 \cdot z\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 10: 99.0% accurate, 1.1× speedup?

                    \[\begin{array}{l} \\ \mathsf{fma}\left(y, x, \left(x + 5\right) \cdot z\right) \end{array} \]
                    (FPCore (x y z) :precision binary64 (fma y x (* (+ x 5.0) z)))
                    double code(double x, double y, double z) {
                    	return fma(y, x, ((x + 5.0) * z));
                    }
                    
                    function code(x, y, z)
                    	return fma(y, x, Float64(Float64(x + 5.0) * z))
                    end
                    
                    code[x_, y_, z_] := N[(y * x + N[(N[(x + 5.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \mathsf{fma}\left(y, x, \left(x + 5\right) \cdot z\right)
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.9%

                      \[x \cdot \left(y + z\right) + z \cdot 5 \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

                        \[\leadsto \color{blue}{z \cdot 5} + x \cdot \left(y + z\right) \]
                      4. lower-fma.f64100.0

                        \[\leadsto \color{blue}{\mathsf{fma}\left(z, 5, x \cdot \left(y + z\right)\right)} \]
                      5. lift-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{x \cdot \left(y + z\right)}\right) \]
                      6. *-commutativeN/A

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
                      7. lower-*.f64100.0

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right) \cdot x}\right) \]
                      8. lift-+.f64N/A

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(y + z\right)} \cdot x\right) \]
                      9. +-commutativeN/A

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
                      10. lower-+.f64100.0

                        \[\leadsto \mathsf{fma}\left(z, 5, \color{blue}{\left(z + y\right)} \cdot x\right) \]
                    4. Applied rewrites100.0%

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(y \cdot x + z \cdot x\right)} + z \cdot 5 \]
                      8. lift-*.f64N/A

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

                        \[\leadsto \color{blue}{y \cdot x + \left(z \cdot x + z \cdot 5\right)} \]
                      10. distribute-lft-inN/A

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

                        \[\leadsto y \cdot x + z \cdot \color{blue}{\left(x + 5\right)} \]
                      12. lift-*.f64N/A

                        \[\leadsto \color{blue}{y \cdot x} + z \cdot \left(x + 5\right) \]
                      13. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, z \cdot \left(x + 5\right)\right)} \]
                      14. *-commutativeN/A

                        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
                      15. lower-*.f6499.5

                        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\left(x + 5\right) \cdot z}\right) \]
                    6. Applied rewrites99.5%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \left(x + 5\right) \cdot z\right)} \]
                    7. Add Preprocessing

                    Alternative 11: 26.7% accurate, 2.8× speedup?

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

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

                      \[\leadsto \color{blue}{5 \cdot z + x \cdot z} \]
                    4. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      3. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(5 + x\right) \cdot z} \]
                      4. lower-+.f6458.1

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

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

                      \[\leadsto x \cdot \color{blue}{z} \]
                    7. Step-by-step derivation
                      1. Applied rewrites22.7%

                        \[\leadsto x \cdot \color{blue}{z} \]
                      2. Final simplification22.7%

                        \[\leadsto x \cdot z \]
                      3. Add Preprocessing

                      Developer Target 1: 97.9% accurate, 1.0× speedup?

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

                      Reproduce

                      ?
                      herbie shell --seed 2024352 
                      (FPCore (x y z)
                        :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, C"
                        :precision binary64
                      
                        :alt
                        (! :herbie-platform default (+ (* (+ x 5) z) (* x y)))
                      
                        (+ (* x (+ y z)) (* z 5.0)))