Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A

Percentage Accurate: 100.0% → 100.0%
Time: 6.1s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

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

\\
\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Final simplification100.0%

    \[\leadsto \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + 0.918938533204673 \]

Alternative 2: 73.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.14 \cdot 10^{+241}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{+222}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{+157}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -2.35 \cdot 10^{+106}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -7.2:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.65:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{+25} \lor \neg \left(y \leq 7 \cdot 10^{+176}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.14e+241)
   (* x y)
   (if (<= y -2.1e+222)
     (* y -0.5)
     (if (<= y -2.3e+157)
       (* x y)
       (if (<= y -2.35e+106)
         (* y -0.5)
         (if (<= y -7.2)
           (* x y)
           (if (<= y 1.65)
             (- 0.918938533204673 x)
             (if (or (<= y 2.05e+25) (not (<= y 7e+176)))
               (* x y)
               (* y -0.5)))))))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.14e+241) {
		tmp = x * y;
	} else if (y <= -2.1e+222) {
		tmp = y * -0.5;
	} else if (y <= -2.3e+157) {
		tmp = x * y;
	} else if (y <= -2.35e+106) {
		tmp = y * -0.5;
	} else if (y <= -7.2) {
		tmp = x * y;
	} else if (y <= 1.65) {
		tmp = 0.918938533204673 - x;
	} else if ((y <= 2.05e+25) || !(y <= 7e+176)) {
		tmp = x * y;
	} 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 <= (-1.14d+241)) then
        tmp = x * y
    else if (y <= (-2.1d+222)) then
        tmp = y * (-0.5d0)
    else if (y <= (-2.3d+157)) then
        tmp = x * y
    else if (y <= (-2.35d+106)) then
        tmp = y * (-0.5d0)
    else if (y <= (-7.2d0)) then
        tmp = x * y
    else if (y <= 1.65d0) then
        tmp = 0.918938533204673d0 - x
    else if ((y <= 2.05d+25) .or. (.not. (y <= 7d+176))) then
        tmp = x * y
    else
        tmp = y * (-0.5d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.14e+241) {
		tmp = x * y;
	} else if (y <= -2.1e+222) {
		tmp = y * -0.5;
	} else if (y <= -2.3e+157) {
		tmp = x * y;
	} else if (y <= -2.35e+106) {
		tmp = y * -0.5;
	} else if (y <= -7.2) {
		tmp = x * y;
	} else if (y <= 1.65) {
		tmp = 0.918938533204673 - x;
	} else if ((y <= 2.05e+25) || !(y <= 7e+176)) {
		tmp = x * y;
	} else {
		tmp = y * -0.5;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.14e+241:
		tmp = x * y
	elif y <= -2.1e+222:
		tmp = y * -0.5
	elif y <= -2.3e+157:
		tmp = x * y
	elif y <= -2.35e+106:
		tmp = y * -0.5
	elif y <= -7.2:
		tmp = x * y
	elif y <= 1.65:
		tmp = 0.918938533204673 - x
	elif (y <= 2.05e+25) or not (y <= 7e+176):
		tmp = x * y
	else:
		tmp = y * -0.5
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.14e+241)
		tmp = Float64(x * y);
	elseif (y <= -2.1e+222)
		tmp = Float64(y * -0.5);
	elseif (y <= -2.3e+157)
		tmp = Float64(x * y);
	elseif (y <= -2.35e+106)
		tmp = Float64(y * -0.5);
	elseif (y <= -7.2)
		tmp = Float64(x * y);
	elseif (y <= 1.65)
		tmp = Float64(0.918938533204673 - x);
	elseif ((y <= 2.05e+25) || !(y <= 7e+176))
		tmp = Float64(x * y);
	else
		tmp = Float64(y * -0.5);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.14e+241)
		tmp = x * y;
	elseif (y <= -2.1e+222)
		tmp = y * -0.5;
	elseif (y <= -2.3e+157)
		tmp = x * y;
	elseif (y <= -2.35e+106)
		tmp = y * -0.5;
	elseif (y <= -7.2)
		tmp = x * y;
	elseif (y <= 1.65)
		tmp = 0.918938533204673 - x;
	elseif ((y <= 2.05e+25) || ~((y <= 7e+176)))
		tmp = x * y;
	else
		tmp = y * -0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.14e+241], N[(x * y), $MachinePrecision], If[LessEqual[y, -2.1e+222], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.3e+157], N[(x * y), $MachinePrecision], If[LessEqual[y, -2.35e+106], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -7.2], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.65], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 2.05e+25], N[Not[LessEqual[y, 7e+176]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.14 \cdot 10^{+241}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq -2.1 \cdot 10^{+222}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -2.3 \cdot 10^{+157}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq -2.35 \cdot 10^{+106}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -7.2:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq 1.65:\\
\;\;\;\;0.918938533204673 - x\\

\mathbf{elif}\;y \leq 2.05 \cdot 10^{+25} \lor \neg \left(y \leq 7 \cdot 10^{+176}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.13999999999999995e241 or -2.1000000000000001e222 < y < -2.30000000000000004e157 or -2.35000000000000012e106 < y < -7.20000000000000018 or 1.6499999999999999 < y < 2.04999999999999983e25 or 7.00000000000000005e176 < y

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 93.4%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around inf 64.5%

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

    if -1.13999999999999995e241 < y < -2.1000000000000001e222 or -2.30000000000000004e157 < y < -2.35000000000000012e106 or 2.04999999999999983e25 < y < 7.00000000000000005e176

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around 0 70.9%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative70.9%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    7. Simplified70.9%

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

    if -7.20000000000000018 < y < 1.6499999999999999

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 97.7%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.14 \cdot 10^{+241}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{+222}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{+157}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -2.35 \cdot 10^{+106}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -7.2:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.65:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{+25} \lor \neg \left(y \leq 7 \cdot 10^{+176}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y \cdot -0.5\\ \end{array} \]

Alternative 3: 74.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(y + -1\right)\\ \mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-184}:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;x \leq -8.2 \cdot 10^{-288}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-156}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (+ y -1.0))))
   (if (<= x -1.95e-7)
     t_0
     (if (<= x -2.25e-184)
       (- 0.918938533204673 x)
       (if (<= x -8.2e-288)
         (* y -0.5)
         (if (<= x 1.75e-156)
           0.918938533204673
           (if (<= x 0.5) (* y -0.5) t_0)))))))
