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

Percentage Accurate: 100.0% → 100.0%
Time: 10.0s
Alternatives: 9
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 9 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, 0.8× speedup?

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

\\
\mathsf{fma}\left(0 - z, x + y, x + y\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. sub-negN/A

      \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
    2. +-commutativeN/A

      \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + 1\right)} \]
    3. distribute-rgt-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + 1 \cdot \left(x + y\right)} \]
    4. *-lft-identityN/A

      \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)} \]
    5. accelerator-lowering-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), x + y, x + y\right)} \]
    6. neg-sub0N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
    8. +-lowering-+.f64N/A

      \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x + y}, x + y\right) \]
    9. +-lowering-+.f64100.0

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

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

Alternative 2: 51.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, y, y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (+ x y) -1e-269) (fma (- 0.0 z) x x) (fma (- 0.0 z) y y)))
double code(double x, double y, double z) {
	double tmp;
	if ((x + y) <= -1e-269) {
		tmp = fma((0.0 - z), x, x);
	} else {
		tmp = fma((0.0 - z), y, y);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (Float64(x + y) <= -1e-269)
		tmp = fma(Float64(0.0 - z), x, x);
	else
		tmp = fma(Float64(0.0 - z), y, y);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-269], N[(N[(0.0 - z), $MachinePrecision] * x + x), $MachinePrecision], N[(N[(0.0 - z), $MachinePrecision] * y + y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\
\;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0 - z, y, y\right)\\


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

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(1 - z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + 1\right)} \]
      3. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + 1 \cdot \left(x + y\right)} \]
      4. *-lft-identityN/A

        \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)} \]
      5. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), x + y, x + y\right)} \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x + y}, x + y\right) \]
      9. +-lowering-+.f64100.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0 - z, x + y, x + y\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{x}\right) \]
    6. Step-by-step derivation
      1. Simplified70.9%

        \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{x}\right) \]
      2. Taylor expanded in x around inf

        \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x}, x\right) \]
      3. Step-by-step derivation
        1. Simplified53.3%

          \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x}, x\right) \]
        2. Step-by-step derivation
          1. sub0-negN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(z\right)}, x, x\right) \]
          2. neg-lowering-neg.f6453.3

            \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, x, x\right) \]
        3. Applied egg-rr53.3%

          \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, x, x\right) \]

        if -9.9999999999999996e-270 < (+.f64 x y)

        1. Initial program 100.0%

          \[\left(x + y\right) \cdot \left(1 - z\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
          2. +-commutativeN/A

            \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + 1\right)} \]
          3. distribute-rgt-inN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + 1 \cdot \left(x + y\right)} \]
          4. *-lft-identityN/A

            \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)} \]
          5. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), x + y, x + y\right)} \]
          6. neg-sub0N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
          8. +-lowering-+.f64N/A

            \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x + y}, x + y\right) \]
          9. +-lowering-+.f64100.0

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(0 - z, x + y, x + y\right)} \]
        5. Taylor expanded in x around 0

          \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{y}\right) \]
        6. Step-by-step derivation
          1. Simplified68.1%

            \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{y}\right) \]
          2. Taylor expanded in x around 0

            \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{y}, y\right) \]
          3. Step-by-step derivation
            1. Simplified42.2%

              \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{y}, y\right) \]
            2. Step-by-step derivation
              1. sub0-negN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(z\right)}, y, y\right) \]
              2. neg-lowering-neg.f6442.2

                \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, y, y\right) \]
            3. Applied egg-rr42.2%

              \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, y, y\right) \]
          4. Recombined 2 regimes into one program.
          5. Final simplification48.0%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, y, y\right)\\ \end{array} \]
          6. Add Preprocessing

          Alternative 3: 51.2% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= (+ x y) -1e-269) (fma (- 0.0 z) x x) (* y (- 1.0 z))))
          double code(double x, double y, double z) {
          	double tmp;
          	if ((x + y) <= -1e-269) {
          		tmp = fma((0.0 - z), x, x);
          	} else {
          		tmp = y * (1.0 - z);
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (Float64(x + y) <= -1e-269)
          		tmp = fma(Float64(0.0 - z), x, x);
          	else
          		tmp = Float64(y * Float64(1.0 - z));
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-269], N[(N[(0.0 - z), $MachinePrecision] * x + x), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\
          \;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot \left(1 - z\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 x y) < -9.9999999999999996e-270

            1. Initial program 100.0%

              \[\left(x + y\right) \cdot \left(1 - z\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. sub-negN/A

                \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
              2. +-commutativeN/A

                \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + 1\right)} \]
              3. distribute-rgt-inN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + 1 \cdot \left(x + y\right)} \]
              4. *-lft-identityN/A

                \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)} \]
              5. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), x + y, x + y\right)} \]
              6. neg-sub0N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
              7. --lowering--.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{0 - z}, x + y, x + y\right) \]
              8. +-lowering-+.f64N/A

                \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x + y}, x + y\right) \]
              9. +-lowering-+.f64100.0

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(0 - z, x + y, x + y\right)} \]
            5. Taylor expanded in x around inf

              \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{x}\right) \]
            6. Step-by-step derivation
              1. Simplified70.9%

                \[\leadsto \mathsf{fma}\left(0 - z, x + y, \color{blue}{x}\right) \]
              2. Taylor expanded in x around inf

                \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x}, x\right) \]
              3. Step-by-step derivation
                1. Simplified53.3%

                  \[\leadsto \mathsf{fma}\left(0 - z, \color{blue}{x}, x\right) \]
                2. Step-by-step derivation
                  1. sub0-negN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(z\right)}, x, x\right) \]
                  2. neg-lowering-neg.f6453.3

                    \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, x, x\right) \]
                3. Applied egg-rr53.3%

                  \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, x, x\right) \]

                if -9.9999999999999996e-270 < (+.f64 x y)

                1. Initial program 100.0%

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-269}:\\ \;\;\;\;\mathsf{fma}\left(0 - z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \]
                7. Add Preprocessing

                Alternative 4: 51.2% accurate, 0.7× speedup?

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

                  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. Simplified53.3%

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

                    if -9.9999999999999996e-270 < (+.f64 x y)

                    1. Initial program 100.0%

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

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

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

                    Alternative 5: 51.1% accurate, 0.7× speedup?

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

                      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. Simplified53.0%

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

                        if 5.0000000000000001e-290 < (+.f64 x y)

                        1. Initial program 100.0%

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

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

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

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

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

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

                      Alternative 6: 26.1% accurate, 0.7× speedup?

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

                        1. Initial program 100.0%

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

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

                            \[\leadsto \color{blue}{y + x} \]
                          2. +-lowering-+.f6457.5

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

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

                          \[\leadsto \color{blue}{x} \]
                        7. Step-by-step derivation
                          1. Simplified27.9%

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

                          if -9.9999999999999996e-270 < (*.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 z around 0

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

                              \[\leadsto \color{blue}{y + x} \]
                            2. +-lowering-+.f6449.3

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

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

                            \[\leadsto \color{blue}{y} \]
                          7. Step-by-step derivation
                            1. Simplified19.3%

                              \[\leadsto \color{blue}{y} \]
                          8. Recombined 2 regimes into one program.
                          9. Add Preprocessing

                          Alternative 7: 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 8: 51.2% accurate, 3.0× speedup?

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

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

                              \[\leadsto \color{blue}{y + x} \]
                            2. +-lowering-+.f6453.5

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

                            \[\leadsto \color{blue}{y + x} \]
                          6. Final simplification53.5%

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

                          Alternative 9: 26.7% accurate, 12.0× speedup?

                          \[\begin{array}{l} \\ x \end{array} \]
                          (FPCore (x y z) :precision binary64 x)
                          double code(double x, double y, double z) {
                          	return x;
                          }
                          
                          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
                          
                          public static double code(double x, double y, double z) {
                          	return x;
                          }
                          
                          def code(x, y, z):
                          	return x
                          
                          function code(x, y, z)
                          	return x
                          end
                          
                          function tmp = code(x, y, z)
                          	tmp = x;
                          end
                          
                          code[x_, y_, z_] := x
                          
                          \begin{array}{l}
                          
                          \\
                          x
                          \end{array}
                          
                          Derivation
                          1. Initial program 100.0%

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

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

                              \[\leadsto \color{blue}{y + x} \]
                            2. +-lowering-+.f6453.5

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

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

                            \[\leadsto \color{blue}{x} \]
                          7. Step-by-step derivation
                            1. Simplified30.2%

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

                            Reproduce

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