Linear.Quaternion:$cexp from linear-1.19.1.3

Percentage Accurate: 99.8% → 99.8%
Time: 9.2s
Alternatives: 7
Speedup: 1.0×

Specification

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

\\
x \cdot \frac{\sin y}{y}
\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 7 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

\\
x \cdot \frac{\sin y}{y}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
x \cdot \frac{\sin y}{y}
\end{array}
Derivation
  1. Initial program 99.8%

    \[x \cdot \frac{\sin y}{y} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 58.1% accurate, 7.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.2e24

    1. Initial program 99.8%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{x + \frac{-1}{6} \cdot \left(x \cdot {y}^{2}\right)} \]
    4. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto x \cdot 1 + \color{blue}{\frac{-1}{6}} \cdot \left(x \cdot {y}^{2}\right) \]
      2. *-commutativeN/A

        \[\leadsto x \cdot 1 + \left(x \cdot {y}^{2}\right) \cdot \color{blue}{\frac{-1}{6}} \]
      3. associate-*l*N/A

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left({y}^{2} \cdot \frac{-1}{6}\right)} \]
      4. *-commutativeN/A

        \[\leadsto x \cdot 1 + x \cdot \left(\frac{-1}{6} \cdot \color{blue}{{y}^{2}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto x \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)}\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {y}^{2}\right)}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
      12. *-lowering-*.f6461.9%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
    5. Simplified61.9%

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

    if 1.2e24 < y

    1. Initial program 99.7%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{x + \frac{-1}{6} \cdot \left(x \cdot {y}^{2}\right)} \]
    4. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto x \cdot 1 + \color{blue}{\frac{-1}{6}} \cdot \left(x \cdot {y}^{2}\right) \]
      2. *-commutativeN/A

        \[\leadsto x \cdot 1 + \left(x \cdot {y}^{2}\right) \cdot \color{blue}{\frac{-1}{6}} \]
      3. associate-*l*N/A

        \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left({y}^{2} \cdot \frac{-1}{6}\right)} \]
      4. *-commutativeN/A

        \[\leadsto x \cdot 1 + x \cdot \left(\frac{-1}{6} \cdot \color{blue}{{y}^{2}}\right) \]
      5. distribute-lft-inN/A

        \[\leadsto x \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)}\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {y}^{2}\right)}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
      12. *-lowering-*.f642.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
    5. Simplified2.1%

      \[\leadsto \color{blue}{x \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{\color{blue}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}\right)}\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}}\right)\right)\right) \]
      5. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{y \cdot \left(y \cdot \frac{-1}{6}\right)}}\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f642.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.1%

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{1}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}} \]
    8. Taylor expanded in y around 0

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{1}{6} \cdot {y}^{2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right)}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({y}^{2}\right), \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(y \cdot y\right), \frac{1}{6}\right)\right)\right)\right) \]
      5. *-lowering-*.f6424.5%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
    10. Simplified24.5%

      \[\leadsto x \cdot \frac{1}{\color{blue}{1 + \left(y \cdot y\right) \cdot 0.16666666666666666}} \]
    11. Taylor expanded in y around inf

      \[\leadsto \color{blue}{6 \cdot \frac{x}{{y}^{2}}} \]
    12. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{6 \cdot x}{\color{blue}{{y}^{2}}} \]
      2. unpow2N/A

        \[\leadsto \frac{6 \cdot x}{y \cdot \color{blue}{y}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{6 \cdot x}{y}}{\color{blue}{y}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{6 \cdot x}{y}\right), \color{blue}{y}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(6 \cdot x\right), y\right), y\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot 6\right), y\right), y\right) \]
      7. *-lowering-*.f6424.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, 6\right), y\right), y\right) \]
    13. Simplified24.5%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot 6}{y}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 58.3% accurate, 8.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;x\\

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


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

    1. Initial program 99.8%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{x} \]
    4. Step-by-step derivation
      1. Simplified63.6%

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

      if 2.39999999999999991 < y

      1. Initial program 99.8%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x + \frac{-1}{6} \cdot \left(x \cdot {y}^{2}\right)} \]
      4. Step-by-step derivation
        1. *-rgt-identityN/A

          \[\leadsto x \cdot 1 + \color{blue}{\frac{-1}{6}} \cdot \left(x \cdot {y}^{2}\right) \]
        2. *-commutativeN/A

          \[\leadsto x \cdot 1 + \left(x \cdot {y}^{2}\right) \cdot \color{blue}{\frac{-1}{6}} \]
        3. associate-*l*N/A

          \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left({y}^{2} \cdot \frac{-1}{6}\right)} \]
        4. *-commutativeN/A

          \[\leadsto x \cdot 1 + x \cdot \left(\frac{-1}{6} \cdot \color{blue}{{y}^{2}}\right) \]
        5. distribute-lft-inN/A

          \[\leadsto x \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)} \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)}\right) \]
        7. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {y}^{2}\right)}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
        12. *-lowering-*.f642.6%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
      5. Simplified2.6%

        \[\leadsto \color{blue}{x \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)} \]
      6. Step-by-step derivation
        1. flip3-+N/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{\color{blue}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}\right)\right) \]
        2. clear-numN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}}}\right)\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}\right)}\right)\right) \]
        4. clear-numN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}}\right)\right)\right) \]
        5. flip3-+N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{y \cdot \left(y \cdot \frac{-1}{6}\right)}}\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right) \]
        7. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f642.6%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right)\right)\right) \]
      7. Applied egg-rr2.6%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{1}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}} \]
      8. Taylor expanded in y around 0

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{1}{6} \cdot {y}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right)}\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({y}^{2}\right), \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(y \cdot y\right), \frac{1}{6}\right)\right)\right)\right) \]
        5. *-lowering-*.f6422.6%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
      10. Simplified22.6%

        \[\leadsto x \cdot \frac{1}{\color{blue}{1 + \left(y \cdot y\right) \cdot 0.16666666666666666}} \]
      11. Taylor expanded in y around inf

        \[\leadsto \color{blue}{6 \cdot \frac{x}{{y}^{2}}} \]
      12. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{6 \cdot x}{\color{blue}{{y}^{2}}} \]
        2. unpow2N/A

          \[\leadsto \frac{6 \cdot x}{y \cdot \color{blue}{y}} \]
        3. associate-/r*N/A

          \[\leadsto \frac{\frac{6 \cdot x}{y}}{\color{blue}{y}} \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{6 \cdot x}{y}\right), \color{blue}{y}\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(6 \cdot x\right), y\right), y\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(x \cdot 6\right), y\right), y\right) \]
        7. *-lowering-*.f6422.6%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, 6\right), y\right), y\right) \]
      13. Simplified22.6%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot 6}{y}}{y}} \]
    5. Recombined 2 regimes into one program.
    6. Add Preprocessing

    Alternative 4: 58.3% accurate, 8.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.4:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{6}{y \cdot y}\\ \end{array} \end{array} \]
    (FPCore (x y) :precision binary64 (if (<= y 2.4) x (* x (/ 6.0 (* y y)))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 2.4) {
    		tmp = x;
    	} else {
    		tmp = x * (6.0 / (y * y));
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (y <= 2.4d0) then
            tmp = x
        else
            tmp = x * (6.0d0 / (y * y))
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= 2.4) {
    		tmp = x;
    	} else {
    		tmp = x * (6.0 / (y * y));
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= 2.4:
    		tmp = x
    	else:
    		tmp = x * (6.0 / (y * y))
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 2.4)
    		tmp = x;
    	else
    		tmp = Float64(x * Float64(6.0 / Float64(y * y)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= 2.4)
    		tmp = x;
    	else
    		tmp = x * (6.0 / (y * y));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, 2.4], x, N[(x * N[(6.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 2.4:\\
    \;\;\;\;x\\
    
    \mathbf{else}:\\
    \;\;\;\;x \cdot \frac{6}{y \cdot y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 2.39999999999999991

      1. Initial program 99.8%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x} \]
      4. Step-by-step derivation
        1. Simplified63.6%

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

        if 2.39999999999999991 < y

        1. Initial program 99.8%

          \[x \cdot \frac{\sin y}{y} \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto \color{blue}{x + \frac{-1}{6} \cdot \left(x \cdot {y}^{2}\right)} \]
        4. Step-by-step derivation
          1. *-rgt-identityN/A

            \[\leadsto x \cdot 1 + \color{blue}{\frac{-1}{6}} \cdot \left(x \cdot {y}^{2}\right) \]
          2. *-commutativeN/A

            \[\leadsto x \cdot 1 + \left(x \cdot {y}^{2}\right) \cdot \color{blue}{\frac{-1}{6}} \]
          3. associate-*l*N/A

            \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left({y}^{2} \cdot \frac{-1}{6}\right)} \]
          4. *-commutativeN/A

            \[\leadsto x \cdot 1 + x \cdot \left(\frac{-1}{6} \cdot \color{blue}{{y}^{2}}\right) \]
          5. distribute-lft-inN/A

            \[\leadsto x \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)} \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)}\right) \]
          7. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {y}^{2}\right)}\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
          12. *-lowering-*.f642.6%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
        5. Simplified2.6%

          \[\leadsto \color{blue}{x \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)} \]
        6. Step-by-step derivation
          1. flip3-+N/A

            \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{\color{blue}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}\right)\right) \]
          2. clear-numN/A

            \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}}}\right)\right) \]
          3. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}\right)}\right)\right) \]
          4. clear-numN/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}}\right)\right)\right) \]
          5. flip3-+N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{y \cdot \left(y \cdot \frac{-1}{6}\right)}}\right)\right)\right) \]
          6. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right) \]
          7. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right)\right) \]
          8. associate-*r*N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right) \]
          9. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f642.6%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right)\right)\right) \]
        7. Applied egg-rr2.6%

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{1}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}} \]
        8. Taylor expanded in y around 0

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{1}{6} \cdot {y}^{2}\right)}\right)\right) \]
        9. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right)}\right)\right)\right) \]
          2. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({y}^{2}\right), \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
          4. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(y \cdot y\right), \frac{1}{6}\right)\right)\right)\right) \]
          5. *-lowering-*.f6422.6%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
        10. Simplified22.6%

          \[\leadsto x \cdot \frac{1}{\color{blue}{1 + \left(y \cdot y\right) \cdot 0.16666666666666666}} \]
        11. Taylor expanded in y around inf

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{6}{{y}^{2}}\right)}\right) \]
        12. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(6, \color{blue}{\left({y}^{2}\right)}\right)\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(6, \left(y \cdot \color{blue}{y}\right)\right)\right) \]
          3. *-lowering-*.f6422.6%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
        13. Simplified22.6%

          \[\leadsto x \cdot \color{blue}{\frac{6}{y \cdot y}} \]
      5. Recombined 2 regimes into one program.
      6. Add Preprocessing

      Alternative 5: 64.2% accurate, 11.7× speedup?

      \[\begin{array}{l} \\ \frac{x}{1 + 0.16666666666666666 \cdot \left(y \cdot y\right)} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (/ x (+ 1.0 (* 0.16666666666666666 (* y y)))))
      double code(double x, double y) {
      	return x / (1.0 + (0.16666666666666666 * (y * y)));
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = x / (1.0d0 + (0.16666666666666666d0 * (y * y)))
      end function
      
      public static double code(double x, double y) {
      	return x / (1.0 + (0.16666666666666666 * (y * y)));
      }
      
      def code(x, y):
      	return x / (1.0 + (0.16666666666666666 * (y * y)))
      
      function code(x, y)
      	return Float64(x / Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))
      end
      
      function tmp = code(x, y)
      	tmp = x / (1.0 + (0.16666666666666666 * (y * y)));
      end
      
      code[x_, y_] := N[(x / N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \frac{x}{1 + 0.16666666666666666 \cdot \left(y \cdot y\right)}
      \end{array}
      
      Derivation
      1. Initial program 99.8%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x + \frac{-1}{6} \cdot \left(x \cdot {y}^{2}\right)} \]
      4. Step-by-step derivation
        1. *-rgt-identityN/A

          \[\leadsto x \cdot 1 + \color{blue}{\frac{-1}{6}} \cdot \left(x \cdot {y}^{2}\right) \]
        2. *-commutativeN/A

          \[\leadsto x \cdot 1 + \left(x \cdot {y}^{2}\right) \cdot \color{blue}{\frac{-1}{6}} \]
        3. associate-*l*N/A

          \[\leadsto x \cdot 1 + x \cdot \color{blue}{\left({y}^{2} \cdot \frac{-1}{6}\right)} \]
        4. *-commutativeN/A

          \[\leadsto x \cdot 1 + x \cdot \left(\frac{-1}{6} \cdot \color{blue}{{y}^{2}}\right) \]
        5. distribute-lft-inN/A

          \[\leadsto x \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)} \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + \frac{-1}{6} \cdot {y}^{2}\right)}\right) \]
        7. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {y}^{2}\right)}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(y \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
        12. *-lowering-*.f6447.7%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
      5. Simplified47.7%

        \[\leadsto \color{blue}{x \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)} \]
      6. Step-by-step derivation
        1. flip3-+N/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{\color{blue}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}\right)\right) \]
        2. clear-numN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{1}{\color{blue}{\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}}}\right)\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}\right)}\right)\right) \]
        4. clear-numN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{{1}^{3} + {\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}^{3}}{1 \cdot 1 + \left(\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right) - 1 \cdot \left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)\right)}}}\right)\right)\right) \]
        5. flip3-+N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \left(\frac{1}{1 + \color{blue}{y \cdot \left(y \cdot \frac{-1}{6}\right)}}\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right) \]
        7. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(y \cdot \frac{-1}{6}\right)\right)}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\left(y \cdot y\right) \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left(y \cdot y\right)}\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6447.7%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right)\right)\right) \]
      7. Applied egg-rr47.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{1}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}} \]
      8. Taylor expanded in y around 0

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{\left(1 + \frac{1}{6} \cdot {y}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right)}\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \left({y}^{2} \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({y}^{2}\right), \color{blue}{\frac{1}{6}}\right)\right)\right)\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(y \cdot y\right), \frac{1}{6}\right)\right)\right)\right) \]
        5. *-lowering-*.f6460.0%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
      10. Simplified60.0%

        \[\leadsto x \cdot \frac{1}{\color{blue}{1 + \left(y \cdot y\right) \cdot 0.16666666666666666}} \]
      11. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{x}{1 + \frac{1}{6} \cdot {y}^{2}}} \]
      12. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(1 + \frac{1}{6} \cdot {y}^{2}\right)}\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right)}\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({y}^{2}\right)}\right)\right)\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left(y \cdot \color{blue}{y}\right)\right)\right)\right) \]
        5. *-lowering-*.f6460.0%

          \[\leadsto \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right) \]
      13. Simplified60.0%

        \[\leadsto \color{blue}{\frac{x}{1 + 0.16666666666666666 \cdot \left(y \cdot y\right)}} \]
      14. Add Preprocessing

      Alternative 6: 58.2% accurate, 17.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.7 \cdot 10^{+42}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
      (FPCore (x y) :precision binary64 (if (<= y 2.7e+42) x 0.0))
      double code(double x, double y) {
      	double tmp;
      	if (y <= 2.7e+42) {
      		tmp = x;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (y <= 2.7d+42) then
              tmp = x
          else
              tmp = 0.0d0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= 2.7e+42) {
      		tmp = x;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      def code(x, y):
      	tmp = 0
      	if y <= 2.7e+42:
      		tmp = x
      	else:
      		tmp = 0.0
      	return tmp
      
      function code(x, y)
      	tmp = 0.0
      	if (y <= 2.7e+42)
      		tmp = x;
      	else
      		tmp = 0.0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= 2.7e+42)
      		tmp = x;
      	else
      		tmp = 0.0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_] := If[LessEqual[y, 2.7e+42], x, 0.0]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 2.7 \cdot 10^{+42}:\\
      \;\;\;\;x\\
      
      \mathbf{else}:\\
      \;\;\;\;0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 2.7000000000000001e42

        1. Initial program 99.8%

          \[x \cdot \frac{\sin y}{y} \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto \color{blue}{x} \]
        4. Step-by-step derivation
          1. Simplified61.0%

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

          if 2.7000000000000001e42 < y

          1. Initial program 99.8%

            \[x \cdot \frac{\sin y}{y} \]
          2. Add Preprocessing
          3. Applied egg-rr25.3%

            \[\leadsto \color{blue}{0} \]
        5. Recombined 2 regimes into one program.
        6. Add Preprocessing

        Alternative 7: 15.9% accurate, 105.0× speedup?

        \[\begin{array}{l} \\ 0 \end{array} \]
        (FPCore (x y) :precision binary64 0.0)
        double code(double x, double y) {
        	return 0.0;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = 0.0d0
        end function
        
        public static double code(double x, double y) {
        	return 0.0;
        }
        
        def code(x, y):
        	return 0.0
        
        function code(x, y)
        	return 0.0
        end
        
        function tmp = code(x, y)
        	tmp = 0.0;
        end
        
        code[x_, y_] := 0.0
        
        \begin{array}{l}
        
        \\
        0
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[x \cdot \frac{\sin y}{y} \]
        2. Add Preprocessing
        3. Applied egg-rr15.4%

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

        Reproduce

        ?
        herbie shell --seed 2024138 
        (FPCore (x y)
          :name "Linear.Quaternion:$cexp from linear-1.19.1.3"
          :precision binary64
          (* x (/ (sin y) y)))