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

Percentage Accurate: 100.0% → 100.0%
Time: 4.8s
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);
}
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 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);
}
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: 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}
Derivation
  1. Initial program 100.0%

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

Alternative 2: 32.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + y\right) \cdot \left(1 - z\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(-z\right) \cdot x\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-213}:\\ \;\;\;\;1 \cdot x\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;1 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (+ x y) (- 1.0 z))))
   (if (<= t_0 (- INFINITY))
     (* (- z) x)
     (if (<= t_0 -1e-213)
       (* 1.0 x)
       (if (<= t_0 INFINITY) (* 1.0 y) (* (- z) y))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) * (1.0 - z);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = -z * x;
	} else if (t_0 <= -1e-213) {
		tmp = 1.0 * x;
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = 1.0 * y;
	} else {
		tmp = -z * y;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = (x + y) * (1.0 - z);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = -z * x;
	} else if (t_0 <= -1e-213) {
		tmp = 1.0 * x;
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = 1.0 * y;
	} else {
		tmp = -z * y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) * (1.0 - z)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = -z * x
	elif t_0 <= -1e-213:
		tmp = 1.0 * x
	elif t_0 <= math.inf:
		tmp = 1.0 * y
	else:
		tmp = -z * y
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) * Float64(1.0 - z))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(-z) * x);
	elseif (t_0 <= -1e-213)
		tmp = Float64(1.0 * x);
	elseif (t_0 <= Inf)
		tmp = Float64(1.0 * y);
	else
		tmp = Float64(Float64(-z) * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) * (1.0 - z);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = -z * x;
	elseif (t_0 <= -1e-213)
		tmp = 1.0 * x;
	elseif (t_0 <= Inf)
		tmp = 1.0 * y;
	else
		tmp = -z * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[((-z) * x), $MachinePrecision], If[LessEqual[t$95$0, -1e-213], N[(1.0 * x), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(1.0 * y), $MachinePrecision], N[((-z) * y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x + y\right) \cdot \left(1 - z\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(-z\right) \cdot x\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-213}:\\
\;\;\;\;1 \cdot x\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;1 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -inf.0

    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. *-commutativeN/A

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

        \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
      3. lower--.f6444.0

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

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

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

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

      if -inf.0 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -9.9999999999999995e-214

      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. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
        3. lower--.f6453.6

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

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

        \[\leadsto 1 \cdot x \]
      7. Step-by-step derivation
        1. Applied rewrites35.4%

          \[\leadsto 1 \cdot x \]

        if -9.9999999999999995e-214 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < +inf.0

        1. Initial program 99.9%

          \[\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. *-commutativeN/A

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

            \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
          3. lower--.f6449.8

            \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
        5. Applied rewrites49.8%

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

          \[\leadsto 1 \cdot y \]
        7. Step-by-step derivation
          1. Applied rewrites29.4%

            \[\leadsto 1 \cdot y \]

          if +inf.0 < (*.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 x around 0

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

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

              \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
            3. lower--.f6449.9

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

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

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

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

          Alternative 3: 32.4% accurate, 0.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + y\right) \cdot \left(1 - z\right)\\ t_1 := \left(-z\right) \cdot x\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-213}:\\ \;\;\;\;1 \cdot x\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;1 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* (+ x y) (- 1.0 z))) (t_1 (* (- z) x)))
             (if (<= t_0 (- INFINITY))
               t_1
               (if (<= t_0 -1e-213) (* 1.0 x) (if (<= t_0 INFINITY) (* 1.0 y) t_1)))))
          double code(double x, double y, double z) {
          	double t_0 = (x + y) * (1.0 - z);
          	double t_1 = -z * x;
          	double tmp;
          	if (t_0 <= -((double) INFINITY)) {
          		tmp = t_1;
          	} else if (t_0 <= -1e-213) {
          		tmp = 1.0 * x;
          	} else if (t_0 <= ((double) INFINITY)) {
          		tmp = 1.0 * y;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          public static double code(double x, double y, double z) {
          	double t_0 = (x + y) * (1.0 - z);
          	double t_1 = -z * x;
          	double tmp;
          	if (t_0 <= -Double.POSITIVE_INFINITY) {
          		tmp = t_1;
          	} else if (t_0 <= -1e-213) {
          		tmp = 1.0 * x;
          	} else if (t_0 <= Double.POSITIVE_INFINITY) {
          		tmp = 1.0 * y;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = (x + y) * (1.0 - z)
          	t_1 = -z * x
          	tmp = 0
          	if t_0 <= -math.inf:
          		tmp = t_1
          	elif t_0 <= -1e-213:
          		tmp = 1.0 * x
          	elif t_0 <= math.inf:
          		tmp = 1.0 * y
          	else:
          		tmp = t_1
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(Float64(x + y) * Float64(1.0 - z))
          	t_1 = Float64(Float64(-z) * x)
          	tmp = 0.0
          	if (t_0 <= Float64(-Inf))
          		tmp = t_1;
          	elseif (t_0 <= -1e-213)
          		tmp = Float64(1.0 * x);
          	elseif (t_0 <= Inf)
          		tmp = Float64(1.0 * y);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = (x + y) * (1.0 - z);
          	t_1 = -z * x;
          	tmp = 0.0;
          	if (t_0 <= -Inf)
          		tmp = t_1;
          	elseif (t_0 <= -1e-213)
          		tmp = 1.0 * x;
          	elseif (t_0 <= Inf)
          		tmp = 1.0 * y;
          	else
          		tmp = t_1;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-z) * x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e-213], N[(1.0 * x), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(1.0 * y), $MachinePrecision], t$95$1]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(x + y\right) \cdot \left(1 - z\right)\\
          t_1 := \left(-z\right) \cdot x\\
          \mathbf{if}\;t\_0 \leq -\infty:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-213}:\\
          \;\;\;\;1 \cdot x\\
          
          \mathbf{elif}\;t\_0 \leq \infty:\\
          \;\;\;\;1 \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -inf.0 or +inf.0 < (*.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 x around inf

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

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

                \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
              3. lower--.f6444.0

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

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

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

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

              if -inf.0 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -9.9999999999999995e-214

              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. *-commutativeN/A

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

                  \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
                3. lower--.f6453.6

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

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

                \[\leadsto 1 \cdot x \]
              7. Step-by-step derivation
                1. Applied rewrites35.4%

                  \[\leadsto 1 \cdot x \]

                if -9.9999999999999995e-214 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < +inf.0

                1. Initial program 99.9%

                  \[\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. *-commutativeN/A

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

                    \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                  3. lower--.f6449.8

                    \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                5. Applied rewrites49.8%

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

                  \[\leadsto 1 \cdot y \]
                7. Step-by-step derivation
                  1. Applied rewrites29.4%

                    \[\leadsto 1 \cdot y \]
                8. Recombined 3 regimes into one program.
                9. Add Preprocessing

                Alternative 4: 39.0% accurate, 0.3× speedup?

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

                  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. *-commutativeN/A

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

                      \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
                    3. lower--.f6454.7

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

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

                  if 5.0000000000000003e-296 < (+.f64 x y) < 5e-32 or 4.99999999999999976e67 < (+.f64 x y)

                  1. Initial program 99.9%

                    \[\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. *-commutativeN/A

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

                      \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                    3. lower--.f6455.7

                      \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                  5. Applied rewrites55.7%

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

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

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

                    if 5e-32 < (+.f64 x y) < 4.99999999999999976e67

                    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. *-commutativeN/A

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

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

                        \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                    5. Applied rewrites39.1%

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

                      \[\leadsto 1 \cdot y \]
                    7. Step-by-step derivation
                      1. Applied rewrites32.0%

                        \[\leadsto 1 \cdot y \]
                    8. Recombined 3 regimes into one program.
                    9. Final simplification42.6%

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

                    Alternative 5: 26.8% accurate, 0.5× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -1 \cdot 10^{-213}:\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;1 \cdot y\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= (* (+ x y) (- 1.0 z)) -1e-213) (* 1.0 x) (* 1.0 y)))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (((x + y) * (1.0 - z)) <= -1e-213) {
                    		tmp = 1.0 * x;
                    	} else {
                    		tmp = 1.0 * y;
                    	}
                    	return tmp;
                    }
                    
                    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 (((x + y) * (1.0d0 - z)) <= (-1d-213)) then
                            tmp = 1.0d0 * x
                        else
                            tmp = 1.0d0 * 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)) <= -1e-213) {
                    		tmp = 1.0 * x;
                    	} else {
                    		tmp = 1.0 * y;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	tmp = 0
                    	if ((x + y) * (1.0 - z)) <= -1e-213:
                    		tmp = 1.0 * x
                    	else:
                    		tmp = 1.0 * y
                    	return tmp
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (Float64(Float64(x + y) * Float64(1.0 - z)) <= -1e-213)
                    		tmp = Float64(1.0 * x);
                    	else
                    		tmp = Float64(1.0 * y);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	tmp = 0.0;
                    	if (((x + y) * (1.0 - z)) <= -1e-213)
                    		tmp = 1.0 * x;
                    	else
                    		tmp = 1.0 * y;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], -1e-213], N[(1.0 * x), $MachinePrecision], N[(1.0 * y), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -1 \cdot 10^{-213}:\\
                    \;\;\;\;1 \cdot x\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1 \cdot y\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -9.9999999999999995e-214

                      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. *-commutativeN/A

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

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

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

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

                        \[\leadsto 1 \cdot x \]
                      7. Step-by-step derivation
                        1. Applied rewrites28.4%

                          \[\leadsto 1 \cdot x \]

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

                        1. Initial program 99.9%

                          \[\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. *-commutativeN/A

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

                            \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                          3. lower--.f6449.8

                            \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                        5. Applied rewrites49.8%

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

                          \[\leadsto 1 \cdot y \]
                        7. Step-by-step derivation
                          1. Applied rewrites29.4%

                            \[\leadsto 1 \cdot y \]
                        8. Recombined 2 regimes into one program.
                        9. Add Preprocessing

                        Alternative 6: 51.4% accurate, 0.7× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{-220}:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(1 - z\right) \cdot y\\ \end{array} \end{array} \]
                        (FPCore (x y z)
                         :precision binary64
                         (if (<= (+ x y) -2e-220) (* (- 1.0 z) x) (* (- 1.0 z) y)))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if ((x + y) <= -2e-220) {
                        		tmp = (1.0 - z) * x;
                        	} else {
                        		tmp = (1.0 - z) * y;
                        	}
                        	return tmp;
                        }
                        
                        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 ((x + y) <= (-2d-220)) then
                                tmp = (1.0d0 - z) * x
                            else
                                tmp = (1.0d0 - z) * y
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	double tmp;
                        	if ((x + y) <= -2e-220) {
                        		tmp = (1.0 - z) * x;
                        	} else {
                        		tmp = (1.0 - z) * y;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z):
                        	tmp = 0
                        	if (x + y) <= -2e-220:
                        		tmp = (1.0 - z) * x
                        	else:
                        		tmp = (1.0 - z) * y
                        	return tmp
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if (Float64(x + y) <= -2e-220)
                        		tmp = Float64(Float64(1.0 - z) * x);
                        	else
                        		tmp = Float64(Float64(1.0 - z) * y);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z)
                        	tmp = 0.0;
                        	if ((x + y) <= -2e-220)
                        		tmp = (1.0 - z) * x;
                        	else
                        		tmp = (1.0 - z) * y;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-220], N[(N[(1.0 - z), $MachinePrecision] * x), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x + y \leq -2 \cdot 10^{-220}:\\
                        \;\;\;\;\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 (+.f64 x y) < -1.99999999999999998e-220

                          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. *-commutativeN/A

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

                              \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
                            3. lower--.f6454.9

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

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

                          if -1.99999999999999998e-220 < (+.f64 x y)

                          1. Initial program 99.9%

                            \[\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. *-commutativeN/A

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

                              \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                            3. lower--.f6451.7

                              \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                          5. Applied rewrites51.7%

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

                        Alternative 7: 24.5% accurate, 1.0× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+40}:\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \end{array} \]
                        (FPCore (x y z) :precision binary64 (if (<= y 5.2e+40) (* 1.0 x) (* z y)))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if (y <= 5.2e+40) {
                        		tmp = 1.0 * x;
                        	} else {
                        		tmp = z * y;
                        	}
                        	return tmp;
                        }
                        
                        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 <= 5.2d+40) then
                                tmp = 1.0d0 * x
                            else
                                tmp = z * y
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	double tmp;
                        	if (y <= 5.2e+40) {
                        		tmp = 1.0 * x;
                        	} else {
                        		tmp = z * y;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z):
                        	tmp = 0
                        	if y <= 5.2e+40:
                        		tmp = 1.0 * x
                        	else:
                        		tmp = z * y
                        	return tmp
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if (y <= 5.2e+40)
                        		tmp = Float64(1.0 * x);
                        	else
                        		tmp = Float64(z * y);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z)
                        	tmp = 0.0;
                        	if (y <= 5.2e+40)
                        		tmp = 1.0 * x;
                        	else
                        		tmp = z * y;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_] := If[LessEqual[y, 5.2e+40], N[(1.0 * x), $MachinePrecision], N[(z * y), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;y \leq 5.2 \cdot 10^{+40}:\\
                        \;\;\;\;1 \cdot x\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;z \cdot y\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if y < 5.2000000000000001e40

                          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. *-commutativeN/A

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

                              \[\leadsto \color{blue}{\left(1 - z\right) \cdot x} \]
                            3. lower--.f6459.9

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

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

                            \[\leadsto 1 \cdot x \]
                          7. Step-by-step derivation
                            1. Applied rewrites31.2%

                              \[\leadsto 1 \cdot x \]

                            if 5.2000000000000001e40 < y

                            1. Initial program 99.9%

                              \[\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. *-commutativeN/A

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

                                \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                              3. lower--.f6474.5

                                \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
                            5. Applied rewrites74.5%

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

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

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

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

                              Alternative 8: 3.4% accurate, 2.0× speedup?

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

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

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

                                  \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
                                3. lower--.f6449.9

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

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

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

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

                                    \[\leadsto z \cdot y \]
                                  2. Add Preprocessing

                                  Reproduce

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