Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3

Percentage Accurate: 99.9% → 99.9%
Time: 9.5s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \frac{\left|y - x\right|}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
	return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
	return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y):
	return x + (math.fabs((y - x)) / 2.0)
function code(x, y)
	return Float64(x + Float64(abs(Float64(y - x)) / 2.0))
end
function tmp = code(x, y)
	tmp = x + (abs((y - x)) / 2.0);
end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\left|y - x\right|}{2}
\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 12 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{\left|y - x\right|}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
	return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
	return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y):
	return x + (math.fabs((y - x)) / 2.0)
function code(x, y)
	return Float64(x + Float64(abs(Float64(y - x)) / 2.0))
end
function tmp = code(x, y)
	tmp = x + (abs((y - x)) / 2.0);
end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\left|y - x\right|}{2}
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{\left|y - x\right|}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
	return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
	return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y):
	return x + (math.fabs((y - x)) / 2.0)
function code(x, y)
	return Float64(x + Float64(abs(Float64(y - x)) / 2.0))
end
function tmp = code(x, y)
	tmp = x + (abs((y - x)) / 2.0);
end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{\left|y - x\right|}{2} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 82.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+47}:\\ \;\;\;\;x + \frac{\left|y\right|}{2}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5.5e-27)
   (* 0.5 (+ x y))
   (if (<= x 2.6e+47) (+ x (/ (fabs y) 2.0)) (+ x (/ (- x y) 2.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -5.5e-27) {
		tmp = 0.5 * (x + y);
	} else if (x <= 2.6e+47) {
		tmp = x + (fabs(y) / 2.0);
	} else {
		tmp = x + ((x - y) / 2.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-5.5d-27)) then
        tmp = 0.5d0 * (x + y)
    else if (x <= 2.6d+47) then
        tmp = x + (abs(y) / 2.0d0)
    else
        tmp = x + ((x - y) / 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -5.5e-27) {
		tmp = 0.5 * (x + y);
	} else if (x <= 2.6e+47) {
		tmp = x + (Math.abs(y) / 2.0);
	} else {
		tmp = x + ((x - y) / 2.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5.5e-27:
		tmp = 0.5 * (x + y)
	elif x <= 2.6e+47:
		tmp = x + (math.fabs(y) / 2.0)
	else:
		tmp = x + ((x - y) / 2.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5.5e-27)
		tmp = Float64(0.5 * Float64(x + y));
	elseif (x <= 2.6e+47)
		tmp = Float64(x + Float64(abs(y) / 2.0));
	else
		tmp = Float64(x + Float64(Float64(x - y) / 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5.5e-27)
		tmp = 0.5 * (x + y);
	elseif (x <= 2.6e+47)
		tmp = x + (abs(y) / 2.0);
	else
		tmp = x + ((x - y) / 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5.5e-27], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+47], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-27}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\

\mathbf{elif}\;x \leq 2.6 \cdot 10^{+47}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{x - y}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.5000000000000002e-27

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.8%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt90.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr90.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt91.2%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr91.2%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 91.4%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out91.4%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
      2. +-commutative91.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified91.4%

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

    if -5.5000000000000002e-27 < x < 2.60000000000000003e47

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 80.1%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]

    if 2.60000000000000003e47 < x

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.8%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt5.6%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr5.6%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt20.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr20.7%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt5.6%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr5.6%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.8%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.8%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.8%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.8%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.9%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt94.0%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr94.0%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt94.2%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr94.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+47}:\\ \;\;\;\;x + \frac{\left|y\right|}{2}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 10^{-215}:\\ \;\;\;\;0.5 \cdot \left|y\right|\\ \mathbf{else}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -2.7e-27)
   (* 0.5 (+ x y))
   (if (<= x 1e-215) (* 0.5 (fabs y)) (+ x (/ (- x y) 2.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -2.7e-27) {
		tmp = 0.5 * (x + y);
	} else if (x <= 1e-215) {
		tmp = 0.5 * fabs(y);
	} else {
		tmp = x + ((x - y) / 2.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.7d-27)) then
        tmp = 0.5d0 * (x + y)
    else if (x <= 1d-215) then
        tmp = 0.5d0 * abs(y)
    else
        tmp = x + ((x - y) / 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.7e-27) {
		tmp = 0.5 * (x + y);
	} else if (x <= 1e-215) {
		tmp = 0.5 * Math.abs(y);
	} else {
		tmp = x + ((x - y) / 2.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -2.7e-27:
		tmp = 0.5 * (x + y)
	elif x <= 1e-215:
		tmp = 0.5 * math.fabs(y)
	else:
		tmp = x + ((x - y) / 2.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -2.7e-27)
		tmp = Float64(0.5 * Float64(x + y));
	elseif (x <= 1e-215)
		tmp = Float64(0.5 * abs(y));
	else
		tmp = Float64(x + Float64(Float64(x - y) / 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.7e-27)
		tmp = 0.5 * (x + y);
	elseif (x <= 1e-215)
		tmp = 0.5 * abs(y);
	else
		tmp = x + ((x - y) / 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -2.7e-27], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-215], N[(0.5 * N[Abs[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-27}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\

\mathbf{elif}\;x \leq 10^{-215}:\\
\;\;\;\;0.5 \cdot \left|y\right|\\

\mathbf{else}:\\
\;\;\;\;x + \frac{x - y}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.69999999999999989e-27

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.8%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt90.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr90.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt91.2%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr91.2%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 91.4%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out91.4%

        \[\leadsto \color{blue}{0.5 \cdot \left(x + y\right)} \]
      2. +-commutative91.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified91.4%

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

    if -2.69999999999999989e-27 < x < 1.00000000000000004e-215

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 86.3%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 84.3%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]

    if 1.00000000000000004e-215 < x

    1. Initial program 99.8%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt18.1%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt29.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr29.1%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.8%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt81.4%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr81.4%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt81.8%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr81.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 10^{-215}:\\ \;\;\;\;0.5 \cdot \left|y\right|\\ \mathbf{else}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 56.4% accurate, 5.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -230:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-247}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-179}:\\ \;\;\;\;\frac{y}{-2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -230.0)
   (* x 0.5)
   (if (<= x -8e-247) (* y 0.5) (if (<= x 5.8e-179) (/ y -2.0) (* x 1.5)))))
double code(double x, double y) {
	double tmp;
	if (x <= -230.0) {
		tmp = x * 0.5;
	} else if (x <= -8e-247) {
		tmp = y * 0.5;
	} else if (x <= 5.8e-179) {
		tmp = y / -2.0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-230.0d0)) then
        tmp = x * 0.5d0
    else if (x <= (-8d-247)) then
        tmp = y * 0.5d0
    else if (x <= 5.8d-179) then
        tmp = y / (-2.0d0)
    else
        tmp = x * 1.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -230.0) {
		tmp = x * 0.5;
	} else if (x <= -8e-247) {
		tmp = y * 0.5;
	} else if (x <= 5.8e-179) {
		tmp = y / -2.0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -230.0:
		tmp = x * 0.5
	elif x <= -8e-247:
		tmp = y * 0.5
	elif x <= 5.8e-179:
		tmp = y / -2.0
	else:
		tmp = x * 1.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -230.0)
		tmp = Float64(x * 0.5);
	elseif (x <= -8e-247)
		tmp = Float64(y * 0.5);
	elseif (x <= 5.8e-179)
		tmp = Float64(y / -2.0);
	else
		tmp = Float64(x * 1.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -230.0)
		tmp = x * 0.5;
	elseif (x <= -8e-247)
		tmp = y * 0.5;
	elseif (x <= 5.8e-179)
		tmp = y / -2.0;
	else
		tmp = x * 1.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -230.0], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -8e-247], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 5.8e-179], N[(y / -2.0), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -230:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq -8 \cdot 10^{-247}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{elif}\;x \leq 5.8 \cdot 10^{-179}:\\
\;\;\;\;\frac{y}{-2}\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -230

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.8%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt90.0%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr90.0%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt90.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr90.5%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around inf 75.8%

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

    if -230 < x < -8.0000000000000002e-247

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 81.5%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 78.5%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]
    5. Step-by-step derivation
      1. rem-square-sqrt46.7%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right| \]
      2. fabs-sqr46.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      3. rem-square-sqrt47.9%

        \[\leadsto 0.5 \cdot \color{blue}{y} \]
    6. Simplified47.9%

      \[\leadsto \color{blue}{0.5 \cdot y} \]

    if -8.0000000000000002e-247 < x < 5.7999999999999998e-179

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 88.1%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 86.5%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]
    5. Step-by-step derivation
      1. rem-square-sqrt29.7%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right| \]
      2. fabs-sqr29.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      3. rem-square-sqrt31.5%

        \[\leadsto 0.5 \cdot \color{blue}{y} \]
    6. Simplified31.5%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative31.5%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
      2. metadata-eval31.5%

        \[\leadsto y \cdot \color{blue}{\frac{1}{2}} \]
      3. div-inv31.5%

        \[\leadsto \color{blue}{\frac{y}{2}} \]
      4. frac-2neg31.5%

        \[\leadsto \color{blue}{\frac{-y}{-2}} \]
      5. add-sqr-sqrt1.5%

        \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{-2} \]
      6. sqrt-unprod2.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{-2} \]
      7. sqr-neg2.9%

        \[\leadsto \frac{\sqrt{\color{blue}{y \cdot y}}}{-2} \]
      8. sqrt-unprod1.2%

        \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{-2} \]
      9. add-sqr-sqrt57.7%

        \[\leadsto \frac{\color{blue}{y}}{-2} \]
      10. metadata-eval57.7%

        \[\leadsto \frac{y}{\color{blue}{-2}} \]
    8. Applied egg-rr57.7%

      \[\leadsto \color{blue}{\frac{y}{-2}} \]

    if 5.7999999999999998e-179 < x

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt18.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt30.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr30.1%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.9%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt80.7%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr80.7%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt81.1%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr81.1%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around inf 63.7%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    10. Step-by-step derivation
      1. *-commutative63.7%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    11. Simplified63.7%

      \[\leadsto \color{blue}{x \cdot 1.5} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification62.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -230:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-247}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-179}:\\ \;\;\;\;\frac{y}{-2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.2% accurate, 6.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-232}:\\ \;\;\;\;x - \frac{y}{2}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-231}:\\ \;\;\;\;x + \frac{1}{\frac{2}{x}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -5.2e-232)
   (- x (/ y 2.0))
   (if (<= y 1.5e-231) (+ x (/ 1.0 (/ 2.0 x))) (* 0.5 (+ x y)))))