double code(double x, double y) {
	double t_0 = x * (y + -1.0);
	double tmp;
	if (x <= -1.95e-7) {
		tmp = t_0;
	} else if (x <= -2.25e-184) {
		tmp = 0.918938533204673 - x;
	} else if (x <= -8.2e-288) {
		tmp = y * -0.5;
	} else if (x <= 1.75e-156) {
		tmp = 0.918938533204673;
	} else if (x <= 0.5) {
		tmp = y * -0.5;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (y + (-1.0d0))
    if (x <= (-1.95d-7)) then
        tmp = t_0
    else if (x <= (-2.25d-184)) then
        tmp = 0.918938533204673d0 - x
    else if (x <= (-8.2d-288)) then
        tmp = y * (-0.5d0)
    else if (x <= 1.75d-156) then
        tmp = 0.918938533204673d0
    else if (x <= 0.5d0) then
        tmp = y * (-0.5d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (y + -1.0);
	double tmp;
	if (x <= -1.95e-7) {
		tmp = t_0;
	} else if (x <= -2.25e-184) {
		tmp = 0.918938533204673 - x;
	} else if (x <= -8.2e-288) {
		tmp = y * -0.5;
	} else if (x <= 1.75e-156) {
		tmp = 0.918938533204673;
	} else if (x <= 0.5) {
		tmp = y * -0.5;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (y + -1.0)
	tmp = 0
	if x <= -1.95e-7:
		tmp = t_0
	elif x <= -2.25e-184:
		tmp = 0.918938533204673 - x
	elif x <= -8.2e-288:
		tmp = y * -0.5
	elif x <= 1.75e-156:
		tmp = 0.918938533204673
	elif x <= 0.5:
		tmp = y * -0.5
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(y + -1.0))
	tmp = 0.0
	if (x <= -1.95e-7)
		tmp = t_0;
	elseif (x <= -2.25e-184)
		tmp = Float64(0.918938533204673 - x);
	elseif (x <= -8.2e-288)
		tmp = Float64(y * -0.5);
	elseif (x <= 1.75e-156)
		tmp = 0.918938533204673;
	elseif (x <= 0.5)
		tmp = Float64(y * -0.5);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x * (y + -1.0);
	tmp = 0.0;
	if (x <= -1.95e-7)
		tmp = t_0;
	elseif (x <= -2.25e-184)
		tmp = 0.918938533204673 - x;
	elseif (x <= -8.2e-288)
		tmp = y * -0.5;
	elseif (x <= 1.75e-156)
		tmp = 0.918938533204673;
	elseif (x <= 0.5)
		tmp = y * -0.5;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e-7], t$95$0, If[LessEqual[x, -2.25e-184], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[x, -8.2e-288], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.75e-156], 0.918938533204673, If[LessEqual[x, 0.5], N[(y * -0.5), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -2.25 \cdot 10^{-184}:\\
\;\;\;\;0.918938533204673 - x\\

\mathbf{elif}\;x \leq -8.2 \cdot 10^{-288}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 1.75 \cdot 10^{-156}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.95000000000000012e-7 or 0.5 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in x around inf 97.0%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(1 + -1 \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg97.0%

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

        \[\leadsto \color{blue}{0 - x \cdot \left(1 + -1 \cdot y\right)} \]
      3. distribute-rgt-in97.0%

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

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y\right)} \cdot x\right) \]
      5. distribute-lft-neg-in97.0%

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y \cdot x\right)}\right) \]
      6. *-lft-identity97.0%

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

        \[\leadsto 0 - \color{blue}{\left(x - y \cdot x\right)} \]
      8. associate-+l-97.0%

        \[\leadsto \color{blue}{\left(0 - x\right) + y \cdot x} \]
      9. neg-sub097.0%

        \[\leadsto \color{blue}{\left(-x\right)} + y \cdot x \]
      10. neg-mul-197.0%

        \[\leadsto \color{blue}{-1 \cdot x} + y \cdot x \]
      11. distribute-rgt-in97.0%

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

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

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

    if -1.95000000000000012e-7 < x < -2.2500000000000001e-184

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 68.4%

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

    if -2.2500000000000001e-184 < x < -8.20000000000000015e-288 or 1.75e-156 < x < 0.5

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 68.9%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around 0 67.1%

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    7. Simplified67.1%

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

    if -8.20000000000000015e-288 < x < 1.75e-156

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 68.7%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
    5. Step-by-step derivation
      1. flip3--67.7%

        \[\leadsto \color{blue}{\frac{{0.918938533204673}^{3} - {x}^{3}}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      2. div-inv67.7%

        \[\leadsto \color{blue}{\left({0.918938533204673}^{3} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      3. metadata-eval67.7%

        \[\leadsto \left(\color{blue}{0.7759958320417895} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      4. metadata-eval67.7%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{\color{blue}{0.8444480278083559} + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      5. distribute-rgt-out67.7%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + \color{blue}{x \cdot \left(x + 0.918938533204673\right)}} \]
      6. +-commutative67.7%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \color{blue}{\left(0.918938533204673 + x\right)}} \]
    6. Applied egg-rr67.7%

      \[\leadsto \color{blue}{\left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \left(0.918938533204673 + x\right)}} \]
    7. Taylor expanded in x around 0 68.7%

      \[\leadsto \color{blue}{0.918938533204673} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-184}:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;x \leq -8.2 \cdot 10^{-288}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-156}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \end{array} \]

Alternative 4: 49.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-290}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-157}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 51000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1.95e-7)
   (* x y)
   (if (<= x -2.9e-184)
     0.918938533204673
     (if (<= x -2.4e-290)
       (* y -0.5)
       (if (<= x 1.3e-157)
         0.918938533204673
         (if (<= x 51000.0) (* y -0.5) (* x y)))))))
