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

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

Specification

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

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?

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

Alternative 1: 98.5% accurate, 0.3× speedup?

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

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

    \[\leadsto \color{blue}{x + z} \]
  3. Step-by-step derivation
    1. lower-+.f6465.9%

      \[\leadsto x + \color{blue}{z} \]
  4. Applied rewrites65.9%

    \[\leadsto \color{blue}{x + z} \]
  5. Add Preprocessing

Alternative 2: 97.7% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(x, z\right) + \mathsf{min}\left(y, \mathsf{max}\left(x, z\right)\right)\\ t_1 := \mathsf{max}\left(y, \mathsf{max}\left(x, z\right)\right)\\ \mathbf{if}\;t\_0 + t\_1 \leq -5 \cdot 10^{-236}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (fmin x z) (fmin y (fmax x z)))) (t_1 (fmax y (fmax x z))))
   (if (<= (+ t_0 t_1) -5e-236) t_0 t_1)))
double code(double x, double y, double z) {
	double t_0 = fmin(x, z) + fmin(y, fmax(x, z));
	double t_1 = fmax(y, fmax(x, z));
	double tmp;
	if ((t_0 + t_1) <= -5e-236) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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 = fmin(x, z) + fmin(y, fmax(x, z))
    t_1 = fmax(y, fmax(x, z))
    if ((t_0 + t_1) <= (-5d-236)) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = fmin(x, z) + fmin(y, fmax(x, z));
	double t_1 = fmax(y, fmax(x, z));
	double tmp;
	if ((t_0 + t_1) <= -5e-236) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = fmin(x, z) + fmin(y, fmax(x, z))
	t_1 = fmax(y, fmax(x, z))
	tmp = 0
	if (t_0 + t_1) <= -5e-236:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(fmin(x, z) + fmin(y, fmax(x, z)))
	t_1 = fmax(y, fmax(x, z))
	tmp = 0.0
	if (Float64(t_0 + t_1) <= -5e-236)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = min(x, z) + min(y, max(x, z));
	t_1 = max(y, max(x, z));
	tmp = 0.0;
	if ((t_0 + t_1) <= -5e-236)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Min[x, z], $MachinePrecision] + N[Min[y, N[Max[x, z], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Max[y, N[Max[x, z], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 + t$95$1), $MachinePrecision], -5e-236], t$95$0, t$95$1]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, z\right) + \mathsf{min}\left(y, \mathsf{max}\left(x, z\right)\right)\\
t_1 := \mathsf{max}\left(y, \mathsf{max}\left(x, z\right)\right)\\
\mathbf{if}\;t\_0 + t\_1 \leq -5 \cdot 10^{-236}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + z} \]
    3. Step-by-step derivation
      1. lower-+.f6465.9%

        \[\leadsto x + \color{blue}{z} \]
    4. Applied rewrites65.9%

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

      \[\leadsto z \]
    6. Step-by-step derivation
      1. Applied rewrites34.2%

        \[\leadsto z \]
      2. Taylor expanded in z around 0

        \[\leadsto \color{blue}{x + y} \]
      3. Step-by-step derivation
        1. lower-+.f6466.9%

          \[\leadsto x + \color{blue}{y} \]
      4. Applied rewrites66.9%

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

      if -4.9999999999999998e-236 < (+.f64 (+.f64 x y) z)

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{x + z} \]
      3. Step-by-step derivation
        1. lower-+.f6465.9%

          \[\leadsto x + \color{blue}{z} \]
      4. Applied rewrites65.9%

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

        \[\leadsto z \]
      6. Step-by-step derivation
        1. Applied rewrites34.2%

          \[\leadsto z \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 3: 97.0% accurate, 0.1× speedup?

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

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. lower-+.f6465.9%

            \[\leadsto x + \color{blue}{z} \]
        4. Applied rewrites65.9%

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

          \[\leadsto z \]
        6. Step-by-step derivation
          1. Applied rewrites34.2%

            \[\leadsto z \]
          2. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x} \]
          3. Step-by-step derivation
            1. Applied rewrites33.5%

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

            if -4.9999999999999998e-236 < (+.f64 (+.f64 x y) z)

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + z} \]
            3. Step-by-step derivation
              1. lower-+.f6465.9%

                \[\leadsto x + \color{blue}{z} \]
            4. Applied rewrites65.9%

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

              \[\leadsto z \]
            6. Step-by-step derivation
              1. Applied rewrites34.2%

                \[\leadsto z \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 4: 48.8% accurate, 0.9× speedup?

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

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

              \[\leadsto \color{blue}{x + z} \]
            3. Step-by-step derivation
              1. lower-+.f6465.9%

                \[\leadsto x + \color{blue}{z} \]
            4. Applied rewrites65.9%

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

              \[\leadsto z \]
            6. Step-by-step derivation
              1. Applied rewrites34.2%

                \[\leadsto z \]
              2. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x} \]
              3. Step-by-step derivation
                1. Applied rewrites33.5%

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

                Reproduce

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