double code(double x, double y) {
	double tmp;
	if (y <= -5.2e-232) {
		tmp = x - (y / 2.0);
	} else if (y <= 1.5e-231) {
		tmp = x + (1.0 / (2.0 / x));
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-5.2d-232)) then
        tmp = x - (y / 2.0d0)
    else if (y <= 1.5d-231) then
        tmp = x + (1.0d0 / (2.0d0 / x))
    else
        tmp = 0.5d0 * (x + y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -5.2e-232) {
		tmp = x - (y / 2.0);
	} else if (y <= 1.5e-231) {
		tmp = x + (1.0 / (2.0 / x));
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -5.2e-232:
		tmp = x - (y / 2.0)
	elif y <= 1.5e-231:
		tmp = x + (1.0 / (2.0 / x))
	else:
		tmp = 0.5 * (x + y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -5.2e-232)
		tmp = Float64(x - Float64(y / 2.0));
	elseif (y <= 1.5e-231)
		tmp = Float64(x + Float64(1.0 / Float64(2.0 / x)));
	else
		tmp = Float64(0.5 * Float64(x + y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -5.2e-232)
		tmp = x - (y / 2.0);
	elseif (y <= 1.5e-231)
		tmp = x + (1.0 / (2.0 / x));
	else
		tmp = 0.5 * (x + y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -5.2e-232], N[(x - N[(y / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e-231], N[(x + N[(1.0 / N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-232}:\\
\;\;\;\;x - \frac{y}{2}\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{-231}:\\
\;\;\;\;x + \frac{1}{\frac{2}{x}}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.19999999999999992e-232

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt21.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt26.3%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr26.3%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div100.0%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt77.7%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr77.7%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt82.0%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr82.0%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around 0 63.8%

      \[\leadsto x + \frac{\color{blue}{-1 \cdot y}}{2} \]
    10. Step-by-step derivation
      1. neg-mul-163.8%

        \[\leadsto x + \frac{\color{blue}{-y}}{2} \]
    11. Simplified63.8%

      \[\leadsto x + \frac{\color{blue}{-y}}{2} \]

    if -5.19999999999999992e-232 < y < 1.5000000000000001e-231

    1. Initial program 99.7%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 68.5%

      \[\leadsto x + \frac{\left|\color{blue}{y \cdot \left(1 + -1 \cdot \frac{x}{y}\right)}\right|}{2} \]
    4. Step-by-step derivation
      1. mul-1-neg68.5%

        \[\leadsto x + \frac{\left|y \cdot \left(1 + \color{blue}{\left(-\frac{x}{y}\right)}\right)\right|}{2} \]
      2. unsub-neg68.5%

        \[\leadsto x + \frac{\left|y \cdot \color{blue}{\left(1 - \frac{x}{y}\right)}\right|}{2} \]
    5. Simplified68.5%

      \[\leadsto x + \frac{\left|\color{blue}{y \cdot \left(1 - \frac{x}{y}\right)}\right|}{2} \]
    6. Taylor expanded in x around inf 60.6%

      \[\leadsto x + \frac{\left|y \cdot \color{blue}{\left(-1 \cdot \frac{x}{y}\right)}\right|}{2} \]
    7. Step-by-step derivation
      1. neg-mul-160.6%

        \[\leadsto x + \frac{\left|y \cdot \color{blue}{\left(-\frac{x}{y}\right)}\right|}{2} \]
      2. distribute-neg-frac260.6%

        \[\leadsto x + \frac{\left|y \cdot \color{blue}{\frac{x}{-y}}\right|}{2} \]
    8. Simplified60.6%

      \[\leadsto x + \frac{\left|y \cdot \color{blue}{\frac{x}{-y}}\right|}{2} \]
    9. Step-by-step derivation
      1. clear-num60.5%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y \cdot \frac{x}{-y}\right|}}} \]
      2. inv-pow60.5%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y \cdot \frac{x}{-y}\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt22.1%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y \cdot \frac{x}{-y}} \cdot \sqrt{y \cdot \frac{x}{-y}}}\right|}\right)}^{-1} \]
      4. fabs-sqr22.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y \cdot \frac{x}{-y}} \cdot \sqrt{y \cdot \frac{x}{-y}}}}\right)}^{-1} \]
      5. add-sqr-sqrt29.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y \cdot \frac{x}{-y}}}\right)}^{-1} \]
      6. clear-num29.5%

        \[\leadsto x + {\left(\frac{2}{y \cdot \color{blue}{\frac{1}{\frac{-y}{x}}}}\right)}^{-1} \]
      7. un-div-inv29.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\frac{y}{\frac{-y}{x}}}}\right)}^{-1} \]
      8. add-sqr-sqrt18.5%

        \[\leadsto x + {\left(\frac{2}{\frac{y}{\frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{x}}}\right)}^{-1} \]
      9. sqrt-unprod2.1%

        \[\leadsto x + {\left(\frac{2}{\frac{y}{\frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{x}}}\right)}^{-1} \]
      10. sqr-neg2.1%

        \[\leadsto x + {\left(\frac{2}{\frac{y}{\frac{\sqrt{\color{blue}{y \cdot y}}}{x}}}\right)}^{-1} \]
      11. sqrt-unprod20.4%

        \[\leadsto x + {\left(\frac{2}{\frac{y}{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{x}}}\right)}^{-1} \]
      12. add-sqr-sqrt43.3%

        \[\leadsto x + {\left(\frac{2}{\frac{y}{\frac{\color{blue}{y}}{x}}}\right)}^{-1} \]
    10. Applied egg-rr43.3%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{\frac{y}{\frac{y}{x}}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-143.3%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\frac{y}{\frac{y}{x}}}}} \]
      2. associate-/r/64.0%

        \[\leadsto x + \frac{1}{\frac{2}{\color{blue}{\frac{y}{y} \cdot x}}} \]
      3. *-inverses64.0%

        \[\leadsto x + \frac{1}{\frac{2}{\color{blue}{1} \cdot x}} \]
      4. *-lft-identity64.0%

        \[\leadsto x + \frac{1}{\frac{2}{\color{blue}{x}}} \]
    12. Simplified64.0%

      \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{x}}} \]

    if 1.5000000000000001e-231 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt79.9%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr79.9%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt83.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr83.7%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out84.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified84.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(y + x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-232}:\\ \;\;\;\;x - \frac{y}{2}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-231}:\\ \;\;\;\;x + \frac{1}{\frac{2}{x}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 71.2% accurate, 7.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{-230}:\\ \;\;\;\;x - \frac{y}{2}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-230}:\\ \;\;\;\;x \cdot 1.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.15e-230)
   (- x (/ y 2.0))
   (if (<= y 1.85e-230) (* x 1.5) (* 0.5 (+ x y)))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.15e-230) {
		tmp = x - (y / 2.0);
	} else if (y <= 1.85e-230) {
		tmp = x * 1.5;
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.15d-230)) then
        tmp = x - (y / 2.0d0)
    else if (y <= 1.85d-230) then
        tmp = x * 1.5d0
    else
        tmp = 0.5d0 * (x + y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.15e-230) {
		tmp = x - (y / 2.0);
	} else if (y <= 1.85e-230) {
		tmp = x * 1.5;
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.15e-230:
		tmp = x - (y / 2.0)
	elif y <= 1.85e-230:
		tmp = x * 1.5
	else:
		tmp = 0.5 * (x + y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.15e-230)
		tmp = Float64(x - Float64(y / 2.0));
	elseif (y <= 1.85e-230)
		tmp = Float64(x * 1.5);
	else
		tmp = Float64(0.5 * Float64(x + y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.15e-230)
		tmp = x - (y / 2.0);
	elseif (y <= 1.85e-230)
		tmp = x * 1.5;
	else
		tmp = 0.5 * (x + y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.15e-230], N[(x - N[(y / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e-230], N[(x * 1.5), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-230}:\\
\;\;\;\;x - \frac{y}{2}\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-230}:\\
\;\;\;\;x \cdot 1.5\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.1499999999999999e-230

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt21.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt26.3%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr26.3%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr21.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div100.0%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt77.7%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr77.7%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt82.0%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr82.0%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around 0 63.8%

      \[\leadsto x + \frac{\color{blue}{-1 \cdot y}}{2} \]
    10. Step-by-step derivation
      1. neg-mul-163.8%

        \[\leadsto x + \frac{\color{blue}{-y}}{2} \]
    11. Simplified63.8%

      \[\leadsto x + \frac{\color{blue}{-y}}{2} \]

    if -1.1499999999999999e-230 < y < 1.84999999999999991e-230

    1. Initial program 99.7%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.5%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt37.8%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr37.8%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt48.6%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr48.6%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt37.8%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr37.8%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.5%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.5%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.5%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.5%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.7%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt61.5%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr61.5%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt67.9%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr67.9%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around inf 64.0%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    10. Step-by-step derivation
      1. *-commutative64.0%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    11. Simplified64.0%

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

    if 1.84999999999999991e-230 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt79.9%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr79.9%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt83.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr83.7%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out84.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified84.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(y + x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{-230}:\\ \;\;\;\;x - \frac{y}{2}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-230}:\\ \;\;\;\;x \cdot 1.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 65.6% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.28 \cdot 10^{-270}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 9.8 \cdot 10^{-175}:\\ \;\;\;\;\frac{y}{-2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1.28e-270)
   (* 0.5 (+ x y))
   (if (<= x 9.8e-175) (/ y -2.0) (* x 1.5))))
double code(double x, double y) {
	double tmp;
	if (x <= -1.28e-270) {
		tmp = 0.5 * (x + y);
	} else if (x <= 9.8e-175) {
		tmp = y / -2.0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.28d-270)) then
        tmp = 0.5d0 * (x + y)
    else if (x <= 9.8d-175) then
        tmp = y / (-2.0d0)
    else
        tmp = x * 1.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.28e-270) {
		tmp = 0.5 * (x + y);
	} else if (x <= 9.8e-175) {
		tmp = y / -2.0;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1.28e-270:
		tmp = 0.5 * (x + y)
	elif x <= 9.8e-175:
		tmp = y / -2.0
	else:
		tmp = x * 1.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1.28e-270)
		tmp = Float64(0.5 * Float64(x + y));
	elseif (x <= 9.8e-175)
		tmp = Float64(y / -2.0);
	else
		tmp = Float64(x * 1.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.28e-270)
		tmp = 0.5 * (x + y);
	elseif (x <= 9.8e-175)
		tmp = y / -2.0;
	else
		tmp = x * 1.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1.28e-270], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.8e-175], N[(y / -2.0), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.28 \cdot 10^{-270}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\

\mathbf{elif}\;x \leq 9.8 \cdot 10^{-175}:\\
\;\;\;\;\frac{y}{-2}\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.27999999999999991e-270

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt79.2%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr79.2%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt79.8%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr79.8%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 80.1%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out80.1%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified80.1%

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

    if -1.27999999999999991e-270 < x < 9.79999999999999996e-175

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 89.8%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 88.3%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]
    5. Step-by-step derivation
      1. rem-square-sqrt28.2%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right| \]
      2. fabs-sqr28.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      3. rem-square-sqrt29.8%

        \[\leadsto 0.5 \cdot \color{blue}{y} \]
    6. Simplified29.8%

      \[\leadsto \color{blue}{0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative29.8%

        \[\leadsto \color{blue}{y \cdot 0.5} \]
      2. metadata-eval29.8%

        \[\leadsto y \cdot \color{blue}{\frac{1}{2}} \]
      3. div-inv29.8%

        \[\leadsto \color{blue}{\frac{y}{2}} \]
      4. frac-2neg29.8%

        \[\leadsto \color{blue}{\frac{-y}{-2}} \]
      5. add-sqr-sqrt1.5%

        \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{-2} \]
      6. sqrt-unprod2.7%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{-2} \]
      7. sqr-neg2.7%

        \[\leadsto \frac{\sqrt{\color{blue}{y \cdot y}}}{-2} \]
      8. sqrt-unprod0.9%

        \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{-2} \]
      9. add-sqr-sqrt60.9%

        \[\leadsto \frac{\color{blue}{y}}{-2} \]
      10. metadata-eval60.9%

        \[\leadsto \frac{y}{\color{blue}{-2}} \]
    8. Applied egg-rr60.9%

      \[\leadsto \color{blue}{\frac{y}{-2}} \]

    if 9.79999999999999996e-175 < x

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt18.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt30.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr30.1%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr18.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.9%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt80.7%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr80.7%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt81.1%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr81.1%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around inf 63.7%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    10. Step-by-step derivation
      1. *-commutative63.7%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    11. Simplified63.7%

      \[\leadsto \color{blue}{x \cdot 1.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification70.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.28 \cdot 10^{-270}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \mathbf{elif}\;x \leq 9.8 \cdot 10^{-175}:\\ \;\;\;\;\frac{y}{-2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 55.4% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -61:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -61.0) (* x 0.5) (if (<= x 6e-217) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
	double tmp;
	if (x <= -61.0) {
		tmp = x * 0.5;
	} else if (x <= 6e-217) {
		tmp = y * 0.5;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-61.0d0)) then
        tmp = x * 0.5d0
    else if (x <= 6d-217) then
        tmp = y * 0.5d0
    else
        tmp = x * 1.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -61.0) {
		tmp = x * 0.5;
	} else if (x <= 6e-217) {
		tmp = y * 0.5;
	} else {
		tmp = x * 1.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -61.0:
		tmp = x * 0.5
	elif x <= 6e-217:
		tmp = y * 0.5
	else:
		tmp = x * 1.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -61.0)
		tmp = Float64(x * 0.5);
	elseif (x <= 6e-217)
		tmp = Float64(y * 0.5);
	else
		tmp = Float64(x * 1.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -61.0)
		tmp = x * 0.5;
	elseif (x <= 6e-217)
		tmp = y * 0.5;
	else
		tmp = x * 1.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -61.0], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 6e-217], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -61:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq 6 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -61

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.8%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt90.0%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr90.0%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt90.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr90.5%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around inf 75.8%

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

    if -61 < x < 6.00000000000000009e-217

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 86.1%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 84.0%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]
    5. Step-by-step derivation
      1. rem-square-sqrt40.5%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right| \]
      2. fabs-sqr40.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      3. rem-square-sqrt42.0%

        \[\leadsto 0.5 \cdot \color{blue}{y} \]
    6. Simplified42.0%

      \[\leadsto \color{blue}{0.5 \cdot y} \]

    if 6.00000000000000009e-217 < x

    1. Initial program 99.8%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt18.1%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt29.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr29.1%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr18.1%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.8%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt81.4%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr81.4%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt81.8%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr81.8%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]
    9. Taylor expanded in x around inf 61.3%

      \[\leadsto \color{blue}{1.5 \cdot x} \]
    10. Step-by-step derivation
      1. *-commutative61.3%

        \[\leadsto \color{blue}{x \cdot 1.5} \]
    11. Simplified61.3%

      \[\leadsto \color{blue}{x \cdot 1.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -61:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 79.8% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.4 \cdot 10^{-230}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 1.4e-230) (+ x (/ (- x y) 2.0)) (* 0.5 (+ x y))))
