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

Percentage Accurate: 100.0% → 98.9%
Time: 4.4s
Alternatives: 10
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);
}
real(8) function code(x, y, z)
    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 10 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);
}
real(8) function code(x, y, z)
    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: 98.9% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \mathsf{fma}\left(1 - z, y, \left(1 - z\right) \cdot x\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (fma (- 1.0 z) y (* (- 1.0 z) x)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return fma((1.0 - z), y, ((1.0 - z) * x));
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	return fma(Float64(1.0 - z), y, Float64(Float64(1.0 - z) * x))
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\mathsf{fma}\left(1 - z, y, \left(1 - z\right) \cdot x\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x + y\right) \cdot \left(1 - z\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative100.0%

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

      \[\leadsto \left(1 - z\right) \cdot \color{blue}{\left(y + x\right)} \]
    3. distribute-lft-in98.4%

      \[\leadsto \color{blue}{\left(1 - z\right) \cdot y + \left(1 - z\right) \cdot x} \]
    4. fma-def98.4%

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

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

    \[\leadsto \mathsf{fma}\left(1 - z, y, \left(1 - z\right) \cdot x\right) \]
  6. Add Preprocessing

Alternative 2: 75.3% accurate, 0.2× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := \left(1 - z\right) \cdot y\\ t_1 := z \cdot \left(-x\right)\\ \mathbf{if}\;1 - z \leq -1 \cdot 10^{+238}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{elif}\;1 - z \leq -5 \cdot 10^{+186}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;1 - z \leq -400:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;1 - z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (- 1.0 z) y)) (t_1 (* z (- x))))
   (if (<= (- 1.0 z) -1e+238)
     (* z (- y))
     (if (<= (- 1.0 z) -5e+186)
       t_1
       (if (<= (- 1.0 z) -400.0)
         t_0
         (if (<= (- 1.0 z) 1.0)
           (+ y x)
           (if (<= (- 1.0 z) 5e+171) t_0 t_1)))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = (1.0 - z) * y;
	double t_1 = z * -x;
	double tmp;
	if ((1.0 - z) <= -1e+238) {
		tmp = z * -y;
	} else if ((1.0 - z) <= -5e+186) {
		tmp = t_1;
	} else if ((1.0 - z) <= -400.0) {
		tmp = t_0;
	} else if ((1.0 - z) <= 1.0) {
		tmp = y + x;
	} else if ((1.0 - z) <= 5e+171) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    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 = (1.0d0 - z) * y
    t_1 = z * -x
    if ((1.0d0 - z) <= (-1d+238)) then
        tmp = z * -y
    else if ((1.0d0 - z) <= (-5d+186)) then
        tmp = t_1
    else if ((1.0d0 - z) <= (-400.0d0)) then
        tmp = t_0
    else if ((1.0d0 - z) <= 1.0d0) then
        tmp = y + x
    else if ((1.0d0 - z) <= 5d+171) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double t_0 = (1.0 - z) * y;
	double t_1 = z * -x;
	double tmp;
	if ((1.0 - z) <= -1e+238) {
		tmp = z * -y;
	} else if ((1.0 - z) <= -5e+186) {
		tmp = t_1;
	} else if ((1.0 - z) <= -400.0) {
		tmp = t_0;
	} else if ((1.0 - z) <= 1.0) {
		tmp = y + x;
	} else if ((1.0 - z) <= 5e+171) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	t_0 = (1.0 - z) * y
	t_1 = z * -x
	tmp = 0
	if (1.0 - z) <= -1e+238:
		tmp = z * -y
	elif (1.0 - z) <= -5e+186:
		tmp = t_1
	elif (1.0 - z) <= -400.0:
		tmp = t_0
	elif (1.0 - z) <= 1.0:
		tmp = y + x
	elif (1.0 - z) <= 5e+171:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(Float64(1.0 - z) * y)
	t_1 = Float64(z * Float64(-x))
	tmp = 0.0
	if (Float64(1.0 - z) <= -1e+238)
		tmp = Float64(z * Float64(-y));
	elseif (Float64(1.0 - z) <= -5e+186)
		tmp = t_1;
	elseif (Float64(1.0 - z) <= -400.0)
		tmp = t_0;
	elseif (Float64(1.0 - z) <= 1.0)
		tmp = Float64(y + x);
	elseif (Float64(1.0 - z) <= 5e+171)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	t_0 = (1.0 - z) * y;
	t_1 = z * -x;
	tmp = 0.0;
	if ((1.0 - z) <= -1e+238)
		tmp = z * -y;
	elseif ((1.0 - z) <= -5e+186)
		tmp = t_1;
	elseif ((1.0 - z) <= -400.0)
		tmp = t_0;
	elseif ((1.0 - z) <= 1.0)
		tmp = y + x;
	elseif ((1.0 - z) <= 5e+171)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(z * (-x)), $MachinePrecision]}, If[LessEqual[N[(1.0 - z), $MachinePrecision], -1e+238], N[(z * (-y)), $MachinePrecision], If[LessEqual[N[(1.0 - z), $MachinePrecision], -5e+186], t$95$1, If[LessEqual[N[(1.0 - z), $MachinePrecision], -400.0], t$95$0, If[LessEqual[N[(1.0 - z), $MachinePrecision], 1.0], N[(y + x), $MachinePrecision], If[LessEqual[N[(1.0 - z), $MachinePrecision], 5e+171], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \left(1 - z\right) \cdot y\\
t_1 := z \cdot \left(-x\right)\\
\mathbf{if}\;1 - z \leq -1 \cdot 10^{+238}:\\
\;\;\;\;z \cdot \left(-y\right)\\

\mathbf{elif}\;1 - z \leq -5 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;1 - z \leq -400:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;1 - z \leq 5 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (-.f64 1 z) < -1e238

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. *-commutative48.8%

        \[\leadsto -\color{blue}{z \cdot y} \]
      3. distribute-rgt-neg-in48.8%

        \[\leadsto \color{blue}{z \cdot \left(-y\right)} \]
    6. Simplified48.8%

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

    if -1e238 < (-.f64 1 z) < -4.99999999999999954e186 or 5.0000000000000004e171 < (-.f64 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 50.1%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg50.1%

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. *-commutative50.1%

        \[\leadsto -\color{blue}{z \cdot x} \]
      3. distribute-rgt-neg-in50.1%

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

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

    if -4.99999999999999954e186 < (-.f64 1 z) < -400 or 1 < (-.f64 1 z) < 5.0000000000000004e171

    1. Initial program 100.0%

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

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

    if -400 < (-.f64 1 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 98.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - z \leq -1 \cdot 10^{+238}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{elif}\;1 - z \leq -5 \cdot 10^{+186}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{elif}\;1 - z \leq -400:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \mathbf{elif}\;1 - z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+171}:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 75.1% accurate, 0.2× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := z \cdot \left(-x\right)\\ t_1 := z \cdot \left(-y\right)\\ \mathbf{if}\;z \leq -2.15 \cdot 10^{+172}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -130:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{+185} \lor \neg \left(z \leq 2.8 \cdot 10^{+237}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (- x))) (t_1 (* z (- y))))
   (if (<= z -2.15e+172)
     t_0
     (if (<= z -130.0)
       t_1
       (if (<= z 1.0)
         (+ y x)
         (if (or (<= z 1.26e+185) (not (<= z 2.8e+237))) t_1 t_0))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = z * -x;
	double t_1 = z * -y;
	double tmp;
	if (z <= -2.15e+172) {
		tmp = t_0;
	} else if (z <= -130.0) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = y + x;
	} else if ((z <= 1.26e+185) || !(z <= 2.8e+237)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    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 = z * -x
    t_1 = z * -y
    if (z <= (-2.15d+172)) then
        tmp = t_0
    else if (z <= (-130.0d0)) then
        tmp = t_1
    else if (z <= 1.0d0) then
        tmp = y + x
    else if ((z <= 1.26d+185) .or. (.not. (z <= 2.8d+237))) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double t_0 = z * -x;
	double t_1 = z * -y;
	double tmp;
	if (z <= -2.15e+172) {
		tmp = t_0;
	} else if (z <= -130.0) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = y + x;
	} else if ((z <= 1.26e+185) || !(z <= 2.8e+237)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	t_0 = z * -x
	t_1 = z * -y
	tmp = 0
	if z <= -2.15e+172:
		tmp = t_0
	elif z <= -130.0:
		tmp = t_1
	elif z <= 1.0:
		tmp = y + x
	elif (z <= 1.26e+185) or not (z <= 2.8e+237):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(z * Float64(-x))
	t_1 = Float64(z * Float64(-y))
	tmp = 0.0
	if (z <= -2.15e+172)
		tmp = t_0;
	elseif (z <= -130.0)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = Float64(y + x);
	elseif ((z <= 1.26e+185) || !(z <= 2.8e+237))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	t_0 = z * -x;
	t_1 = z * -y;
	tmp = 0.0;
	if (z <= -2.15e+172)
		tmp = t_0;
	elseif (z <= -130.0)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = y + x;
	elseif ((z <= 1.26e+185) || ~((z <= 2.8e+237)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-x)), $MachinePrecision]}, Block[{t$95$1 = N[(z * (-y)), $MachinePrecision]}, If[LessEqual[z, -2.15e+172], t$95$0, If[LessEqual[z, -130.0], t$95$1, If[LessEqual[z, 1.0], N[(y + x), $MachinePrecision], If[Or[LessEqual[z, 1.26e+185], N[Not[LessEqual[z, 2.8e+237]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
t_1 := z \cdot \left(-y\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+172}:\\
\;\;\;\;t\_0\\

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

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

\mathbf{elif}\;z \leq 1.26 \cdot 10^{+185} \lor \neg \left(z \leq 2.8 \cdot 10^{+237}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.1500000000000001e172 or 1.26e185 < z < 2.79999999999999983e237

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg50.1%

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. *-commutative50.1%

        \[\leadsto -\color{blue}{z \cdot x} \]
      3. distribute-rgt-neg-in50.1%

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

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

    if -2.1500000000000001e172 < z < -130 or 1 < z < 1.26e185 or 2.79999999999999983e237 < z

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg41.2%

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. *-commutative41.2%

        \[\leadsto -\color{blue}{z \cdot y} \]
      3. distribute-rgt-neg-in41.2%

        \[\leadsto \color{blue}{z \cdot \left(-y\right)} \]
    6. Simplified41.2%

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

    if -130 < 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 97.5%

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified97.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+172}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq -130:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{+185} \lor \neg \left(z \leq 2.8 \cdot 10^{+237}\right):\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.5% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;1 - z \leq -400 \lor \neg \left(1 - z \leq 2\right):\\ \;\;\;\;z \cdot \left(\left(-y\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= (- 1.0 z) -400.0) (not (<= (- 1.0 z) 2.0)))
   (* z (- (- y) x))
   (+ y x)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - z) <= -400.0) || !((1.0 - z) <= 2.0)) {
		tmp = z * (-y - x);
	} else {
		tmp = y + x;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (((1.0d0 - z) <= (-400.0d0)) .or. (.not. ((1.0d0 - z) <= 2.0d0))) then
        tmp = z * (-y - x)
    else
        tmp = y + x
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - z) <= -400.0) || !((1.0 - z) <= 2.0)) {
		tmp = z * (-y - x);
	} else {
		tmp = y + x;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	tmp = 0
	if ((1.0 - z) <= -400.0) or not ((1.0 - z) <= 2.0):
		tmp = z * (-y - x)
	else:
		tmp = y + x
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if ((Float64(1.0 - z) <= -400.0) || !(Float64(1.0 - z) <= 2.0))
		tmp = Float64(z * Float64(Float64(-y) - x));
	else
		tmp = Float64(y + x);
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((1.0 - z) <= -400.0) || ~(((1.0 - z) <= 2.0)))
		tmp = z * (-y - x);
	else
		tmp = y + x;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - z), $MachinePrecision], -400.0], N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 2.0]], $MachinePrecision]], N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - z \leq -400 \lor \neg \left(1 - z \leq 2\right):\\
