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

Percentage Accurate: 100.0% → 100.0%
Time: 7.3s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 49.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.62:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{-173}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-233}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-165}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.85:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+94} \lor \neg \left(y \leq 3.2 \cdot 10^{+111}\right) \land y \leq 5.8 \cdot 10^{+169}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -0.62)
   (* y -0.5)
   (if (<= y -6.8e-173)
     (- x)
     (if (<= y -5.8e-233)
       0.918938533204673
       (if (<= y 8.6e-165)
         (- x)
         (if (<= y 1.85)
           0.918938533204673
           (if (or (<= y 2.2e+94) (and (not (<= y 3.2e+111)) (<= y 5.8e+169)))
             (* y -0.5)
             (* x y))))))))
double code(double x, double y) {
	double tmp;
	if (y <= -0.62) {
		tmp = y * -0.5;
	} else if (y <= -6.8e-173) {
		tmp = -x;
	} else if (y <= -5.8e-233) {
		tmp = 0.918938533204673;
	} else if (y <= 8.6e-165) {
		tmp = -x;
	} else if (y <= 1.85) {
		tmp = 0.918938533204673;
	} else if ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169))) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-0.62d0)) then
        tmp = y * (-0.5d0)
    else if (y <= (-6.8d-173)) then
        tmp = -x
    else if (y <= (-5.8d-233)) then
        tmp = 0.918938533204673d0
    else if (y <= 8.6d-165) then
        tmp = -x
    else if (y <= 1.85d0) then
        tmp = 0.918938533204673d0
    else if ((y <= 2.2d+94) .or. (.not. (y <= 3.2d+111)) .and. (y <= 5.8d+169)) then
        tmp = y * (-0.5d0)
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -0.62) {
		tmp = y * -0.5;
	} else if (y <= -6.8e-173) {
		tmp = -x;
	} else if (y <= -5.8e-233) {
		tmp = 0.918938533204673;
	} else if (y <= 8.6e-165) {
		tmp = -x;
	} else if (y <= 1.85) {
		tmp = 0.918938533204673;
	} else if ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169))) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -0.62:
		tmp = y * -0.5
	elif y <= -6.8e-173:
		tmp = -x
	elif y <= -5.8e-233:
		tmp = 0.918938533204673
	elif y <= 8.6e-165:
		tmp = -x
	elif y <= 1.85:
		tmp = 0.918938533204673
	elif (y <= 2.2e+94) or (not (y <= 3.2e+111) and (y <= 5.8e+169)):
		tmp = y * -0.5
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -0.62)
		tmp = Float64(y * -0.5);
	elseif (y <= -6.8e-173)
		tmp = Float64(-x);
	elseif (y <= -5.8e-233)
		tmp = 0.918938533204673;
	elseif (y <= 8.6e-165)
		tmp = Float64(-x);
	elseif (y <= 1.85)
		tmp = 0.918938533204673;
	elseif ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169)))
		tmp = Float64(y * -0.5);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -0.62)
		tmp = y * -0.5;
	elseif (y <= -6.8e-173)
		tmp = -x;
	elseif (y <= -5.8e-233)
		tmp = 0.918938533204673;
	elseif (y <= 8.6e-165)
		tmp = -x;
	elseif (y <= 1.85)
		tmp = 0.918938533204673;
	elseif ((y <= 2.2e+94) || (~((y <= 3.2e+111)) && (y <= 5.8e+169)))
		tmp = y * -0.5;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -0.62], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -6.8e-173], (-x), If[LessEqual[y, -5.8e-233], 0.918938533204673, If[LessEqual[y, 8.6e-165], (-x), If[LessEqual[y, 1.85], 0.918938533204673, If[Or[LessEqual[y, 2.2e+94], And[N[Not[LessEqual[y, 3.2e+111]], $MachinePrecision], LessEqual[y, 5.8e+169]]], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.62:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -6.8 \cdot 10^{-173}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq -5.8 \cdot 10^{-233}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{-165}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{+94} \lor \neg \left(y \leq 3.2 \cdot 10^{+111}\right) \land y \leq 5.8 \cdot 10^{+169}:\\
\;\;\;\;y \cdot -0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -0.619999999999999996 or 1.8500000000000001 < y < 2.20000000000000012e94 or 3.2000000000000001e111 < y < 5.8000000000000001e169

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. add-cube-cbrt99.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{x \cdot \left(y + -1\right)}\right)}^{3}} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    5. Applied egg-rr99.6%

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

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified56.7%

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

    if -0.619999999999999996 < y < -6.7999999999999997e-173 or -5.79999999999999964e-233 < y < 8.60000000000000013e-165

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. associate--r-100.0%

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

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

        \[\leadsto \frac{{\left(x \cdot \left(y + -1\right) - \color{blue}{0.5 \cdot y}\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      4. cancel-sign-sub-inv55.9%

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + \left(-0.5\right) \cdot y\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      5. fma-def55.9%

        \[\leadsto \frac{{\color{blue}{\left(\mathsf{fma}\left(x, y + -1, \left(-0.5\right) \cdot y\right)\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      6. metadata-eval55.9%

        \[\leadsto \frac{{\left(\mathsf{fma}\left(x, y + -1, \color{blue}{-0.5} \cdot y\right)\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      7. metadata-eval55.9%

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

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

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

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + -0.5 \cdot y\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      2. distribute-lft-in56.0%

        \[\leadsto \frac{{\left(\color{blue}{\left(x \cdot y + x \cdot -1\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      3. *-commutative56.0%

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

        \[\leadsto \frac{{\left(\left(x \cdot y + \color{blue}{\left(-x\right)}\right) + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      5. +-commutative56.0%

        \[\leadsto \frac{{\left(\color{blue}{\left(\left(-x\right) + x \cdot y\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      6. associate-+r+56.0%

        \[\leadsto \frac{{\color{blue}{\left(\left(-x\right) + \left(x \cdot y + -0.5 \cdot y\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      7. distribute-rgt-in56.0%

        \[\leadsto \frac{{\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      8. +-commutative56.0%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      9. sub-neg56.0%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
    7. Simplified56.0%

      \[\leadsto \color{blue}{\frac{{\left(y \cdot \left(x + -0.5\right) - x\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(y \cdot \left(x + -0.5\right) - x, y \cdot \left(x + -0.5\right) - x, 0.8444480278083559 + 0.918938533204673 \cdot \left(x - y \cdot \left(x + -0.5\right)\right)\right)}} \]
    8. Taylor expanded in y around 0 55.6%

      \[\leadsto \color{blue}{\frac{-1 \cdot {x}^{3} + 0.7759958320417895}{0.8444480278083559 + \left(0.918938533204673 \cdot x + {x}^{2}\right)}} \]
    9. Step-by-step derivation
      1. +-commutative55.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    13. Simplified63.2%

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

    if -6.7999999999999997e-173 < y < -5.79999999999999964e-233 or 8.60000000000000013e-165 < y < 1.8500000000000001

    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. associate-+l-99.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(-1\right) + y}, -\left(y \cdot 0.5 - 0.918938533204673\right)\right) \]
      5. remove-double-neg99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Taylor expanded in x around 0 70.8%

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

    if 2.20000000000000012e94 < y < 3.2000000000000001e111 or 5.8000000000000001e169 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 inf 66.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.62:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{-173}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-233}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-165}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.85:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+94} \lor \neg \left(y \leq 3.2 \cdot 10^{+111}\right) \land y \leq 5.8 \cdot 10^{+169}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 3: 73.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.9:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 1.85:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+93} \lor \neg \left(y \leq 1.35 \cdot 10^{+116}\right) \land y \leq 10^{+168}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -6.9)
   (* y -0.5)
   (if (<= y 1.85)
     (- 0.918938533204673 x)
     (if (or (<= y 1.1e+93) (and (not (<= y 1.35e+116)) (<= y 1e+168)))
       (* y -0.5)
       (* x y)))))
double code(double x, double y) {
	double tmp;
	if (y <= -6.9) {
		tmp = y * -0.5;
	} else if (y <= 1.85) {
		tmp = 0.918938533204673 - x;
	} else if ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168))) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-6.9d0)) then
        tmp = y * (-0.5d0)
    else if (y <= 1.85d0) then
        tmp = 0.918938533204673d0 - x
    else if ((y <= 1.1d+93) .or. (.not. (y <= 1.35d+116)) .and. (y <= 1d+168)) then
        tmp = y * (-0.5d0)
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -6.9) {
		tmp = y * -0.5;
	} else if (y <= 1.85) {
		tmp = 0.918938533204673 - x;
	} else if ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168))) {
		tmp = y * -0.5;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -6.9:
		tmp = y * -0.5
	elif y <= 1.85:
		tmp = 0.918938533204673 - x
	elif (y <= 1.1e+93) or (not (y <= 1.35e+116) and (y <= 1e+168)):
		tmp = y * -0.5
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -6.9)
		tmp = Float64(y * -0.5);
	elseif (y <= 1.85)
		tmp = Float64(0.918938533204673 - x);
	elseif ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168)))
		tmp = Float64(y * -0.5);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -6.9)
		tmp = y * -0.5;
	elseif (y <= 1.85)
		tmp = 0.918938533204673 - x;
	elseif ((y <= 1.1e+93) || (~((y <= 1.35e+116)) && (y <= 1e+168)))
		tmp = y * -0.5;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -6.9], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 1.1e+93], And[N[Not[LessEqual[y, 1.35e+116]], $MachinePrecision], LessEqual[y, 1e+168]]], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.9:\\
\;\;\;\;y \cdot -0.5\\

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

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+93} \lor \neg \left(y \leq 1.35 \cdot 10^{+116}\right) \land y \leq 10^{+168}:\\
\;\;\;\;y \cdot -0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.9000000000000004 or 1.8500000000000001 < y < 1.10000000000000011e93 or 1.35e116 < y < 9.9999999999999993e167

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. add-cube-cbrt99.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{x \cdot \left(y + -1\right)}\right)}^{3}} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    5. Applied egg-rr99.6%

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

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

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified56.7%

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

    if -6.9000000000000004 < y < 1.8500000000000001

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 0 98.9%

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

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

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

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

    if 1.10000000000000011e93 < y < 1.35e116 or 9.9999999999999993e167 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 inf 66.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.9:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 1.85:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+93} \lor \neg \left(y \leq 1.35 \cdot 10^{+116}\right) \land y \leq 10^{+168}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 4: 49.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0132:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -1.2 \cdot 10^{-172}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq -7.6 \cdot 10^{-233}:\\
\;\;\;\;0.918938533204673\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-165}:\\
\;\;\;\;-x\\

\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.0132 or 1.8500000000000001 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. add-cube-cbrt99.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{x \cdot \left(y + -1\right)}\right)}^{3}} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    5. Applied egg-rr99.6%

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

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

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

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

    if -0.0132 < y < -1.2e-172 or -7.5999999999999999e-233 < y < 3.80000000000000018e-165

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. associate--r-100.0%

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

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

        \[\leadsto \frac{{\left(x \cdot \left(y + -1\right) - \color{blue}{0.5 \cdot y}\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      4. cancel-sign-sub-inv55.9%

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + \left(-0.5\right) \cdot y\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      5. fma-def55.9%

        \[\leadsto \frac{{\color{blue}{\left(\mathsf{fma}\left(x, y + -1, \left(-0.5\right) \cdot y\right)\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      6. metadata-eval55.9%

        \[\leadsto \frac{{\left(\mathsf{fma}\left(x, y + -1, \color{blue}{-0.5} \cdot y\right)\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      7. metadata-eval55.9%

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

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

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

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + -0.5 \cdot y\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      2. distribute-lft-in56.0%

        \[\leadsto \frac{{\left(\color{blue}{\left(x \cdot y + x \cdot -1\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      3. *-commutative56.0%

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

        \[\leadsto \frac{{\left(\left(x \cdot y + \color{blue}{\left(-x\right)}\right) + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      5. +-commutative56.0%

        \[\leadsto \frac{{\left(\color{blue}{\left(\left(-x\right) + x \cdot y\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      6. associate-+r+56.0%

        \[\leadsto \frac{{\color{blue}{\left(\left(-x\right) + \left(x \cdot y + -0.5 \cdot y\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      7. distribute-rgt-in56.0%

        \[\leadsto \frac{{\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      8. +-commutative56.0%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      9. sub-neg56.0%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
    7. Simplified56.0%

      \[\leadsto \color{blue}{\frac{{\left(y \cdot \left(x + -0.5\right) - x\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(y \cdot \left(x + -0.5\right) - x, y \cdot \left(x + -0.5\right) - x, 0.8444480278083559 + 0.918938533204673 \cdot \left(x - y \cdot \left(x + -0.5\right)\right)\right)}} \]
    8. Taylor expanded in y around 0 55.6%

      \[\leadsto \color{blue}{\frac{-1 \cdot {x}^{3} + 0.7759958320417895}{0.8444480278083559 + \left(0.918938533204673 \cdot x + {x}^{2}\right)}} \]
    9. Step-by-step derivation
      1. +-commutative55.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    13. Simplified63.2%

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

    if -1.2e-172 < y < -7.5999999999999999e-233 or 3.80000000000000018e-165 < y < 1.8500000000000001

    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. associate-+l-99.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(-1\right) + y}, -\left(y \cdot 0.5 - 0.918938533204673\right)\right) \]
      5. remove-double-neg99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Taylor expanded in x around 0 70.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.0132:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-172}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -7.6 \cdot 10^{-233}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-165}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.85:\\ \;\;\;\;0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;y \cdot -0.5\\ \end{array} \]

Alternative 5: 98.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-6} \lor \neg \left(y \leq 8 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.34999999999999995e-6 or 7.9999999999999996e-7 < 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. fma-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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.2%

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

    if -2.34999999999999995e-6 < y < 7.9999999999999996e-7

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 0 98.9%

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

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

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

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

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

Alternative 6: 97.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 97.2%

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

    if -1.5 < y < 1.26000000000000001

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 0 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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.9%

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

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

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

Alternative 7: 97.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 97.7%

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

    if -1.32000000000000006 < y < 1.26000000000000001

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 0 98.9%

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

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

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

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

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

Alternative 8: 49.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.92:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq 0.92:\\ \;\;\;\;0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -0.92) (- x) (if (<= x 0.92) 0.918938533204673 (- x))))
double code(double x, double y) {
	double tmp;
	if (x <= -0.92) {
		tmp = -x;
	} else if (x <= 0.92) {
		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.92d0)) then
        tmp = -x
    else if (x <= 0.92d0) 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.92) {
		tmp = -x;
	} else if (x <= 0.92) {
		tmp = 0.918938533204673;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -0.92:
		tmp = -x
	elif x <= 0.92:
		tmp = 0.918938533204673
	else:
		tmp = -x
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -0.92)
		tmp = Float64(-x);
	elseif (x <= 0.92)
		tmp = 0.918938533204673;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.92)
		tmp = -x;
	elseif (x <= 0.92)
		tmp = 0.918938533204673;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -0.92], (-x), If[LessEqual[x, 0.92], 0.918938533204673, (-x)]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.92000000000000004 or 0.92000000000000004 < 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. associate-+l-100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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. Step-by-step derivation
      1. associate--r-100.0%

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

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

        \[\leadsto \frac{{\left(x \cdot \left(y + -1\right) - \color{blue}{0.5 \cdot y}\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      4. cancel-sign-sub-inv19.8%

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + \left(-0.5\right) \cdot y\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      5. fma-def19.8%

        \[\leadsto \frac{{\color{blue}{\left(\mathsf{fma}\left(x, y + -1, \left(-0.5\right) \cdot y\right)\right)}}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      6. metadata-eval19.8%

        \[\leadsto \frac{{\left(\mathsf{fma}\left(x, y + -1, \color{blue}{-0.5} \cdot y\right)\right)}^{3} + {0.918938533204673}^{3}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      7. metadata-eval19.8%

        \[\leadsto \frac{{\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right)\right)}^{3} + \color{blue}{0.7759958320417895}}{\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + \left(0.918938533204673 \cdot 0.918938533204673 - \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) \cdot 0.918938533204673\right)} \]
      8. fma-def19.8%

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

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

        \[\leadsto \frac{{\color{blue}{\left(x \cdot \left(y + -1\right) + -0.5 \cdot y\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      2. distribute-lft-in19.8%

        \[\leadsto \frac{{\left(\color{blue}{\left(x \cdot y + x \cdot -1\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      3. *-commutative19.8%

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

        \[\leadsto \frac{{\left(\left(x \cdot y + \color{blue}{\left(-x\right)}\right) + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      5. +-commutative19.8%

        \[\leadsto \frac{{\left(\color{blue}{\left(\left(-x\right) + x \cdot y\right)} + -0.5 \cdot y\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      6. associate-+r+19.8%

        \[\leadsto \frac{{\color{blue}{\left(\left(-x\right) + \left(x \cdot y + -0.5 \cdot y\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      7. distribute-rgt-in19.8%

        \[\leadsto \frac{{\left(\left(-x\right) + \color{blue}{y \cdot \left(x + -0.5\right)}\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      8. +-commutative19.8%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) + \left(-x\right)\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
      9. sub-neg19.8%

        \[\leadsto \frac{{\color{blue}{\left(y \cdot \left(x + -0.5\right) - x\right)}}^{3} + 0.7759958320417895}{\mathsf{fma}\left(\mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right), 0.8444480278083559 - \mathsf{fma}\left(x, y + -1, -0.5 \cdot y\right) \cdot 0.918938533204673\right)} \]
    7. Simplified19.8%

      \[\leadsto \color{blue}{\frac{{\left(y \cdot \left(x + -0.5\right) - x\right)}^{3} + 0.7759958320417895}{\mathsf{fma}\left(y \cdot \left(x + -0.5\right) - x, y \cdot \left(x + -0.5\right) - x, 0.8444480278083559 + 0.918938533204673 \cdot \left(x - y \cdot \left(x + -0.5\right)\right)\right)}} \]
    8. Taylor expanded in y around 0 19.9%

      \[\leadsto \color{blue}{\frac{-1 \cdot {x}^{3} + 0.7759958320417895}{0.8444480278083559 + \left(0.918938533204673 \cdot x + {x}^{2}\right)}} \]
    9. Step-by-step derivation
      1. +-commutative19.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    13. Simplified51.3%

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

    if -0.92000000000000004 < x < 0.92000000000000004

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      11. 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 0 51.8%

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

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

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

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Taylor expanded in x around 0 49.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.92:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq 0.92:\\ \;\;\;\;0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 9: 26.2% 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. associate-+l-100.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    11. 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 0 51.9%

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

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

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

    \[\leadsto \color{blue}{0.918938533204673 - x} \]
  7. Taylor expanded in x around 0 26.8%

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

    \[\leadsto 0.918938533204673 \]

Reproduce

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