double code(double x, double y) {
	double tmp;
	if (y <= 1.4e-230) {
		tmp = x + ((x - y) / 2.0);
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.4d-230) then
        tmp = x + ((x - y) / 2.0d0)
    else
        tmp = 0.5d0 * (x + y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.4e-230) {
		tmp = x + ((x - y) / 2.0);
	} else {
		tmp = 0.5 * (x + y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 1.4e-230:
		tmp = x + ((x - y) / 2.0)
	else:
		tmp = 0.5 * (x + y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 1.4e-230)
		tmp = Float64(x + Float64(Float64(x - y) / 2.0));
	else
		tmp = Float64(0.5 * Float64(x + y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.4e-230)
		tmp = x + ((x - y) / 2.0);
	else
		tmp = 0.5 * (x + y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 1.4e-230], N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-230}:\\
\;\;\;\;x + \frac{x - y}{2}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\


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

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt25.4%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr25.4%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt31.4%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr31.4%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt25.4%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      2. fabs-sqr25.4%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|\sqrt{y - x} \cdot \sqrt{y - x}\right|}}\right)}^{-1} \]
      3. add-sqr-sqrt99.7%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{y - x}\right|}\right)}^{-1} \]
      4. fabs-sub99.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    6. Applied egg-rr99.7%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\left|x - y\right|}}\right)}^{-1} \]
    7. Step-by-step derivation
      1. unpow-199.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|x - y\right|}}} \]
      2. clear-num99.7%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{\frac{\left|x - y\right|}{2}}}} \]
      3. remove-double-div99.9%

        \[\leadsto x + \color{blue}{\frac{\left|x - y\right|}{2}} \]
      4. add-sqr-sqrt74.0%

        \[\leadsto x + \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{2} \]
      5. fabs-sqr74.0%

        \[\leadsto x + \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{2} \]
      6. add-sqr-sqrt78.7%

        \[\leadsto x + \frac{\color{blue}{x - y}}{2} \]
    8. Applied egg-rr78.7%

      \[\leadsto x + \color{blue}{\frac{x - y}{2}} \]

    if 1.4e-230 < y

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt79.9%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr79.9%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt83.7%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr83.7%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around 0 84.0%

      \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. distribute-lft-out84.0%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(y + x\right)} \]
    7. Simplified84.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(y + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.4 \cdot 10^{-230}:\\ \;\;\;\;x + \frac{x - y}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x + y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 45.5% accurate, 13.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.4 \cdot 10^{-90}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= y 7.4e-90) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
	double tmp;
	if (y <= 7.4e-90) {
		tmp = x * 0.5;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 7.4d-90) then
        tmp = x * 0.5d0
    else
        tmp = y * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7.4e-90) {
		tmp = x * 0.5;
	} else {
		tmp = y * 0.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7.4e-90:
		tmp = x * 0.5
	else:
		tmp = y * 0.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7.4e-90)
		tmp = Float64(x * 0.5);
	else
		tmp = Float64(y * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7.4e-90)
		tmp = x * 0.5;
	else
		tmp = y * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7.4e-90], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.4 \cdot 10^{-90}:\\
