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

Percentage Accurate: 100.0% → 100.0%
Time: 8.1s
Alternatives: 14
Speedup: 0.1×

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 14 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, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, y + -1, 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. Step-by-step derivation
    1. fma-neg100.0%

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673 \]

Alternative 2: 50.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+149}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{+41}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1250000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-191}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-230}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-286}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 5.9 \cdot 10^{-282}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -4.6e+149)
   (* y -0.5)
   (if (<= y -2.9e+41)
     (* x y)
     (if (<= y -1250000.0)
       (* y -0.5)
       (if (<= y -6.2e-191)
         (- x)
         (if (<= y -2.3e-230)
           0.918938533204673
           (if (<= y -1e-286)
             (- x)
             (if (<= y 5.9e-282)
               0.918938533204673
               (if (<= y 1.0) (- x) (* x y))))))))))
double code(double x, double y) {
	double tmp;
	if (y <= -4.6e+149) {
		tmp = y * -0.5;
	} else if (y <= -2.9e+41) {
		tmp = x * y;
	} else if (y <= -1250000.0) {
		tmp = y * -0.5;
	} else if (y <= -6.2e-191) {
		tmp = -x;
	} else if (y <= -2.3e-230) {
		tmp = 0.918938533204673;
	} else if (y <= -1e-286) {
		tmp = -x;
	} else if (y <= 5.9e-282) {
		tmp = 0.918938533204673;
	} else if (y <= 1.0) {
		tmp = -x;
	} 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 (y <= (-4.6d+149)) then
        tmp = y * (-0.5d0)
    else if (y <= (-2.9d+41)) then
        tmp = x * y
    else if (y <= (-1250000.0d0)) then
        tmp = y * (-0.5d0)
    else if (y <= (-6.2d-191)) then
        tmp = -x
    else if (y <= (-2.3d-230)) then
        tmp = 0.918938533204673d0
    else if (y <= (-1d-286)) then
        tmp = -x
    else if (y <= 5.9d-282) then
        tmp = 0.918938533204673d0
    else if (y <= 1.0d0) then
        tmp = -x
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -4.6e+149) {
		tmp = y * -0.5;
	} else if (y <= -2.9e+41) {
		tmp = x * y;
	} else if (y <= -1250000.0) {
		tmp = y * -0.5;
	} else if (y <= -6.2e-191) {
		tmp = -x;
	} else if (y <= -2.3e-230) {
		tmp = 0.918938533204673;
	} else if (y <= -1e-286) {
		tmp = -x;
	} else if (y <= 5.9e-282) {
		tmp = 0.918938533204673;
	} else if (y <= 1.0) {
		tmp = -x;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -4.6e+149:
		tmp = y * -0.5
	elif y <= -2.9e+41:
		tmp = x * y
	elif y <= -1250000.0:
		tmp = y * -0.5
	elif y <= -6.2e-191:
		tmp = -x
	elif y <= -2.3e-230:
		tmp = 0.918938533204673
	elif y <= -1e-286:
		tmp = -x
	elif y <= 5.9e-282:
		tmp = 0.918938533204673
	elif y <= 1.0:
		tmp = -x
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -4.6e+149)
		tmp = Float64(y * -0.5);
	elseif (y <= -2.9e+41)
		tmp = Float64(x * y);
	elseif (y <= -1250000.0)
		tmp = Float64(y * -0.5);
	elseif (y <= -6.2e-191)
		tmp = Float64(-x);
	elseif (y <= -2.3e-230)
		tmp = 0.918938533204673;
	elseif (y <= -1e-286)
		tmp = Float64(-x);
	elseif (y <= 5.9e-282)
		tmp = 0.918938533204673;
	elseif (y <= 1.0)
		tmp = Float64(-x);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -4.6e+149)
		tmp = y * -0.5;
	elseif (y <= -2.9e+41)
		tmp = x * y;
	elseif (y <= -1250000.0)
		tmp = y * -0.5;
	elseif (y <= -6.2e-191)
		tmp = -x;
	elseif (y <= -2.3e-230)
		tmp = 0.918938533204673;
	elseif (y <= -1e-286)
		tmp = -x;
	elseif (y <= 5.9e-282)
		tmp = 0.918938533204673;
	elseif (y <= 1.0)
		tmp = -x;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -4.6e+149], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.9e+41], N[(x * y), $MachinePrecision], If[LessEqual[y, -1250000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -6.2e-191], (-x), If[LessEqual[y, -2.3e-230], 0.918938533204673, If[LessEqual[y, -1e-286], (-x), If[LessEqual[y, 5.9e-282], 0.918938533204673, If[LessEqual[y, 1.0], (-x), N[(x * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+149}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -2.9 \cdot 10^{+41}:\\
\;\;\;\;x \cdot y\\

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

\mathbf{elif}\;y \leq -6.2 \cdot 10^{-191}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq -2.3 \cdot 10^{-230}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;y \leq -1 \cdot 10^{-286}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq 5.9 \cdot 10^{-282}:\\
\;\;\;\;0.918938533204673\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.5999999999999997e149 or -2.89999999999999988e41 < y < -1.25e6

    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 100.0%

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

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

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified60.0%

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

    if -4.5999999999999997e149 < y < -2.89999999999999988e41 or 1 < 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around inf 62.2%

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

    if -1.25e6 < y < -6.2000000000000004e-191 or -2.2999999999999998e-230 < y < -1.00000000000000005e-286 or 5.8999999999999997e-282 < y < 1

    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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around 0 59.6%

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

        \[\leadsto \color{blue}{-x} \]
    9. Simplified59.6%

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

    if -6.2000000000000004e-191 < y < -2.2999999999999998e-230 or -1.00000000000000005e-286 < y < 5.8999999999999997e-282

    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. fma-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x \cdot \left(y + -1\right) + \color{blue}{y \cdot -0.5}\right) + \mathsf{fma}\left(-0.5, y, 0.5 \cdot y\right)\right) + 0.918938533204673 \]
      13. fma-udef100.0%

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

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

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot 0.5}\right)\right) + 0.918938533204673 \]
      16. add-sqr-sqrt36.4%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot 0.5} \cdot \sqrt{y \cdot 0.5}}\right)\right) + 0.918938533204673 \]
      17. sqrt-unprod100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{\left(y \cdot 0.5\right) \cdot \left(y \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
      18. swap-sqr100.0%

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

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{0.25}}\right)\right) + 0.918938533204673 \]
      20. metadata-eval100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      21. swap-sqr100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot -0.5\right) \cdot \left(y \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      22. sqrt-unprod63.6%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot -0.5} \cdot \sqrt{y \cdot -0.5}}\right)\right) + 0.918938533204673 \]
      23. add-sqr-sqrt100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot -0.5}\right)\right) + 0.918938533204673 \]
    5. Applied egg-rr100.0%

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

        \[\leadsto \left(\color{blue}{\left(x \cdot \left(y + -1\right) + y \cdot -0.5\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      2. distribute-rgt-out100.0%

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

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

        \[\leadsto \left(\left(\color{blue}{\left(\left(-x\right) + y \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      5. *-commutative100.0%

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

        \[\leadsto \left(\color{blue}{\left(\left(-x\right) + \left(x \cdot y + y \cdot -0.5\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      7. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \left(\color{blue}{y \cdot -0.5} + y \cdot -0.5\right)\right) + 0.918938533204673 \]
      18. distribute-lft-out100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+149}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{+41}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1250000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-191}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-230}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-286}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 5.9 \cdot 10^{-282}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 3: 50.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -640000000:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-65}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq -4.7 \cdot 10^{-292}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-273}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-129}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -640000000.0)
   (- x)
   (if (<= x -3.7e-65)
     (* y -0.5)
     (if (<= x -4.7e-292)
       0.918938533204673
       (if (<= x 3.15e-273)
         (* y -0.5)
         (if (<= x 1.8e-129)
           0.918938533204673
           (if (<= x 0.9) (* y -0.5) (- x))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = -x;
	} else if (x <= -3.7e-65) {
		tmp = y * -0.5;
	} else if (x <= -4.7e-292) {
		tmp = 0.918938533204673;
	} else if (x <= 3.15e-273) {
		tmp = y * -0.5;
	} else if (x <= 1.8e-129) {
		tmp = 0.918938533204673;
	} else if (x <= 0.9) {
		tmp = y * -0.5;
	} else {
		tmp = -x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-640000000.0d0)) then
        tmp = -x
    else if (x <= (-3.7d-65)) then
        tmp = y * (-0.5d0)
    else if (x <= (-4.7d-292)) then
        tmp = 0.918938533204673d0
    else if (x <= 3.15d-273) then
        tmp = y * (-0.5d0)
    else if (x <= 1.8d-129) then
        tmp = 0.918938533204673d0
    else if (x <= 0.9d0) then
        tmp = y * (-0.5d0)
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = -x;
	} else if (x <= -3.7e-65) {
		tmp = y * -0.5;
	} else if (x <= -4.7e-292) {
		tmp = 0.918938533204673;
	} else if (x <= 3.15e-273) {
		tmp = y * -0.5;
	} else if (x <= 1.8e-129) {
		tmp = 0.918938533204673;
	} else if (x <= 0.9) {
		tmp = y * -0.5;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -640000000.0:
		tmp = -x
	elif x <= -3.7e-65:
		tmp = y * -0.5
	elif x <= -4.7e-292:
		tmp = 0.918938533204673
	elif x <= 3.15e-273:
		tmp = y * -0.5
	elif x <= 1.8e-129:
		tmp = 0.918938533204673
	elif x <= 0.9:
		tmp = y * -0.5
	else:
		tmp = -x
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -640000000.0)
		tmp = Float64(-x);
	elseif (x <= -3.7e-65)
		tmp = Float64(y * -0.5);
	elseif (x <= -4.7e-292)
		tmp = 0.918938533204673;
	elseif (x <= 3.15e-273)
		tmp = Float64(y * -0.5);
	elseif (x <= 1.8e-129)
		tmp = 0.918938533204673;
	elseif (x <= 0.9)
		tmp = Float64(y * -0.5);
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -640000000.0)
		tmp = -x;
	elseif (x <= -3.7e-65)
		tmp = y * -0.5;
	elseif (x <= -4.7e-292)
		tmp = 0.918938533204673;
	elseif (x <= 3.15e-273)
		tmp = y * -0.5;
	elseif (x <= 1.8e-129)
		tmp = 0.918938533204673;
	elseif (x <= 0.9)
		tmp = y * -0.5;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -640000000.0], (-x), If[LessEqual[x, -3.7e-65], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, -4.7e-292], 0.918938533204673, If[LessEqual[x, 3.15e-273], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.8e-129], 0.918938533204673, If[LessEqual[x, 0.9], N[(y * -0.5), $MachinePrecision], (-x)]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -640000000:\\
\;\;\;\;-x\\

\mathbf{elif}\;x \leq -3.7 \cdot 10^{-65}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq -4.7 \cdot 10^{-292}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;x \leq 3.15 \cdot 10^{-273}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 1.8 \cdot 10^{-129}:\\
\;\;\;\;0.918938533204673\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.4e8 or 0.900000000000000022 < 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around 0 51.5%

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

        \[\leadsto \color{blue}{-x} \]
    9. Simplified51.5%

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

    if -6.4e8 < x < -3.7e-65 or -4.70000000000000002e-292 < x < 3.14999999999999989e-273 or 1.8e-129 < x < 0.900000000000000022

    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 98.6%

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

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

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified63.9%

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

    if -3.7e-65 < x < -4.70000000000000002e-292 or 3.14999999999999989e-273 < x < 1.8e-129

    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. fma-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x \cdot \left(y + -1\right) + \color{blue}{y \cdot -0.5}\right) + \mathsf{fma}\left(-0.5, y, 0.5 \cdot y\right)\right) + 0.918938533204673 \]
      13. fma-udef100.0%

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

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

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot 0.5}\right)\right) + 0.918938533204673 \]
      16. add-sqr-sqrt47.8%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot 0.5} \cdot \sqrt{y \cdot 0.5}}\right)\right) + 0.918938533204673 \]
      17. sqrt-unprod76.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{\left(y \cdot 0.5\right) \cdot \left(y \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
      18. swap-sqr76.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(0.5 \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
      19. metadata-eval76.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{0.25}}\right)\right) + 0.918938533204673 \]
      20. metadata-eval76.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      21. swap-sqr76.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot -0.5\right) \cdot \left(y \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      22. sqrt-unprod34.7%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot -0.5} \cdot \sqrt{y \cdot -0.5}}\right)\right) + 0.918938533204673 \]
      23. add-sqr-sqrt69.6%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot -0.5}\right)\right) + 0.918938533204673 \]
    5. Applied egg-rr69.6%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right)} + 0.918938533204673 \]
    6. Step-by-step derivation
      1. fma-udef69.6%

        \[\leadsto \left(\color{blue}{\left(x \cdot \left(y + -1\right) + y \cdot -0.5\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      2. distribute-rgt-out69.6%

        \[\leadsto \left(\left(\color{blue}{\left(y \cdot x + -1 \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      3. neg-mul-169.6%

        \[\leadsto \left(\left(\left(y \cdot x + \color{blue}{\left(-x\right)}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      4. +-commutative69.6%

        \[\leadsto \left(\left(\color{blue}{\left(\left(-x\right) + y \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      5. *-commutative69.6%

        \[\leadsto \left(\left(\left(\left(-x\right) + \color{blue}{x \cdot y}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      6. associate-+r+69.6%

        \[\leadsto \left(\color{blue}{\left(\left(-x\right) + \left(x \cdot y + y \cdot -0.5\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      7. *-commutative69.6%

        \[\leadsto \left(\left(\left(-x\right) + \left(\color{blue}{y \cdot x} + y \cdot -0.5\right)\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      8. distribute-lft-in69.6%

        \[\leadsto \left(\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      9. +-commutative69.6%

        \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      10. sub-neg69.6%

        \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      11. metadata-eval69.6%

        \[\leadsto \left(\left(y \cdot \left(x + \color{blue}{\left(-0.5\right)}\right) - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      12. sub-neg69.6%

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(x - 0.5\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      13. sub-neg69.6%

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      14. metadata-eval69.6%

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

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(-0.5 + x\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      16. fma-udef69.6%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{\left(-0.5 \cdot y + y \cdot -0.5\right)}\right) + 0.918938533204673 \]
      17. *-commutative69.6%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \left(\color{blue}{y \cdot -0.5} + y \cdot -0.5\right)\right) + 0.918938533204673 \]
      18. distribute-lft-out69.6%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{y \cdot \left(-0.5 + -0.5\right)}\right) + 0.918938533204673 \]
      19. metadata-eval69.6%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + y \cdot \color{blue}{-1}\right) + 0.918938533204673 \]
      20. *-commutative69.6%

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

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{\left(-y\right)}\right) + 0.918938533204673 \]
    7. Simplified69.6%

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

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

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

        \[\leadsto \left(-\color{blue}{\left(1 + -1 \cdot \left(x - 0.5\right)\right) \cdot y}\right) + 0.918938533204673 \]
      3. distribute-rgt-neg-in69.6%

        \[\leadsto \color{blue}{\left(1 + -1 \cdot \left(x - 0.5\right)\right) \cdot \left(-y\right)} + 0.918938533204673 \]
      4. sub-neg69.6%

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

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

        \[\leadsto \left(1 + \color{blue}{\left(-\left(x + -0.5\right)\right)}\right) \cdot \left(-y\right) + 0.918938533204673 \]
      7. unsub-neg69.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -640000000:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-65}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq -4.7 \cdot 10^{-292}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-273}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-129}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 4: 98.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -640000000:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \mathbf{elif}\;x \leq 0.55:\\ \;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -640000000.0)
   (+ 0.918938533204673 (- (* x y) x))
   (if (<= x 0.55)
     (+ (* x y) (- 0.918938533204673 (* y 0.5)))
     (+ 0.918938533204673 (* x (+ y -1.0))))))
double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else if (x <= 0.55) {
		tmp = (x * y) + (0.918938533204673 - (y * 0.5));
	} else {
		tmp = 0.918938533204673 + (x * (y + -1.0));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-640000000.0d0)) then
        tmp = 0.918938533204673d0 + ((x * y) - x)
    else if (x <= 0.55d0) then
        tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
    else
        tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else if (x <= 0.55) {
		tmp = (x * y) + (0.918938533204673 - (y * 0.5));
	} else {
		tmp = 0.918938533204673 + (x * (y + -1.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -640000000.0:
		tmp = 0.918938533204673 + ((x * y) - x)
	elif x <= 0.55:
		tmp = (x * y) + (0.918938533204673 - (y * 0.5))
	else:
		tmp = 0.918938533204673 + (x * (y + -1.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -640000000.0)
		tmp = Float64(0.918938533204673 + Float64(Float64(x * y) - x));
	elseif (x <= 0.55)
		tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5)));
	else
		tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -640000000.0)
		tmp = 0.918938533204673 + ((x * y) - x);
	elseif (x <= 0.55)
		tmp = (x * y) + (0.918938533204673 - (y * 0.5));
	else
		tmp = 0.918938533204673 + (x * (y + -1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -640000000.0], N[(0.918938533204673 + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.55], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -640000000:\\
\;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\

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

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


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

    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. fma-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot x + -1 \cdot x\right)} + 0.918938533204673 \]
      5. fma-def100.0%

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

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

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

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

    if -6.4e8 < x < 0.55000000000000004

    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.4%

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

    if 0.55000000000000004 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

Alternative 5: 73.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.45 \cdot 10^{+144}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+46}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1150000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2.45e+144)
   (* y -0.5)
   (if (<= y -5e+46)
     (* x y)
     (if (<= y -1150000.0)
       (* y -0.5)
       (if (<= y 1.0) (- 0.918938533204673 x) (* x y))))))
double code(double x, double y) {
	double tmp;
	if (y <= -2.45e+144) {
		tmp = y * -0.5;
	} else if (y <= -5e+46) {
		tmp = x * y;
	} else if (y <= -1150000.0) {
		tmp = y * -0.5;
	} else if (y <= 1.0) {
		tmp = 0.918938533204673 - x;
	} 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 (y <= (-2.45d+144)) then
        tmp = y * (-0.5d0)
    else if (y <= (-5d+46)) then
        tmp = x * y
    else if (y <= (-1150000.0d0)) then
        tmp = y * (-0.5d0)
    else if (y <= 1.0d0) then
        tmp = 0.918938533204673d0 - x
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2.45e+144) {
		tmp = y * -0.5;
	} else if (y <= -5e+46) {
		tmp = x * y;
	} else if (y <= -1150000.0) {
		tmp = y * -0.5;
	} else if (y <= 1.0) {
		tmp = 0.918938533204673 - x;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2.45e+144:
		tmp = y * -0.5
	elif y <= -5e+46:
		tmp = x * y
	elif y <= -1150000.0:
		tmp = y * -0.5
	elif y <= 1.0:
		tmp = 0.918938533204673 - x
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2.45e+144)
		tmp = Float64(y * -0.5);
	elseif (y <= -5e+46)
		tmp = Float64(x * y);
	elseif (y <= -1150000.0)
		tmp = Float64(y * -0.5);
	elseif (y <= 1.0)
		tmp = Float64(0.918938533204673 - x);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2.45e+144)
		tmp = y * -0.5;
	elseif (y <= -5e+46)
		tmp = x * y;
	elseif (y <= -1150000.0)
		tmp = y * -0.5;
	elseif (y <= 1.0)
		tmp = 0.918938533204673 - x;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2.45e+144], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -5e+46], N[(x * y), $MachinePrecision], If[LessEqual[y, -1150000.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.0], N[(0.918938533204673 - x), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{+144}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -5 \cdot 10^{+46}:\\
\;\;\;\;x \cdot y\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.45e144 or -5.0000000000000002e46 < y < -1.15e6

    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 100.0%

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

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

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified60.0%

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

    if -2.45e144 < y < -5.0000000000000002e46 or 1 < 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around inf 62.2%

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

    if -1.15e6 < y < 1

    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. fma-neg100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-196.6%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
      2. sub-neg96.6%

        \[\leadsto \color{blue}{0.918938533204673 - x} \]
    6. Simplified96.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.45 \cdot 10^{+144}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+46}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1150000:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 6: 98.8% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.45e9 or 0.849999999999999978 < 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. fma-neg100.0%

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

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

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

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

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

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

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

    if -1.45e9 < x < 0.849999999999999978

    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. fma-neg100.0%

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

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

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

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

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

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

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

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

Alternative 7: 98.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -16500000000:\\ \;\;\;\;x \cdot y - x\\ \mathbf{elif}\;x \leq 180000:\\ \;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -16500000000.0)
   (- (* x y) x)
   (if (<= x 180000.0)
     (+ 0.918938533204673 (* y (- x 0.5)))
     (* x (+ y -1.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -16500000000.0) {
		tmp = (x * y) - x;
	} else if (x <= 180000.0) {
		tmp = 0.918938533204673 + (y * (x - 0.5));
	} else {
		tmp = x * (y + -1.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-16500000000.0d0)) then
        tmp = (x * y) - x
    else if (x <= 180000.0d0) then
        tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
    else
        tmp = x * (y + (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -16500000000.0) {
		tmp = (x * y) - x;
	} else if (x <= 180000.0) {
		tmp = 0.918938533204673 + (y * (x - 0.5));
	} else {
		tmp = x * (y + -1.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -16500000000.0:
		tmp = (x * y) - x
	elif x <= 180000.0:
		tmp = 0.918938533204673 + (y * (x - 0.5))
	else:
		tmp = x * (y + -1.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -16500000000.0)
		tmp = Float64(Float64(x * y) - x);
	elseif (x <= 180000.0)
		tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5)));
	else
		tmp = Float64(x * Float64(y + -1.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -16500000000.0)
		tmp = (x * y) - x;
	elseif (x <= 180000.0)
		tmp = 0.918938533204673 + (y * (x - 0.5));
	else
		tmp = x * (y + -1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -16500000000.0], N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 180000.0], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -16500000000:\\
\;\;\;\;x \cdot y - x\\

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

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


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

    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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around 0 99.9%

      \[\leadsto \color{blue}{y \cdot x + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-199.9%

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

        \[\leadsto \color{blue}{y \cdot x - x} \]
      3. *-commutative99.9%

        \[\leadsto \color{blue}{x \cdot y} - x \]
    9. Simplified99.9%

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

    if -1.65e10 < x < 1.8e5

    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. fma-neg100.0%

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

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

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

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

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

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

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

    if 1.8e5 < 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

Alternative 8: 98.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -640000000:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \mathbf{elif}\;x \leq 0.00084:\\ \;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -640000000.0)
   (+ 0.918938533204673 (- (* x y) x))
   (if (<= x 0.00084)
     (+ 0.918938533204673 (* y (- x 0.5)))
     (+ 0.918938533204673 (* x (+ y -1.0))))))
double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else if (x <= 0.00084) {
		tmp = 0.918938533204673 + (y * (x - 0.5));
	} else {
		tmp = 0.918938533204673 + (x * (y + -1.0));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-640000000.0d0)) then
        tmp = 0.918938533204673d0 + ((x * y) - x)
    else if (x <= 0.00084d0) then
        tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
    else
        tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -640000000.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else if (x <= 0.00084) {
		tmp = 0.918938533204673 + (y * (x - 0.5));
	} else {
		tmp = 0.918938533204673 + (x * (y + -1.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -640000000.0:
		tmp = 0.918938533204673 + ((x * y) - x)
	elif x <= 0.00084:
		tmp = 0.918938533204673 + (y * (x - 0.5))
	else:
		tmp = 0.918938533204673 + (x * (y + -1.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -640000000.0)
		tmp = Float64(0.918938533204673 + Float64(Float64(x * y) - x));
	elseif (x <= 0.00084)
		tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5)));
	else
		tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -640000000.0)
		tmp = 0.918938533204673 + ((x * y) - x);
	elseif (x <= 0.00084)
		tmp = 0.918938533204673 + (y * (x - 0.5));
	else
		tmp = 0.918938533204673 + (x * (y + -1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -640000000.0], N[(0.918938533204673 + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00084], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -640000000:\\
\;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\

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

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


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

    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. fma-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot x + -1 \cdot x\right)} + 0.918938533204673 \]
      5. fma-def100.0%

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

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

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

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

    if -6.4e8 < x < 8.4000000000000003e-4

    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. fma-neg100.0%

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

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

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

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

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

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

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

    if 8.4000000000000003e-4 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

Alternative 9: 97.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.22 \lor \neg \left(y \leq 1\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.22) (not (<= y 1.0)))
   (* y (- x 0.5))
   (- 0.918938533204673 x)))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.22) || !(y <= 1.0)) {
		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.22d0)) .or. (.not. (y <= 1.0d0))) 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.22) || !(y <= 1.0)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.22) or not (y <= 1.0):
		tmp = y * (x - 0.5)
	else:
		tmp = 0.918938533204673 - x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.22) || !(y <= 1.0))
		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.22) || ~((y <= 1.0)))
		tmp = y * (x - 0.5);
	else
		tmp = 0.918938533204673 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.22], N[Not[LessEqual[y, 1.0]], $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.22 \lor \neg \left(y \leq 1\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.21999999999999997 or 1 < 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. 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.1%

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

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

    if -1.21999999999999997 < y < 1

    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. fma-neg100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-197.3%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
      2. sub-neg97.3%

        \[\leadsto \color{blue}{0.918938533204673 - x} \]
    6. Simplified97.3%

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

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

Alternative 10: 97.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.66 \lor \neg \left(x \leq 0.9\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.66) (not (<= x 0.9)))
   (* x (+ y -1.0))
   (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
	double tmp;
	if ((x <= -0.66) || !(x <= 0.9)) {
		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.66d0)) .or. (.not. (x <= 0.9d0))) 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.66) || !(x <= 0.9)) {
		tmp = x * (y + -1.0);
	} else {
		tmp = 0.918938533204673 - (y * 0.5);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -0.66) or not (x <= 0.9):
		tmp = x * (y + -1.0)
	else:
		tmp = 0.918938533204673 - (y * 0.5)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -0.66) || !(x <= 0.9))
		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.66) || ~((x <= 0.9)))
		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.66], N[Not[LessEqual[x, 0.9]], $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.66 \lor \neg \left(x \leq 0.9\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.660000000000000031 or 0.900000000000000022 < x

    1. Initial program 99.9%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

    if -0.660000000000000031 < x < 0.900000000000000022

    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 x around 0 98.3%

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

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

Alternative 11: 97.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.72:\\
\;\;\;\;x \cdot y - x\\

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

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


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

    1. Initial program 99.9%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around 0 98.1%

      \[\leadsto \color{blue}{y \cdot x + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-198.1%

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

        \[\leadsto \color{blue}{y \cdot x - x} \]
      3. *-commutative98.1%

        \[\leadsto \color{blue}{x \cdot y} - x \]
    9. Simplified98.1%

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

    if -0.71999999999999997 < x < 0.900000000000000022

    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 x around 0 98.3%

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

    if 0.900000000000000022 < 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.5%

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

Alternative 12: 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. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
    12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
  4. Step-by-step derivation
    1. fma-udef100.0%

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

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

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

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

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

Alternative 13: 49.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.91:\\
\;\;\;\;-x\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-15}:\\
\;\;\;\;0.918938533204673\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.910000000000000031 or 1.25e-15 < x

    1. Initial program 99.9%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(-y\right) \cdot 0.5 + \color{blue}{y \cdot x}\right) + 0.918938533204673\right) - x \]
      12. distribute-lft-neg-out100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x - 0.5, 0.918938533204673\right) - x} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(y - 1\right) \cdot x} \]
    7. Taylor expanded in y around 0 50.2%

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

        \[\leadsto \color{blue}{-x} \]
    9. Simplified50.2%

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

    if -0.910000000000000031 < x < 1.25e-15

    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. fma-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x \cdot \left(y + -1\right) + \color{blue}{y \cdot -0.5}\right) + \mathsf{fma}\left(-0.5, y, 0.5 \cdot y\right)\right) + 0.918938533204673 \]
      13. fma-udef100.0%

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

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

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot 0.5}\right)\right) + 0.918938533204673 \]
      16. add-sqr-sqrt45.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot 0.5} \cdot \sqrt{y \cdot 0.5}}\right)\right) + 0.918938533204673 \]
      17. sqrt-unprod66.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{\left(y \cdot 0.5\right) \cdot \left(y \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
      18. swap-sqr66.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(0.5 \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
      19. metadata-eval66.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{0.25}}\right)\right) + 0.918938533204673 \]
      20. metadata-eval66.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      21. swap-sqr66.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot -0.5\right) \cdot \left(y \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
      22. sqrt-unprod30.6%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot -0.5} \cdot \sqrt{y \cdot -0.5}}\right)\right) + 0.918938533204673 \]
      23. add-sqr-sqrt59.4%

        \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot -0.5}\right)\right) + 0.918938533204673 \]
    5. Applied egg-rr59.4%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right)} + 0.918938533204673 \]
    6. Step-by-step derivation
      1. fma-udef59.4%

        \[\leadsto \left(\color{blue}{\left(x \cdot \left(y + -1\right) + y \cdot -0.5\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      2. distribute-rgt-out59.4%

        \[\leadsto \left(\left(\color{blue}{\left(y \cdot x + -1 \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      3. neg-mul-159.4%

        \[\leadsto \left(\left(\left(y \cdot x + \color{blue}{\left(-x\right)}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      4. +-commutative59.4%

        \[\leadsto \left(\left(\color{blue}{\left(\left(-x\right) + y \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      5. *-commutative59.4%

        \[\leadsto \left(\left(\left(\left(-x\right) + \color{blue}{x \cdot y}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      6. associate-+r+59.4%

        \[\leadsto \left(\color{blue}{\left(\left(-x\right) + \left(x \cdot y + y \cdot -0.5\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      7. *-commutative59.4%

        \[\leadsto \left(\left(\left(-x\right) + \left(\color{blue}{y \cdot x} + y \cdot -0.5\right)\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      8. distribute-lft-in59.4%

        \[\leadsto \left(\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      9. +-commutative59.4%

        \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      10. sub-neg59.4%

        \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      11. metadata-eval59.4%

        \[\leadsto \left(\left(y \cdot \left(x + \color{blue}{\left(-0.5\right)}\right) - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      12. sub-neg59.4%

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(x - 0.5\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      13. sub-neg59.4%

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      14. metadata-eval59.4%

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

        \[\leadsto \left(\left(y \cdot \color{blue}{\left(-0.5 + x\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
      16. fma-udef59.4%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{\left(-0.5 \cdot y + y \cdot -0.5\right)}\right) + 0.918938533204673 \]
      17. *-commutative59.4%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \left(\color{blue}{y \cdot -0.5} + y \cdot -0.5\right)\right) + 0.918938533204673 \]
      18. distribute-lft-out59.4%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{y \cdot \left(-0.5 + -0.5\right)}\right) + 0.918938533204673 \]
      19. metadata-eval59.4%

        \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + y \cdot \color{blue}{-1}\right) + 0.918938533204673 \]
      20. *-commutative59.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(1 + -1 \cdot \left(x - 0.5\right)\right) \cdot \left(-y\right)} + 0.918938533204673 \]
      4. sub-neg58.8%

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

        \[\leadsto \left(1 + -1 \cdot \left(x + \color{blue}{-0.5}\right)\right) \cdot \left(-y\right) + 0.918938533204673 \]
      6. mul-1-neg58.8%

        \[\leadsto \left(1 + \color{blue}{\left(-\left(x + -0.5\right)\right)}\right) \cdot \left(-y\right) + 0.918938533204673 \]
      7. unsub-neg58.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.91:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-15}:\\ \;\;\;\;0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 14: 25.1% 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. fma-neg100.0%

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673} \]
  4. Step-by-step derivation
    1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(x \cdot \left(y + -1\right) + \color{blue}{y \cdot -0.5}\right) + \mathsf{fma}\left(-0.5, y, 0.5 \cdot y\right)\right) + 0.918938533204673 \]
    13. fma-udef100.0%

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

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

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot 0.5}\right)\right) + 0.918938533204673 \]
    16. add-sqr-sqrt48.3%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot 0.5} \cdot \sqrt{y \cdot 0.5}}\right)\right) + 0.918938533204673 \]
    17. sqrt-unprod76.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{\left(y \cdot 0.5\right) \cdot \left(y \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
    18. swap-sqr76.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(0.5 \cdot 0.5\right)}}\right)\right) + 0.918938533204673 \]
    19. metadata-eval76.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{0.25}}\right)\right) + 0.918938533204673 \]
    20. metadata-eval76.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-0.5 \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
    21. swap-sqr76.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \sqrt{\color{blue}{\left(y \cdot -0.5\right) \cdot \left(y \cdot -0.5\right)}}\right)\right) + 0.918938533204673 \]
    22. sqrt-unprod40.6%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{\sqrt{y \cdot -0.5} \cdot \sqrt{y \cdot -0.5}}\right)\right) + 0.918938533204673 \]
    23. add-sqr-sqrt80.8%

      \[\leadsto \left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, \color{blue}{y \cdot -0.5}\right)\right) + 0.918938533204673 \]
  5. Applied egg-rr80.8%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right)} + 0.918938533204673 \]
  6. Step-by-step derivation
    1. fma-udef80.8%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(y + -1\right) + y \cdot -0.5\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    2. distribute-rgt-out80.8%

      \[\leadsto \left(\left(\color{blue}{\left(y \cdot x + -1 \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    3. neg-mul-180.8%

      \[\leadsto \left(\left(\left(y \cdot x + \color{blue}{\left(-x\right)}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    4. +-commutative80.8%

      \[\leadsto \left(\left(\color{blue}{\left(\left(-x\right) + y \cdot x\right)} + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    5. *-commutative80.8%

      \[\leadsto \left(\left(\left(\left(-x\right) + \color{blue}{x \cdot y}\right) + y \cdot -0.5\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    6. associate-+r+80.8%

      \[\leadsto \left(\color{blue}{\left(\left(-x\right) + \left(x \cdot y + y \cdot -0.5\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    7. *-commutative80.8%

      \[\leadsto \left(\left(\left(-x\right) + \left(\color{blue}{y \cdot x} + y \cdot -0.5\right)\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    8. distribute-lft-in80.8%

      \[\leadsto \left(\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    9. +-commutative80.8%

      \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    10. sub-neg80.8%

      \[\leadsto \left(\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)} + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    11. metadata-eval80.8%

      \[\leadsto \left(\left(y \cdot \left(x + \color{blue}{\left(-0.5\right)}\right) - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    12. sub-neg80.8%

      \[\leadsto \left(\left(y \cdot \color{blue}{\left(x - 0.5\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    13. sub-neg80.8%

      \[\leadsto \left(\left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    14. metadata-eval80.8%

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

      \[\leadsto \left(\left(y \cdot \color{blue}{\left(-0.5 + x\right)} - x\right) + \mathsf{fma}\left(-0.5, y, y \cdot -0.5\right)\right) + 0.918938533204673 \]
    16. fma-udef80.8%

      \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{\left(-0.5 \cdot y + y \cdot -0.5\right)}\right) + 0.918938533204673 \]
    17. *-commutative80.8%

      \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \left(\color{blue}{y \cdot -0.5} + y \cdot -0.5\right)\right) + 0.918938533204673 \]
    18. distribute-lft-out80.8%

      \[\leadsto \left(\left(y \cdot \left(-0.5 + x\right) - x\right) + \color{blue}{y \cdot \left(-0.5 + -0.5\right)}\right) + 0.918938533204673 \]
    19. metadata-eval80.8%

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

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(1 + -1 \cdot \left(x - 0.5\right)\right) \cdot y}\right) + 0.918938533204673 \]
    3. distribute-rgt-neg-in53.5%

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

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

      \[\leadsto \left(1 + -1 \cdot \left(x + \color{blue}{-0.5}\right)\right) \cdot \left(-y\right) + 0.918938533204673 \]
    6. mul-1-neg53.5%

      \[\leadsto \left(1 + \color{blue}{\left(-\left(x + -0.5\right)\right)}\right) \cdot \left(-y\right) + 0.918938533204673 \]
    7. unsub-neg53.5%

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

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

    \[\leadsto \color{blue}{0.918938533204673} \]
  12. Final simplification24.9%

    \[\leadsto 0.918938533204673 \]

Reproduce

?
herbie shell --seed 2023268 
(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))