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

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

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 73.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-z\right)\\ t_1 := y \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -2.85 \cdot 10^{+196}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -8000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+191}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (- z))) (t_1 (* y (- z))))
   (if (<= z -2.85e+196)
     t_0
     (if (<= z -8000000.0)
       t_1
       (if (<= z 1.0) (+ y x) (if (<= z 5.4e+191) t_1 t_0))))))
double code(double x, double y, double z) {
	double t_0 = x * -z;
	double t_1 = y * -z;
	double tmp;
	if (z <= -2.85e+196) {
		tmp = t_0;
	} else if (z <= -8000000.0) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = y + x;
	} else if (z <= 5.4e+191) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * -z
    t_1 = y * -z
    if (z <= (-2.85d+196)) then
        tmp = t_0
    else if (z <= (-8000000.0d0)) then
        tmp = t_1
    else if (z <= 1.0d0) then
        tmp = y + x
    else if (z <= 5.4d+191) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * -z;
	double t_1 = y * -z;
	double tmp;
	if (z <= -2.85e+196) {
		tmp = t_0;
	} else if (z <= -8000000.0) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = y + x;
	} else if (z <= 5.4e+191) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * -z
	t_1 = y * -z
	tmp = 0
	if z <= -2.85e+196:
		tmp = t_0
	elif z <= -8000000.0:
		tmp = t_1
	elif z <= 1.0:
		tmp = y + x
	elif z <= 5.4e+191:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-z))
	t_1 = Float64(y * Float64(-z))
	tmp = 0.0
	if (z <= -2.85e+196)
		tmp = t_0;
	elseif (z <= -8000000.0)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = Float64(y + x);
	elseif (z <= 5.4e+191)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * -z;
	t_1 = y * -z;
	tmp = 0.0;
	if (z <= -2.85e+196)
		tmp = t_0;
	elseif (z <= -8000000.0)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = y + x;
	elseif (z <= 5.4e+191)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(y * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.85e+196], t$95$0, If[LessEqual[z, -8000000.0], t$95$1, If[LessEqual[z, 1.0], N[(y + x), $MachinePrecision], If[LessEqual[z, 5.4e+191], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
t_1 := y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.85 \cdot 10^{+196}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -8000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y + x\\

\mathbf{elif}\;z \leq 5.4 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.8500000000000001e196 or 5.39999999999999992e191 < z

    1. Initial program 100.0%

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

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

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

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

          \[\leadsto x \cdot \left(\mathsf{neg}\left(z\right)\right) \]
        2. lower-neg.f6456.2

          \[\leadsto x \cdot \left(-z\right) \]
      4. Applied rewrites56.2%

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

      if -2.8500000000000001e196 < z < -8e6 or 1 < z < 5.39999999999999992e191

      1. Initial program 100.0%

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

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

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

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

            \[\leadsto y \cdot \left(\mathsf{neg}\left(z\right)\right) \]
          2. lower-neg.f6450.2

            \[\leadsto y \cdot \left(-z\right) \]
        4. Applied rewrites50.2%

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

        if -8e6 < z < 1

        1. Initial program 100.0%

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

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

            \[\leadsto y + \color{blue}{x} \]
          2. lower-+.f6497.0

            \[\leadsto y + \color{blue}{x} \]
        5. Applied rewrites97.0%

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

      Alternative 3: 49.9% accurate, 0.5× speedup?

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

        1. Initial program 100.0%

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

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

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

          if -2.0000000000000001e-184 < (+.f64 x y) < 1.99999999999999993e278

          1. Initial program 100.0%

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

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

              \[\leadsto y + \color{blue}{x} \]
            2. lower-+.f6454.7

              \[\leadsto y + \color{blue}{x} \]
          5. Applied rewrites54.7%

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

          if 1.99999999999999993e278 < (+.f64 x y)

          1. Initial program 100.0%

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

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

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

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

                \[\leadsto y \cdot \left(\mathsf{neg}\left(z\right)\right) \]
              2. lower-neg.f6453.8

                \[\leadsto y \cdot \left(-z\right) \]
            4. Applied rewrites53.8%

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

          Alternative 4: 74.5% accurate, 0.6× speedup?

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

            1. Initial program 100.0%

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

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

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

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

                  \[\leadsto x \cdot \left(\mathsf{neg}\left(z\right)\right) \]
                2. lower-neg.f6452.0

                  \[\leadsto x \cdot \left(-z\right) \]
              4. Applied rewrites52.0%

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

              if -11 < z < 1

              1. Initial program 100.0%

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

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

                  \[\leadsto y + \color{blue}{x} \]
                2. lower-+.f6497.7

                  \[\leadsto y + \color{blue}{x} \]
              5. Applied rewrites97.7%

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

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

            Alternative 5: 51.3% accurate, 0.7× speedup?

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

              1. Initial program 100.0%

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

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

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

                if -2.0000000000000001e-293 < (+.f64 x y)

                1. Initial program 100.0%

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

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

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

                Alternative 6: 25.4% accurate, 0.7× speedup?

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

                  1. Initial program 100.0%

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

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

                      \[\leadsto y + \color{blue}{x} \]
                    2. lower-+.f6453.1

                      \[\leadsto y + \color{blue}{x} \]
                  5. Applied rewrites53.1%

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

                    \[\leadsto x \]
                  7. Step-by-step derivation
                    1. +-commutative26.9

                      \[\leadsto x \]
                  8. Applied rewrites26.9%

                    \[\leadsto x \]

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

                  1. Initial program 100.0%

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

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

                      \[\leadsto y + \color{blue}{x} \]
                    2. lower-+.f6448.8

                      \[\leadsto y + \color{blue}{x} \]
                  5. Applied rewrites48.8%

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

                    \[\leadsto y \]
                  7. Step-by-step derivation
                    1. +-commutative26.6

                      \[\leadsto y \]
                  8. Applied rewrites26.6%

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

                Alternative 7: 50.0% accurate, 3.0× speedup?

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

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

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

                    \[\leadsto y + \color{blue}{x} \]
                  2. lower-+.f6451.0

                    \[\leadsto y + \color{blue}{x} \]
                5. Applied rewrites51.0%

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

                Alternative 8: 25.6% accurate, 12.0× speedup?

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

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

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

                    \[\leadsto y + \color{blue}{x} \]
                  2. lower-+.f6451.0

                    \[\leadsto y + \color{blue}{x} \]
                5. Applied rewrites51.0%

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

                  \[\leadsto x \]
                7. Step-by-step derivation
                  1. +-commutative25.6

                    \[\leadsto x \]
                8. Applied rewrites25.6%

                  \[\leadsto x \]
                9. Add Preprocessing

                Reproduce

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