\;\;\;\;x \cdot 0.5\\

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


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

    1. Initial program 99.9%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

        \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
      2. inv-pow99.7%

        \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
      3. add-sqr-sqrt32.5%

        \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
      4. fabs-sqr32.5%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
      5. add-sqr-sqrt38.3%

        \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
    4. Applied egg-rr38.3%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
    5. Taylor expanded in x around inf 34.7%

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

    if 7.40000000000000035e-90 < y

    1. Initial program 100.0%

      \[x + \frac{\left|y - x\right|}{2} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 72.2%

      \[\leadsto x + \frac{\left|\color{blue}{y}\right|}{2} \]
    4. Taylor expanded in x around 0 66.8%

      \[\leadsto \color{blue}{0.5 \cdot \left|y\right|} \]
    5. Step-by-step derivation
      1. rem-square-sqrt66.3%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right| \]
      2. fabs-sqr66.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      3. rem-square-sqrt66.8%

        \[\leadsto 0.5 \cdot \color{blue}{y} \]
    6. Simplified66.8%

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

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

Alternative 11: 29.7% accurate, 35.7× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 \end{array} \]
(FPCore (x y) :precision binary64 (* x 0.5))
double code(double x, double y) {
	return x * 0.5;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x * 0.5d0
end function
public static double code(double x, double y) {
	return x * 0.5;
}
def code(x, y):
	return x * 0.5
function code(x, y)
	return Float64(x * 0.5)
end
function tmp = code(x, y)
	tmp = x * 0.5;
end
code[x_, y_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}

\\
x \cdot 0.5
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{\left|y - x\right|}{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-num99.7%

      \[\leadsto x + \color{blue}{\frac{1}{\frac{2}{\left|y - x\right|}}} \]
    2. inv-pow99.7%

      \[\leadsto x + \color{blue}{{\left(\frac{2}{\left|y - x\right|}\right)}^{-1}} \]
    3. add-sqr-sqrt48.4%

      \[\leadsto x + {\left(\frac{2}{\left|\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}\right|}\right)}^{-1} \]
    4. fabs-sqr48.4%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{\sqrt{y - x} \cdot \sqrt{y - x}}}\right)}^{-1} \]
    5. add-sqr-sqrt53.5%

      \[\leadsto x + {\left(\frac{2}{\color{blue}{y - x}}\right)}^{-1} \]
  4. Applied egg-rr53.5%

    \[\leadsto x + \color{blue}{{\left(\frac{2}{y - x}\right)}^{-1}} \]
  5. Taylor expanded in x around inf 29.6%

    \[\leadsto \color{blue}{0.5 \cdot x} \]
  6. Final simplification29.6%

    \[\leadsto x \cdot 0.5 \]
  7. Add Preprocessing

Alternative 12: 11.2% accurate, 107.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
	return x;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x
end function
public static double code(double x, double y) {
	return x;
}
def code(x, y):
	return x
function code(x, y)
	return x
end
function tmp = code(x, y)
	tmp = x;
end
code[x_, y_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{\left|y - x\right|}{2} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 11.4%

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

Reproduce

?
herbie shell --seed 2024146 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  :precision binary64
  (+ x (/ (fabs (- y x)) 2.0)))