double code(double x, double y) {
	double tmp;
	if (x <= -1.95e-7) {
		tmp = x * y;
	} else if (x <= -2.9e-184) {
		tmp = 0.918938533204673;
	} else if (x <= -2.4e-290) {
		tmp = y * -0.5;
	} else if (x <= 1.3e-157) {
		tmp = 0.918938533204673;
	} else if (x <= 51000.0) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.95d-7)) then
        tmp = x * y
    else if (x <= (-2.9d-184)) then
        tmp = 0.918938533204673d0
    else if (x <= (-2.4d-290)) then
        tmp = y * (-0.5d0)
    else if (x <= 1.3d-157) then
        tmp = 0.918938533204673d0
    else if (x <= 51000.0d0) then
        tmp = y * (-0.5d0)
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.95e-7) {
		tmp = x * y;
	} else if (x <= -2.9e-184) {
		tmp = 0.918938533204673;
	} else if (x <= -2.4e-290) {
		tmp = y * -0.5;
	} else if (x <= 1.3e-157) {
		tmp = 0.918938533204673;
	} else if (x <= 51000.0) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1.95e-7:
		tmp = x * y
	elif x <= -2.9e-184:
		tmp = 0.918938533204673
	elif x <= -2.4e-290:
		tmp = y * -0.5
	elif x <= 1.3e-157:
		tmp = 0.918938533204673
	elif x <= 51000.0:
		tmp = y * -0.5
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1.95e-7)
		tmp = Float64(x * y);
	elseif (x <= -2.9e-184)
		tmp = 0.918938533204673;
	elseif (x <= -2.4e-290)
		tmp = Float64(y * -0.5);
	elseif (x <= 1.3e-157)
		tmp = 0.918938533204673;
	elseif (x <= 51000.0)
		tmp = Float64(y * -0.5);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.95e-7)
		tmp = x * y;
	elseif (x <= -2.9e-184)
		tmp = 0.918938533204673;
	elseif (x <= -2.4e-290)
		tmp = y * -0.5;
	elseif (x <= 1.3e-157)
		tmp = 0.918938533204673;
	elseif (x <= 51000.0)
		tmp = y * -0.5;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1.95e-7], N[(x * y), $MachinePrecision], If[LessEqual[x, -2.9e-184], 0.918938533204673, If[LessEqual[x, -2.4e-290], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.3e-157], 0.918938533204673, If[LessEqual[x, 51000.0], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;x \leq -2.4 \cdot 10^{-290}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-157}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;x \leq 51000:\\
\;\;\;\;y \cdot -0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.95000000000000012e-7 or 51000 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 58.5%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around inf 56.5%

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

    if -1.95000000000000012e-7 < x < -2.90000000000000014e-184 or -2.4000000000000001e-290 < x < 1.29999999999999994e-157

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 68.5%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
    5. Step-by-step derivation
      1. flip3--67.5%

        \[\leadsto \color{blue}{\frac{{0.918938533204673}^{3} - {x}^{3}}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      2. div-inv67.5%

        \[\leadsto \color{blue}{\left({0.918938533204673}^{3} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      3. metadata-eval67.5%

        \[\leadsto \left(\color{blue}{0.7759958320417895} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      4. metadata-eval67.5%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{\color{blue}{0.8444480278083559} + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      5. distribute-rgt-out67.5%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + \color{blue}{x \cdot \left(x + 0.918938533204673\right)}} \]
      6. +-commutative67.5%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \color{blue}{\left(0.918938533204673 + x\right)}} \]
    6. Applied egg-rr67.5%

      \[\leadsto \color{blue}{\left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \left(0.918938533204673 + x\right)}} \]
    7. Taylor expanded in x around 0 68.3%

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

    if -2.90000000000000014e-184 < x < -2.4000000000000001e-290 or 1.29999999999999994e-157 < x < 51000

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 66.7%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around 0 65.0%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative65.0%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    7. Simplified65.0%

      \[\leadsto \color{blue}{y \cdot -0.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-290}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-157}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 51000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 5: 98.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2700000 \lor \neg \left(x \leq 2.3\right):\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -2700000.0) (not (<= x 2.3)))
   (* x (+ y -1.0))
   (+ (* x y) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
	double tmp;
	if ((x <= -2700000.0) || !(x <= 2.3)) {
		tmp = x * (y + -1.0);
	} else {
		tmp = (x * y) + (0.918938533204673 - (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 ((x <= (-2700000.0d0)) .or. (.not. (x <= 2.3d0))) then
        tmp = x * (y + (-1.0d0))
    else
        tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -2700000.0) || !(x <= 2.3)) {
		tmp = x * (y + -1.0);
	} else {
		tmp = (x * y) + (0.918938533204673 - (y * 0.5));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -2700000.0) or not (x <= 2.3):
		tmp = x * (y + -1.0)
	else:
		tmp = (x * y) + (0.918938533204673 - (y * 0.5))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -2700000.0) || !(x <= 2.3))
		tmp = Float64(x * Float64(y + -1.0));
	else
		tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -2700000.0) || ~((x <= 2.3)))
		tmp = x * (y + -1.0);
	else
		tmp = (x * y) + (0.918938533204673 - (y * 0.5));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -2700000.0], N[Not[LessEqual[x, 2.3]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2700000 \lor \neg \left(x \leq 2.3\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.7e6 or 2.2999999999999998 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in x around inf 98.9%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(1 + -1 \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg98.9%

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

        \[\leadsto \color{blue}{0 - x \cdot \left(1 + -1 \cdot y\right)} \]
      3. distribute-rgt-in98.9%

        \[\leadsto 0 - \color{blue}{\left(1 \cdot x + \left(-1 \cdot y\right) \cdot x\right)} \]
      4. mul-1-neg98.9%

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y\right)} \cdot x\right) \]
      5. distribute-lft-neg-in98.9%

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y \cdot x\right)}\right) \]
      6. *-lft-identity98.9%

        \[\leadsto 0 - \left(\color{blue}{x} + \left(-y \cdot x\right)\right) \]
      7. sub-neg98.9%

        \[\leadsto 0 - \color{blue}{\left(x - y \cdot x\right)} \]
      8. associate-+l-98.9%

        \[\leadsto \color{blue}{\left(0 - x\right) + y \cdot x} \]
      9. neg-sub098.9%

        \[\leadsto \color{blue}{\left(-x\right)} + y \cdot x \]
      10. neg-mul-198.9%

        \[\leadsto \color{blue}{-1 \cdot x} + y \cdot x \]
      11. distribute-rgt-in98.9%

        \[\leadsto \color{blue}{x \cdot \left(-1 + y\right)} \]
      12. +-commutative98.9%

        \[\leadsto x \cdot \color{blue}{\left(y + -1\right)} \]
    6. Simplified98.9%

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

    if -2.7e6 < x < 2.2999999999999998

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Taylor expanded in y around inf 99.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2700000 \lor \neg \left(x \leq 2.3\right):\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\ \end{array} \]

