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

Percentage Accurate: 100.0% → 100.0%
Time: 8.8s
Alternatives: 5
Speedup: 1.0×

Specification

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

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

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

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

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot 2} + y \]
    7. lower-fma.f64100.0

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

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

Alternative 2: 76.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+22} \lor \neg \left(x \leq 2.8 \cdot 10^{+29}\right):\\ \;\;\;\;x + x\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -4.4e+22) (not (<= x 2.8e+29))) (+ x x) (+ y x)))
double code(double x, double y) {
	double tmp;
	if ((x <= -4.4e+22) || !(x <= 2.8e+29)) {
		tmp = x + x;
	} else {
		tmp = y + x;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-4.4d+22)) .or. (.not. (x <= 2.8d+29))) then
        tmp = x + x
    else
        tmp = y + x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -4.4e+22) || !(x <= 2.8e+29)) {
		tmp = x + x;
	} else {
		tmp = y + x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -4.4e+22) or not (x <= 2.8e+29):
		tmp = x + x
	else:
		tmp = y + x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -4.4e+22) || !(x <= 2.8e+29))
		tmp = Float64(x + x);
	else
		tmp = Float64(y + x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -4.4e+22) || ~((x <= 2.8e+29)))
		tmp = x + x;
	else
		tmp = y + x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -4.4e+22], N[Not[LessEqual[x, 2.8e+29]], $MachinePrecision]], N[(x + x), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+22} \lor \neg \left(x \leq 2.8 \cdot 10^{+29}\right):\\
\;\;\;\;x + x\\

\mathbf{else}:\\
\;\;\;\;y + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.4e22 or 2.8e29 < x

    1. Initial program 100.0%

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

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

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

      if -4.4e22 < x < 2.8e29

      1. Initial program 100.0%

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

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

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

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

      Alternative 3: 73.9% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+22} \lor \neg \left(x \leq 1.76 \cdot 10^{-63}\right):\\ \;\;\;\;x + x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (or (<= x -4.4e+22) (not (<= x 1.76e-63))) (+ x x) y))
      double code(double x, double y) {
      	double tmp;
      	if ((x <= -4.4e+22) || !(x <= 1.76e-63)) {
      		tmp = x + x;
      	} else {
      		tmp = y;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if ((x <= (-4.4d+22)) .or. (.not. (x <= 1.76d-63))) then
              tmp = x + x
          else
              tmp = y
          end if
          code = tmp
      end function
      
      public static double code(double x, double y) {
      	double tmp;
      	if ((x <= -4.4e+22) || !(x <= 1.76e-63)) {
      		tmp = x + x;
      	} else {
      		tmp = y;
      	}
      	return tmp;
      }
      
      def code(x, y):
      	tmp = 0
      	if (x <= -4.4e+22) or not (x <= 1.76e-63):
      		tmp = x + x
      	else:
      		tmp = y
      	return tmp
      
      function code(x, y)
      	tmp = 0.0
      	if ((x <= -4.4e+22) || !(x <= 1.76e-63))
      		tmp = Float64(x + x);
      	else
      		tmp = y;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if ((x <= -4.4e+22) || ~((x <= 1.76e-63)))
      		tmp = x + x;
      	else
      		tmp = y;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_] := If[Or[LessEqual[x, -4.4e+22], N[Not[LessEqual[x, 1.76e-63]], $MachinePrecision]], N[(x + x), $MachinePrecision], y]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -4.4 \cdot 10^{+22} \lor \neg \left(x \leq 1.76 \cdot 10^{-63}\right):\\
      \;\;\;\;x + x\\
      
      \mathbf{else}:\\
      \;\;\;\;y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -4.4e22 or 1.76e-63 < x

        1. Initial program 100.0%

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

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

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

          if -4.4e22 < x < 1.76e-63

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{y} \]
          4. Step-by-step derivation
            1. Applied rewrites81.6%

              \[\leadsto \color{blue}{y} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification78.9%

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

          Alternative 4: 100.0% accurate, 1.0× speedup?

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

            \[\left(x + y\right) + x \]
          2. Add Preprocessing
          3. Add Preprocessing

          Alternative 5: 50.6% accurate, 7.0× speedup?

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

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

            \[\leadsto \color{blue}{y} \]
          4. Step-by-step derivation
            1. Applied rewrites51.6%

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

            Developer Target 1: 100.0% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ y + 2 \cdot x \end{array} \]
            (FPCore (x y) :precision binary64 (+ y (* 2.0 x)))
            double code(double x, double y) {
            	return y + (2.0 * x);
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                code = y + (2.0d0 * x)
            end function
            
            public static double code(double x, double y) {
            	return y + (2.0 * x);
            }
            
            def code(x, y):
            	return y + (2.0 * x)
            
            function code(x, y)
            	return Float64(y + Float64(2.0 * x))
            end
            
            function tmp = code(x, y)
            	tmp = y + (2.0 * x);
            end
            
            code[x_, y_] := N[(y + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            y + 2 \cdot x
            \end{array}
            

            Reproduce

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