\;\;\;\;z \cdot \left(\left(-y\right) - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 1 z) < -400 or 2 < (-.f64 1 z)

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(x + y\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(-1 \cdot z\right) \cdot \left(x + y\right)} \]
      2. neg-mul-198.0%

        \[\leadsto \color{blue}{\left(-z\right)} \cdot \left(x + y\right) \]
      3. *-commutative98.0%

        \[\leadsto \color{blue}{\left(x + y\right) \cdot \left(-z\right)} \]
      4. +-commutative98.0%

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

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

    if -400 < (-.f64 1 z) < 2

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified97.5%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.8%

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

Alternative 5: 74.0% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+24} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.75e+24) (not (<= z 1.0))) (* z (- x)) (+ y x)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.75e+24) || !(z <= 1.0)) {
		tmp = z * -x;
	} else {
		tmp = y + x;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1.75d+24)) .or. (.not. (z <= 1.0d0))) then
        tmp = z * -x
    else
        tmp = y + x
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.75e+24) || !(z <= 1.0)) {
		tmp = z * -x;
	} else {
		tmp = y + x;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	tmp = 0
	if (z <= -1.75e+24) or not (z <= 1.0):
		tmp = z * -x
	else:
		tmp = y + x
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.75e+24) || !(z <= 1.0))
		tmp = Float64(z * Float64(-x));
	else
		tmp = Float64(y + x);
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.75e+24) || ~((z <= 1.0)))
		tmp = z * -x;
	else
		tmp = y + x;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[z, -1.75e+24], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+24} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7500000000000001e24 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 59.2%

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

        \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
    5. Simplified59.2%

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

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

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. *-commutative58.2%

        \[\leadsto -\color{blue}{z \cdot x} \]
      3. distribute-rgt-neg-in58.2%

        \[\leadsto \color{blue}{z \cdot \left(-x\right)} \]
    8. Simplified58.2%

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

    if -1.7500000000000001e24 < 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 95.4%

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified95.4%

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

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