Alternative 6: 97.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.35 \lor \neg \left(y \leq 1.65\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.35) (not (<= y 1.65)))
   (* y (- x 0.5))
   (- 0.918938533204673 x)))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.35) || !(y <= 1.65)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-1.35d0)) .or. (.not. (y <= 1.65d0))) then
        tmp = y * (x - 0.5d0)
    else
        tmp = 0.918938533204673d0 - x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -1.35) || !(y <= 1.65)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.35) or not (y <= 1.65):
		tmp = y * (x - 0.5)
	else:
		tmp = 0.918938533204673 - x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.35) || !(y <= 1.65))
		tmp = Float64(y * Float64(x - 0.5));
	else
		tmp = Float64(0.918938533204673 - x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -1.35) || ~((y <= 1.65)))
		tmp = y * (x - 0.5);
	else
		tmp = 0.918938533204673 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.35], N[Not[LessEqual[y, 1.65]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \lor \neg \left(y \leq 1.65\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3500000000000001 or 1.6499999999999999 < y

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 95.6%

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

    if -1.3500000000000001 < y < 1.6499999999999999

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 97.7%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \lor \neg \left(y \leq 1.65\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \]

Alternative 7: 98.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.8\right):\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -0.7) (not (<= x 0.8)))
   (* x (+ y -1.0))
   (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
	double tmp;
	if ((x <= -0.7) || !(x <= 0.8)) {
		tmp = x * (y + -1.0);
	} else {
		tmp = 0.918938533204673 - (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 ((x <= (-0.7d0)) .or. (.not. (x <= 0.8d0))) then
        tmp = x * (y + (-1.0d0))
    else
        tmp = 0.918938533204673d0 - (y * 0.5d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -0.7) || !(x <= 0.8)) {
		tmp = x * (y + -1.0);
	} else {
		tmp = 0.918938533204673 - (y * 0.5);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -0.7) or not (x <= 0.8):
		tmp = x * (y + -1.0)
	else:
		tmp = 0.918938533204673 - (y * 0.5)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -0.7) || !(x <= 0.8))
		tmp = Float64(x * Float64(y + -1.0));
	else
		tmp = Float64(0.918938533204673 - Float64(y * 0.5));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -0.7) || ~((x <= 0.8)))
		tmp = x * (y + -1.0);
	else
		tmp = 0.918938533204673 - (y * 0.5);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -0.7], N[Not[LessEqual[x, 0.8]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.8\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.69999999999999996 or 0.80000000000000004 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in x around inf 98.3%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(1 + -1 \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg98.3%

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

        \[\leadsto \color{blue}{0 - x \cdot \left(1 + -1 \cdot y\right)} \]
      3. distribute-rgt-in98.2%

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

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y\right)} \cdot x\right) \]
      5. distribute-lft-neg-in98.2%

        \[\leadsto 0 - \left(1 \cdot x + \color{blue}{\left(-y \cdot x\right)}\right) \]
      6. *-lft-identity98.2%

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

        \[\leadsto 0 - \color{blue}{\left(x - y \cdot x\right)} \]
      8. associate-+l-98.2%

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

        \[\leadsto \color{blue}{\left(-x\right)} + y \cdot x \]
      10. neg-mul-198.2%

        \[\leadsto \color{blue}{-1 \cdot x} + y \cdot x \]
      11. distribute-rgt-in98.3%

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

        \[\leadsto x \cdot \color{blue}{\left(y + -1\right)} \]
    6. Simplified98.3%

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

    if -0.69999999999999996 < x < 0.80000000000000004

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in x around 0 97.6%

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

        \[\leadsto 0.918938533204673 - \color{blue}{y \cdot 0.5} \]
    6. Simplified97.6%

      \[\leadsto 0.918938533204673 - \color{blue}{y \cdot 0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.8\right):\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - y \cdot 0.5\\ \end{array} \]