Alternative 6: 82.7% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-101}:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.5e-101) (* (- 1.0 z) x) (* (- 1.0 z) y)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.5e-101) {
		tmp = (1.0 - z) * x;
	} else {
		tmp = (1.0 - z) * y;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 1.5d-101) then
        tmp = (1.0d0 - z) * x
    else
        tmp = (1.0d0 - z) * y
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.5e-101) {
		tmp = (1.0 - z) * x;
	} else {
		tmp = (1.0 - z) * y;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	tmp = 0
	if y <= 1.5e-101:
		tmp = (1.0 - z) * x
	else:
		tmp = (1.0 - z) * y
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.5e-101)
		tmp = Float64(Float64(1.0 - z) * x);
	else
		tmp = Float64(Float64(1.0 - z) * y);
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.5e-101)
		tmp = (1.0 - z) * x;
	else
		tmp = (1.0 - z) * y;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, 1.5e-101], N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.5 \cdot 10^{-101}:\\
\;\;\;\;\left(1 - z\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;\left(1 - z\right) \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.5000000000000002e-101

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
    5. Simplified62.9%

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

    if 1.5000000000000002e-101 < 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 66.6%

      \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-101}:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \left(1 - z\right) \cdot \left(y + x\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* (- 1.0 z) (+ y x)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return (1.0 - z) * (y + x);
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (1.0d0 - z) * (y + x)
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	return (1.0 - z) * (y + x);
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	return (1.0 - z) * (y + x)
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(Float64(1.0 - z) * Float64(y + x))
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
	tmp = (1.0 - z) * (y + x);
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\left(1 - z\right) \cdot \left(y + x\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

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

Alternative 8: 42.2% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.08 \cdot 10^{-103}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (if (<= y 1.08e-103) x y))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.08e-103) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 1.08d-103) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.08e-103) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	tmp = 0
	if y <= 1.08e-103:
		tmp = x
	else:
		tmp = y
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.08e-103)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.08e-103)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, 1.08e-103], x, y]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.08 \cdot 10^{-103}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.0799999999999999e-103

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
    5. Simplified62.9%

      \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
    6. Taylor expanded in z around 0 29.4%

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

    if 1.0799999999999999e-103 < 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 66.6%

      \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} \]
    4. Taylor expanded in z around 0 34.9%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.08 \cdot 10^{-103}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 50.6% accurate, 2.3× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ y + x \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (+ y x))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return y + x;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = y + x
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	return y + x;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	return y + x
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(y + x)
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
	tmp = y + x;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
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 48.3%

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

      \[\leadsto \color{blue}{y + x} \]
  5. Simplified48.3%

    \[\leadsto \color{blue}{y + x} \]
  6. Final simplification48.3%

    \[\leadsto y + x \]
  7. Add Preprocessing

Alternative 10: 26.2% accurate, 7.0× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ x \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 x)
assert(x < y && y < z);
double code(double x, double y, double z) {
	return x;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	return x;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	return x
x, y, z = sort([x, y, z])
function code(x, y, z)
	return x
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
	tmp = x;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := x
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
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 x around inf 54.6%

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

      \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
  5. Simplified54.6%

    \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
  6. Taylor expanded in z around 0 25.2%

    \[\leadsto \color{blue}{x} \]
  7. Final simplification25.2%

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

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