Alternative 8: 100.0% accurate, 1.2× speedup?

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

\\
\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
    2. cancel-sign-sub-inv100.0%

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

      \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
    4. associate-+r+100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
    5. cancel-sign-sub-inv100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
    6. associate-+l-100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
    7. sub-neg100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
    8. distribute-rgt-in100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
    9. metadata-eval100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
    10. neg-mul-1100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
    11. associate--r+100.0%

      \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
    12. distribute-lft-out--100.0%

      \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
    13. unsub-neg100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
    14. fma-neg100.0%

      \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
    15. unsub-neg100.0%

      \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
    16. remove-double-neg100.0%

      \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
  4. Taylor expanded in y around 0 100.0%

    \[\leadsto \color{blue}{\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x} \]
  5. Final simplification100.0%

    \[\leadsto \left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x \]

Alternative 9: 49.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7} \lor \neg \left(x \leq 0.78\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -1.95e-7) (not (<= x 0.78))) (* x y) 0.918938533204673))
double code(double x, double y) {
	double tmp;
	if ((x <= -1.95e-7) || !(x <= 0.78)) {
		tmp = x * y;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-1.95d-7)) .or. (.not. (x <= 0.78d0))) then
        tmp = x * y
    else
        tmp = 0.918938533204673d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -1.95e-7) || !(x <= 0.78)) {
		tmp = x * y;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -1.95e-7) or not (x <= 0.78):
		tmp = x * y
	else:
		tmp = 0.918938533204673
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -1.95e-7) || !(x <= 0.78))
		tmp = Float64(x * y);
	else
		tmp = 0.918938533204673;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -1.95e-7) || ~((x <= 0.78)))
		tmp = x * y;
	else
		tmp = 0.918938533204673;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -1.95e-7], N[Not[LessEqual[x, 0.78]], $MachinePrecision]], N[(x * y), $MachinePrecision], 0.918938533204673]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7} \lor \neg \left(x \leq 0.78\right):\\
\;\;\;\;x \cdot y\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.95000000000000012e-7 or 0.78000000000000003 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around inf 57.6%

      \[\leadsto \color{blue}{y \cdot \left(x - 0.5\right)} \]
    5. Taylor expanded in x around inf 55.7%

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

    if -1.95000000000000012e-7 < x < 0.78000000000000003

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 51.3%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
    5. Step-by-step derivation
      1. flip3--50.6%

        \[\leadsto \color{blue}{\frac{{0.918938533204673}^{3} - {x}^{3}}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      2. div-inv50.6%

        \[\leadsto \color{blue}{\left({0.918938533204673}^{3} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      3. metadata-eval50.6%

        \[\leadsto \left(\color{blue}{0.7759958320417895} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      4. metadata-eval50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{\color{blue}{0.8444480278083559} + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      5. distribute-rgt-out50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + \color{blue}{x \cdot \left(x + 0.918938533204673\right)}} \]
      6. +-commutative50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \color{blue}{\left(0.918938533204673 + x\right)}} \]
    6. Applied egg-rr50.6%

      \[\leadsto \color{blue}{\left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \left(0.918938533204673 + x\right)}} \]
    7. Taylor expanded in x around 0 50.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-7} \lor \neg \left(x \leq 0.78\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \]

Alternative 10: 49.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.49 \lor \neg \left(x \leq 0.0255\right):\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -0.49) (not (<= x 0.0255))) (- x) 0.918938533204673))
double code(double x, double y) {
	double tmp;
	if ((x <= -0.49) || !(x <= 0.0255)) {
		tmp = -x;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-0.49d0)) .or. (.not. (x <= 0.0255d0))) then
        tmp = -x
    else
        tmp = 0.918938533204673d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -0.49) || !(x <= 0.0255)) {
		tmp = -x;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -0.49) or not (x <= 0.0255):
		tmp = -x
	else:
		tmp = 0.918938533204673
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -0.49) || !(x <= 0.0255))
		tmp = Float64(-x);
	else
		tmp = 0.918938533204673;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -0.49) || ~((x <= 0.0255)))
		tmp = -x;
	else
		tmp = 0.918938533204673;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -0.49], N[Not[LessEqual[x, 0.0255]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.49 \lor \neg \left(x \leq 0.0255\right):\\
\;\;\;\;-x\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.48999999999999999 or 0.0254999999999999984 < x

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-199.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+99.9%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--99.9%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 41.2%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
    5. Taylor expanded in x around inf 40.2%

      \[\leadsto \color{blue}{-1 \cdot x} \]
    6. Step-by-step derivation
      1. neg-mul-140.2%

        \[\leadsto \color{blue}{-x} \]
    7. Simplified40.2%

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

    if -0.48999999999999999 < x < 0.0254999999999999984

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
      2. cancel-sign-sub-inv100.0%

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

        \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
      4. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
      5. cancel-sign-sub-inv100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
      6. associate-+l-100.0%

        \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
      7. sub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      8. distribute-rgt-in100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
      9. metadata-eval100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
      10. neg-mul-1100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
      11. associate--r+100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
      12. distribute-lft-out--100.0%

        \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
      13. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
      14. fma-neg100.0%

        \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
      16. remove-double-neg100.0%

        \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
    4. Taylor expanded in y around 0 51.3%

      \[\leadsto 0.918938533204673 - \color{blue}{x} \]
    5. Step-by-step derivation
      1. flip3--50.6%

        \[\leadsto \color{blue}{\frac{{0.918938533204673}^{3} - {x}^{3}}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      2. div-inv50.6%

        \[\leadsto \color{blue}{\left({0.918938533204673}^{3} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
      3. metadata-eval50.6%

        \[\leadsto \left(\color{blue}{0.7759958320417895} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      4. metadata-eval50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{\color{blue}{0.8444480278083559} + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
      5. distribute-rgt-out50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + \color{blue}{x \cdot \left(x + 0.918938533204673\right)}} \]
      6. +-commutative50.6%

        \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \color{blue}{\left(0.918938533204673 + x\right)}} \]
    6. Applied egg-rr50.6%

      \[\leadsto \color{blue}{\left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \left(0.918938533204673 + x\right)}} \]
    7. Taylor expanded in x around 0 50.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.49 \lor \neg \left(x \leq 0.0255\right):\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \]

Alternative 11: 25.7% accurate, 11.0× speedup?

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

\\
0.918938533204673
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \color{blue}{0.918938533204673 + \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right)} \]
    2. cancel-sign-sub-inv100.0%

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

      \[\leadsto 0.918938533204673 + \color{blue}{\left(\left(-y\right) \cdot 0.5 + x \cdot \left(y - 1\right)\right)} \]
    4. associate-+r+100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 + \left(-y\right) \cdot 0.5\right) + x \cdot \left(y - 1\right)} \]
    5. cancel-sign-sub-inv100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 - y \cdot 0.5\right)} + x \cdot \left(y - 1\right) \]
    6. associate-+l-100.0%

      \[\leadsto \color{blue}{0.918938533204673 - \left(y \cdot 0.5 - x \cdot \left(y - 1\right)\right)} \]
    7. sub-neg100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
    8. distribute-rgt-in100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \color{blue}{\left(y \cdot x + \left(-1\right) \cdot x\right)}\right) \]
    9. metadata-eval100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{-1} \cdot x\right)\right) \]
    10. neg-mul-1100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot 0.5 - \left(y \cdot x + \color{blue}{\left(-x\right)}\right)\right) \]
    11. associate--r+100.0%

      \[\leadsto 0.918938533204673 - \color{blue}{\left(\left(y \cdot 0.5 - y \cdot x\right) - \left(-x\right)\right)} \]
    12. distribute-lft-out--100.0%

      \[\leadsto 0.918938533204673 - \left(\color{blue}{y \cdot \left(0.5 - x\right)} - \left(-x\right)\right) \]
    13. unsub-neg100.0%

      \[\leadsto 0.918938533204673 - \left(y \cdot \color{blue}{\left(0.5 + \left(-x\right)\right)} - \left(-x\right)\right) \]
    14. fma-neg100.0%

      \[\leadsto 0.918938533204673 - \color{blue}{\mathsf{fma}\left(y, 0.5 + \left(-x\right), -\left(-x\right)\right)} \]
    15. unsub-neg100.0%

      \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, \color{blue}{0.5 - x}, -\left(-x\right)\right) \]
    16. remove-double-neg100.0%

      \[\leadsto 0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, \color{blue}{x}\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)} \]
  4. Taylor expanded in y around 0 46.2%

    \[\leadsto 0.918938533204673 - \color{blue}{x} \]
  5. Step-by-step derivation
    1. flip3--33.9%

      \[\leadsto \color{blue}{\frac{{0.918938533204673}^{3} - {x}^{3}}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
    2. div-inv33.9%

      \[\leadsto \color{blue}{\left({0.918938533204673}^{3} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)}} \]
    3. metadata-eval33.9%

      \[\leadsto \left(\color{blue}{0.7759958320417895} - {x}^{3}\right) \cdot \frac{1}{0.918938533204673 \cdot 0.918938533204673 + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
    4. metadata-eval33.9%

      \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{\color{blue}{0.8444480278083559} + \left(x \cdot x + 0.918938533204673 \cdot x\right)} \]
    5. distribute-rgt-out33.9%

      \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + \color{blue}{x \cdot \left(x + 0.918938533204673\right)}} \]
    6. +-commutative33.9%

      \[\leadsto \left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \color{blue}{\left(0.918938533204673 + x\right)}} \]
  6. Applied egg-rr33.9%

    \[\leadsto \color{blue}{\left(0.7759958320417895 - {x}^{3}\right) \cdot \frac{1}{0.8444480278083559 + x \cdot \left(0.918938533204673 + x\right)}} \]
  7. Taylor expanded in x around 0 26.2%

    \[\leadsto \color{blue}{0.918938533204673} \]
  8. Final simplification26.2%

    \[\leadsto 0.918938533204673 \]

Reproduce

?
herbie shell --seed 2023320 
(FPCore (x y)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))