Linear.Quaternion:$cexp from linear-1.19.1.3

Percentage Accurate: 99.8% → 99.8%
Time: 11.5s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 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: 57.2% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \frac{x}{\mathsf{fma}\left(y, -0.16666666666666666, \frac{-1}{y}\right)}}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 3200.0)
   (fma
    (* y y)
    (*
     x
     (fma
      (* y y)
      (fma (* y y) -0.0001984126984126984 0.008333333333333333)
      -0.16666666666666666))
    x)
   (/ (- 0.0 (/ x (fma y -0.16666666666666666 (/ -1.0 y)))) y)))
double code(double x, double y) {
	double tmp;
	if (y <= 3200.0) {
		tmp = fma((y * y), (x * fma((y * y), fma((y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), x);
	} else {
		tmp = (0.0 - (x / fma(y, -0.16666666666666666, (-1.0 / y)))) / y;
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (y <= 3200.0)
		tmp = fma(Float64(y * y), Float64(x * fma(Float64(y * y), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), x);
	else
		tmp = Float64(Float64(0.0 - Float64(x / fma(y, -0.16666666666666666, Float64(-1.0 / y)))) / y);
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, 3200.0], N[(N[(y * y), $MachinePrecision] * N[(x * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(0.0 - N[(x / N[(y * -0.16666666666666666 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3200:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{0 - \frac{x}{\mathsf{fma}\left(y, -0.16666666666666666, \frac{-1}{y}\right)}}{y}\\


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

    1. Initial program 99.9%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
      2. associate-/r/N/A

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
      4. /-lowering-/.f64N/A

        \[\leadsto x \cdot \left(\color{blue}{\frac{1}{y}} \cdot \sin y\right) \]
      5. sin-lowering-sin.f6499.7

        \[\leadsto x \cdot \left(\frac{1}{y} \cdot \color{blue}{\sin y}\right) \]
    4. Applied egg-rr99.7%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot x + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left(x \cdot {y}^{2}\right) + \frac{1}{120} \cdot x\right), x\right)} \]
    7. Simplified70.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)} \]

    if 3200 < y

    1. Initial program 99.7%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
      2. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{\sin y}}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{\frac{\sin y}{y}}}} \]
      4. frac-2negN/A

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{\frac{\mathsf{neg}\left(\sin y\right)}{\mathsf{neg}\left(y\right)}}}} \]
      5. associate-/r/N/A

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

        \[\leadsto \color{blue}{\frac{\frac{x}{\frac{1}{\mathsf{neg}\left(\sin y\right)}}}{\mathsf{neg}\left(y\right)}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{\frac{1}{\mathsf{neg}\left(\sin y\right)}}}{\mathsf{neg}\left(y\right)}} \]
      8. /-lowering-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{1}{\mathsf{neg}\left(\sin y\right)}}}}{\mathsf{neg}\left(y\right)} \]
      9. frac-2negN/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}}}{\mathsf{neg}\left(y\right)} \]
      10. metadata-evalN/A

        \[\leadsto \frac{\frac{x}{\frac{\color{blue}{-1}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}}{\mathsf{neg}\left(y\right)} \]
      11. remove-double-negN/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{\color{blue}{\sin y}}}}{\mathsf{neg}\left(y\right)} \]
      12. /-lowering-/.f64N/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\frac{-1}{\sin y}}}}{\mathsf{neg}\left(y\right)} \]
      13. sin-lowering-sin.f64N/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{\color{blue}{\sin y}}}}{\mathsf{neg}\left(y\right)} \]
      14. neg-sub0N/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{\sin y}}}{\color{blue}{0 - y}} \]
      15. --lowering--.f6499.5

        \[\leadsto \frac{\frac{x}{\frac{-1}{\sin y}}}{\color{blue}{0 - y}} \]
    4. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{-1}{\sin y}}}{0 - y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto \frac{\frac{x}{\color{blue}{\frac{\frac{-1}{6} \cdot {y}^{2} - 1}{y}}}}{0 - y} \]
    6. Step-by-step derivation
      1. div-subN/A

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

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

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

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(\frac{-1}{6} \cdot y\right) \cdot \frac{y}{y}} - \frac{1}{y}}}{0 - y} \]
      5. *-inversesN/A

        \[\leadsto \frac{\frac{x}{\left(\frac{-1}{6} \cdot y\right) \cdot \color{blue}{1} - \frac{1}{y}}}{0 - y} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\frac{-1}{6} \cdot y} - \frac{1}{y}}}{0 - y} \]
      7. *-inversesN/A

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

        \[\leadsto \frac{\frac{x}{\frac{-1}{6} \cdot y - \color{blue}{\frac{y}{y \cdot y}}}}{0 - y} \]
      9. unpow2N/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{6} \cdot y - \frac{y}{\color{blue}{{y}^{2}}}}}{0 - y} \]
      10. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{6} \cdot y - \frac{\color{blue}{y \cdot 1}}{{y}^{2}}}}{0 - y} \]
      11. associate-/l*N/A

        \[\leadsto \frac{\frac{x}{\frac{-1}{6} \cdot y - \color{blue}{y \cdot \frac{1}{{y}^{2}}}}}{0 - y} \]
      12. sub-negN/A

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

        \[\leadsto \frac{\frac{x}{\color{blue}{y \cdot \frac{-1}{6}} + \left(\mathsf{neg}\left(y \cdot \frac{1}{{y}^{2}}\right)\right)}}{0 - y} \]
      14. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{\frac{x}{\color{blue}{\mathsf{fma}\left(y, \frac{-1}{6}, y \cdot \left(\mathsf{neg}\left(\frac{1}{{y}^{2}}\right)\right)\right)}}}{0 - y} \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \color{blue}{\mathsf{neg}\left(y \cdot \frac{1}{{y}^{2}}\right)}\right)}}{0 - y} \]
      17. associate-/l*N/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \mathsf{neg}\left(\color{blue}{\frac{y \cdot 1}{{y}^{2}}}\right)\right)}}{0 - y} \]
      18. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \mathsf{neg}\left(\frac{\color{blue}{y}}{{y}^{2}}\right)\right)}}{0 - y} \]
      19. unpow2N/A

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

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \mathsf{neg}\left(\color{blue}{\frac{\frac{y}{y}}{y}}\right)\right)}}{0 - y} \]
      21. *-inversesN/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \mathsf{neg}\left(\frac{\color{blue}{1}}{y}\right)\right)}}{0 - y} \]
      22. distribute-neg-fracN/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \color{blue}{\frac{\mathsf{neg}\left(1\right)}{y}}\right)}}{0 - y} \]
      23. metadata-evalN/A

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, \frac{-1}{6}, \frac{\color{blue}{-1}}{y}\right)}}{0 - y} \]
      24. /-lowering-/.f6424.5

        \[\leadsto \frac{\frac{x}{\mathsf{fma}\left(y, -0.16666666666666666, \color{blue}{\frac{-1}{y}}\right)}}{0 - y} \]
    7. Simplified24.5%

      \[\leadsto \frac{\frac{x}{\color{blue}{\mathsf{fma}\left(y, -0.16666666666666666, \frac{-1}{y}\right)}}}{0 - y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \frac{x}{\mathsf{fma}\left(y, -0.16666666666666666, \frac{-1}{y}\right)}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 56.9% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{y}{x}}{y}}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 3200.0)
   (fma
    (* y y)
    (*
     x
     (fma
      (* y y)
      (fma (* y y) -0.0001984126984126984 0.008333333333333333)
      -0.16666666666666666))
    x)
   (/ 1.0 (/ (/ y x) y))))
double code(double x, double y) {
	double tmp;
	if (y <= 3200.0) {
		tmp = fma((y * y), (x * fma((y * y), fma((y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), x);
	} else {
		tmp = 1.0 / ((y / x) / y);
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (y <= 3200.0)
		tmp = fma(Float64(y * y), Float64(x * fma(Float64(y * y), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), x);
	else
		tmp = Float64(1.0 / Float64(Float64(y / x) / y));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, 3200.0], N[(N[(y * y), $MachinePrecision] * N[(x * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(1.0 / N[(N[(y / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3200:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{y}{x}}{y}}\\


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

    1. Initial program 99.9%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
      2. associate-/r/N/A

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
      4. /-lowering-/.f64N/A

        \[\leadsto x \cdot \left(\color{blue}{\frac{1}{y}} \cdot \sin y\right) \]
      5. sin-lowering-sin.f6499.7

        \[\leadsto x \cdot \left(\frac{1}{y} \cdot \color{blue}{\sin y}\right) \]
    4. Applied egg-rr99.7%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot x + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left(x \cdot {y}^{2}\right) + \frac{1}{120} \cdot x\right), x\right)} \]
    7. Simplified70.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot y, x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), x\right)} \]

    if 3200 < y

    1. Initial program 99.7%

      \[x \cdot \frac{\sin y}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
      2. clear-numN/A

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

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

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x \cdot \sin y\right)} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot \sin y\right)} \]
      7. sin-lowering-sin.f6499.4

        \[\leadsto \frac{1}{y} \cdot \left(x \cdot \color{blue}{\sin y}\right) \]
    4. Applied egg-rr99.4%

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

      \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot y\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      2. *-lowering-*.f644.2

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
    7. Simplified4.2%

      \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{y} \cdot x\right) \cdot y} \]
      3. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \cdot y \]
      4. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{y}{x}}} \]
      5. *-lft-identityN/A

        \[\leadsto \frac{\color{blue}{y}}{\frac{y}{x}} \]
      6. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{y}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{y}}} \]
      8. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{y}}} \]
      9. /-lowering-/.f6423.6

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{y}{x}}}{y}} \]
    9. Applied egg-rr23.6%

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

Alternative 4: 63.3% accurate, 2.9× speedup?

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

\\
x \cdot \frac{-1}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 0\right), -1\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 + {y}^{2} \cdot \left(\frac{-1}{6} \cdot x + \frac{1}{120} \cdot \left(x \cdot {y}^{2}\right)\right)} \]
  4. Step-by-step derivation
    1. *-rgt-identityN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot 1 + x \cdot \left({y}^{2} \cdot \left(\frac{1}{120} \cdot {y}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right) \]
    13. sub-negN/A

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

    \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(\mathsf{fma}\left(y, y, 0\right), \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 1\right)} \]
  6. Applied egg-rr53.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y, y, 0\right), \mathsf{fma}\left(y, y, 0\right), 0\right), \mathsf{fma}\left(\mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 0\right), -1\right) \cdot \left(\frac{1}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 0\right), -1\right)} \cdot x\right)} \]
  7. Taylor expanded in y around 0

    \[\leadsto \color{blue}{-1} \cdot \left(\frac{1}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \frac{1}{120}, 0\right), \frac{-1}{6}\right), 0\right), -1\right)} \cdot x\right) \]
  8. Step-by-step derivation
    1. Simplified64.0%

      \[\leadsto \color{blue}{-1} \cdot \left(\frac{1}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 0\right), -1\right)} \cdot x\right) \]
    2. Final simplification64.0%

      \[\leadsto x \cdot \frac{-1}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, 0.008333333333333333, 0\right), -0.16666666666666666\right), 0\right), -1\right)} \]
    3. Add Preprocessing

    Alternative 5: 56.9% accurate, 2.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.5:\\ \;\;\;\;\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{y}{x}}{y}}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y 4.5)
       (fma
        y
        (* y (* x (fma (* y y) 0.008333333333333333 -0.16666666666666666)))
        x)
       (/ 1.0 (/ (/ y x) y))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 4.5) {
    		tmp = fma(y, (y * (x * fma((y * y), 0.008333333333333333, -0.16666666666666666))), x);
    	} else {
    		tmp = 1.0 / ((y / x) / y);
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 4.5)
    		tmp = fma(y, Float64(y * Float64(x * fma(Float64(y * y), 0.008333333333333333, -0.16666666666666666))), x);
    	else
    		tmp = Float64(1.0 / Float64(Float64(y / x) / y));
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, 4.5], N[(y * N[(y * N[(x * N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(1.0 / N[(N[(y / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 4.5:\\
    \;\;\;\;\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{\frac{y}{x}}{y}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 4.5

      1. Initial program 99.9%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
        2. associate-/r/N/A

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

          \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
        4. /-lowering-/.f64N/A

          \[\leadsto x \cdot \left(\color{blue}{\frac{1}{y}} \cdot \sin y\right) \]
        5. sin-lowering-sin.f6499.7

          \[\leadsto x \cdot \left(\frac{1}{y} \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.7%

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
      5. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \color{blue}{\left(x \cdot \frac{1}{y}\right) \cdot \sin y} \]
        2. div-invN/A

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

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

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        5. *-commutativeN/A

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

          \[\leadsto \frac{\color{blue}{\sin y \cdot x}}{y} \]
        7. sin-lowering-sin.f6489.7

          \[\leadsto \frac{\color{blue}{\sin y} \cdot x}{y} \]
      6. Applied egg-rr89.7%

        \[\leadsto \color{blue}{\frac{\sin y \cdot x}{y}} \]
      7. Taylor expanded in y around 0

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(y, \left(\frac{-1}{6} \cdot x + \frac{1}{120} \cdot \left(x \cdot {y}^{2}\right)\right) \cdot y, x\right)} \]
      9. Simplified70.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)} \]

      if 4.5 < y

      1. Initial program 99.7%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        2. clear-numN/A

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

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

          \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x \cdot \sin y\right)} \]
        5. /-lowering-/.f64N/A

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

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot \sin y\right)} \]
        7. sin-lowering-sin.f6499.4

          \[\leadsto \frac{1}{y} \cdot \left(x \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.4%

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

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot y\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
        2. *-lowering-*.f644.2

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      7. Simplified4.2%

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(\frac{1}{y} \cdot x\right) \cdot y} \]
        3. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \cdot y \]
        4. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{y}{x}}} \]
        5. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{y}}{\frac{y}{x}} \]
        6. clear-numN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{y}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{y}}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{y}}} \]
        9. /-lowering-/.f6423.6

          \[\leadsto \frac{1}{\frac{\color{blue}{\frac{y}{x}}}{y}} \]
      9. Applied egg-rr23.6%

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

    Alternative 6: 56.9% accurate, 3.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.5:\\ \;\;\;\;\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y 4.5)
       (fma
        y
        (* y (* x (fma (* y y) 0.008333333333333333 -0.16666666666666666)))
        x)
       (/ y (/ y x))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 4.5) {
    		tmp = fma(y, (y * (x * fma((y * y), 0.008333333333333333, -0.16666666666666666))), x);
    	} else {
    		tmp = y / (y / x);
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 4.5)
    		tmp = fma(y, Float64(y * Float64(x * fma(Float64(y * y), 0.008333333333333333, -0.16666666666666666))), x);
    	else
    		tmp = Float64(y / Float64(y / x));
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, 4.5], N[(y * N[(y * N[(x * N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 4.5:\\
    \;\;\;\;\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{\frac{y}{x}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 4.5

      1. Initial program 99.9%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
        2. associate-/r/N/A

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

          \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
        4. /-lowering-/.f64N/A

          \[\leadsto x \cdot \left(\color{blue}{\frac{1}{y}} \cdot \sin y\right) \]
        5. sin-lowering-sin.f6499.7

          \[\leadsto x \cdot \left(\frac{1}{y} \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.7%

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
      5. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \color{blue}{\left(x \cdot \frac{1}{y}\right) \cdot \sin y} \]
        2. div-invN/A

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

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

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        5. *-commutativeN/A

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

          \[\leadsto \frac{\color{blue}{\sin y \cdot x}}{y} \]
        7. sin-lowering-sin.f6489.7

          \[\leadsto \frac{\color{blue}{\sin y} \cdot x}{y} \]
      6. Applied egg-rr89.7%

        \[\leadsto \color{blue}{\frac{\sin y \cdot x}{y}} \]
      7. Taylor expanded in y around 0

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(y, \left(\frac{-1}{6} \cdot x + \frac{1}{120} \cdot \left(x \cdot {y}^{2}\right)\right) \cdot y, x\right)} \]
      9. Simplified70.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, y \cdot \left(x \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right), x\right)} \]

      if 4.5 < y

      1. Initial program 99.7%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        2. clear-numN/A

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

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

          \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x \cdot \sin y\right)} \]
        5. /-lowering-/.f64N/A

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

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot \sin y\right)} \]
        7. sin-lowering-sin.f6499.4

          \[\leadsto \frac{1}{y} \cdot \left(x \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.4%

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

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot y\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
        2. *-lowering-*.f644.2

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      7. Simplified4.2%

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(\frac{1}{y} \cdot x\right) \cdot y} \]
        3. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \cdot y \]
        4. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{y}{x}}} \]
        5. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\frac{y}{\frac{y}{x}}} \]
        7. /-lowering-/.f6423.6

          \[\leadsto \frac{y}{\color{blue}{\frac{y}{x}}} \]
      9. Applied egg-rr23.6%

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

    Alternative 7: 56.9% accurate, 3.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.5:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y 4.5)
       (*
        x
        (fma (* y y) (fma y (* y 0.008333333333333333) -0.16666666666666666) 1.0))
       (/ y (/ y x))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 4.5) {
    		tmp = x * fma((y * y), fma(y, (y * 0.008333333333333333), -0.16666666666666666), 1.0);
    	} else {
    		tmp = y / (y / x);
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 4.5)
    		tmp = Float64(x * fma(Float64(y * y), fma(y, Float64(y * 0.008333333333333333), -0.16666666666666666), 1.0));
    	else
    		tmp = Float64(y / Float64(y / x));
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, 4.5], N[(x * N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 4.5:\\
    \;\;\;\;x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{\frac{y}{x}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 4.5

      1. Initial program 99.9%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}} \]
        2. associate-/r/N/A

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

          \[\leadsto x \cdot \color{blue}{\left(\frac{1}{y} \cdot \sin y\right)} \]
        4. /-lowering-/.f64N/A

          \[\leadsto x \cdot \left(\color{blue}{\frac{1}{y}} \cdot \sin y\right) \]
        5. sin-lowering-sin.f6499.7

          \[\leadsto x \cdot \left(\frac{1}{y} \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.7%

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

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

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

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

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

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

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

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

          \[\leadsto x + {y}^{2} \cdot \left(x \cdot \left(\frac{1}{120} \cdot {y}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right)\right) \]
        8. sub-negN/A

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

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

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

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

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

          \[\leadsto \color{blue}{\left(1 + {y}^{2} \cdot \left(\frac{1}{120} \cdot {y}^{2} - \frac{1}{6}\right)\right) \cdot x} \]
      7. Simplified70.0%

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{1}{120} \cdot {y}^{2} - \frac{1}{6}, 1\right)} \cdot x \]
        3. unpow2N/A

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot y}, \frac{1}{120} \cdot {y}^{2} - \frac{1}{6}, 1\right) \cdot x \]
        5. sub-negN/A

          \[\leadsto \mathsf{fma}\left(y \cdot y, \color{blue}{\frac{1}{120} \cdot {y}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, 1\right) \cdot x \]
        6. unpow2N/A

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

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

          \[\leadsto \mathsf{fma}\left(y \cdot y, \color{blue}{y \cdot \left(\frac{1}{120} \cdot y\right)} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), 1\right) \cdot x \]
        9. metadata-evalN/A

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

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

          \[\leadsto \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{1}{120}}, \frac{-1}{6}\right), 1\right) \cdot x \]
        12. *-lowering-*.f6470.0

          \[\leadsto \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, \color{blue}{y \cdot 0.008333333333333333}, -0.16666666666666666\right), 1\right) \cdot x \]
      10. Simplified70.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), 1\right)} \cdot x \]

      if 4.5 < y

      1. Initial program 99.7%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        2. clear-numN/A

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

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

          \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x \cdot \sin y\right)} \]
        5. /-lowering-/.f64N/A

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

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot \sin y\right)} \]
        7. sin-lowering-sin.f6499.4

          \[\leadsto \frac{1}{y} \cdot \left(x \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.4%

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

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot y\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
        2. *-lowering-*.f644.2

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      7. Simplified4.2%

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(\frac{1}{y} \cdot x\right) \cdot y} \]
        3. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \cdot y \]
        4. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{y}{x}}} \]
        5. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\frac{y}{\frac{y}{x}}} \]
        7. /-lowering-/.f6423.6

          \[\leadsto \frac{y}{\color{blue}{\frac{y}{x}}} \]
      9. Applied egg-rr23.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.5:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 56.9% accurate, 4.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y 3200.0) (fma (* x (* y -0.16666666666666666)) y x) (/ y (/ y x))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 3200.0) {
    		tmp = fma((x * (y * -0.16666666666666666)), y, x);
    	} else {
    		tmp = y / (y / x);
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 3200.0)
    		tmp = fma(Float64(x * Float64(y * -0.16666666666666666)), y, x);
    	else
    		tmp = Float64(y / Float64(y / x));
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, 3200.0], N[(N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 3200:\\
    \;\;\;\;\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{\frac{y}{x}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 3200

      1. Initial program 99.9%

        \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{-1}{6}}, 1\right) \]
        12. *-lowering-*.f6469.8

          \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot -0.16666666666666666}, 1\right) \]
      5. Simplified69.8%

        \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)} \]
      6. Step-by-step derivation
        1. distribute-lft-inN/A

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot \left(y \cdot \frac{-1}{6}\right)}, y, x\right) \]
        7. *-lowering-*.f6469.8

          \[\leadsto \mathsf{fma}\left(x \cdot \color{blue}{\left(y \cdot -0.16666666666666666\right)}, y, x\right) \]
      7. Applied egg-rr69.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)} \]

      if 3200 < y

      1. Initial program 99.7%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        2. clear-numN/A

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

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

          \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x \cdot \sin y\right)} \]
        5. /-lowering-/.f64N/A

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

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot \sin y\right)} \]
        7. sin-lowering-sin.f6499.4

          \[\leadsto \frac{1}{y} \cdot \left(x \cdot \color{blue}{\sin y}\right) \]
      4. Applied egg-rr99.4%

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

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(x \cdot y\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
        2. *-lowering-*.f644.2

          \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      7. Simplified4.2%

        \[\leadsto \frac{1}{y} \cdot \color{blue}{\left(y \cdot x\right)} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(\frac{1}{y} \cdot x\right) \cdot y} \]
        3. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \cdot y \]
        4. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{y}{x}}} \]
        5. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\frac{y}{\frac{y}{x}}} \]
        7. /-lowering-/.f6423.6

          \[\leadsto \frac{y}{\color{blue}{\frac{y}{x}}} \]
      9. Applied egg-rr23.6%

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

    Alternative 9: 56.4% accurate, 5.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= y 3200.0) (fma (* x (* y -0.16666666666666666)) y x) (* y (/ x y))))
    double code(double x, double y) {
    	double tmp;
    	if (y <= 3200.0) {
    		tmp = fma((x * (y * -0.16666666666666666)), y, x);
    	} else {
    		tmp = y * (x / y);
    	}
    	return tmp;
    }
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= 3200.0)
    		tmp = fma(Float64(x * Float64(y * -0.16666666666666666)), y, x);
    	else
    		tmp = Float64(y * Float64(x / y));
    	end
    	return tmp
    end
    
    code[x_, y_] := If[LessEqual[y, 3200.0], N[(N[(x * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 3200:\\
    \;\;\;\;\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;y \cdot \frac{x}{y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 3200

      1. Initial program 99.9%

        \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{-1}{6}}, 1\right) \]
        12. *-lowering-*.f6469.8

          \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot -0.16666666666666666}, 1\right) \]
      5. Simplified69.8%

        \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)} \]
      6. Step-by-step derivation
        1. distribute-lft-inN/A

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot \left(y \cdot \frac{-1}{6}\right)}, y, x\right) \]
        7. *-lowering-*.f6469.8

          \[\leadsto \mathsf{fma}\left(x \cdot \color{blue}{\left(y \cdot -0.16666666666666666\right)}, y, x\right) \]
      7. Applied egg-rr69.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)} \]

      if 3200 < y

      1. Initial program 99.7%

        \[x \cdot \frac{\sin y}{y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
        2. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{x}{y} \cdot \sin y} \]
        3. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{1 \cdot x}}{y} \cdot \sin y \]
        4. associate-*l/N/A

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

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

          \[\leadsto \color{blue}{\frac{1 \cdot x}{y}} \cdot \sin y \]
        7. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\frac{x}{y}} \cdot \sin y \]
        9. sin-lowering-sin.f6499.6

          \[\leadsto \frac{x}{y} \cdot \color{blue}{\sin y} \]
      4. Applied egg-rr99.6%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \sin y} \]
      5. Taylor expanded in y around 0

        \[\leadsto \frac{x}{y} \cdot \color{blue}{y} \]
      6. Step-by-step derivation
        1. Simplified23.2%

          \[\leadsto \frac{x}{y} \cdot \color{blue}{y} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification58.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;\mathsf{fma}\left(x \cdot \left(y \cdot -0.16666666666666666\right), y, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 10: 56.4% accurate, 5.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (<= y 3200.0) (* x (fma y (* y -0.16666666666666666) 1.0)) (* y (/ x y))))
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3200.0) {
      		tmp = x * fma(y, (y * -0.16666666666666666), 1.0);
      	} else {
      		tmp = y * (x / y);
      	}
      	return tmp;
      }
      
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3200.0)
      		tmp = Float64(x * fma(y, Float64(y * -0.16666666666666666), 1.0));
      	else
      		tmp = Float64(y * Float64(x / y));
      	end
      	return tmp
      end
      
      code[x_, y_] := If[LessEqual[y, 3200.0], N[(x * N[(y * N[(y * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3200:\\
      \;\;\;\;x \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;y \cdot \frac{x}{y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3200

        1. Initial program 99.9%

          \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{-1}{6}}, 1\right) \]
          12. *-lowering-*.f6469.8

            \[\leadsto x \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot -0.16666666666666666}, 1\right) \]
        5. Simplified69.8%

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

        if 3200 < y

        1. Initial program 99.7%

          \[x \cdot \frac{\sin y}{y} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{x \cdot \sin y}{y}} \]
          2. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{x}{y} \cdot \sin y} \]
          3. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{1 \cdot x}}{y} \cdot \sin y \]
          4. associate-*l/N/A

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

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

            \[\leadsto \color{blue}{\frac{1 \cdot x}{y}} \cdot \sin y \]
          7. *-lft-identityN/A

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

            \[\leadsto \color{blue}{\frac{x}{y}} \cdot \sin y \]
          9. sin-lowering-sin.f6499.6

            \[\leadsto \frac{x}{y} \cdot \color{blue}{\sin y} \]
        4. Applied egg-rr99.6%

          \[\leadsto \color{blue}{\frac{x}{y} \cdot \sin y} \]
        5. Taylor expanded in y around 0

          \[\leadsto \frac{x}{y} \cdot \color{blue}{y} \]
        6. Step-by-step derivation
          1. Simplified23.2%

            \[\leadsto \frac{x}{y} \cdot \color{blue}{y} \]
        7. Recombined 2 regimes into one program.
        8. Final simplification58.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3200:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, y \cdot -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 11: 51.7% accurate, 117.0× speedup?

        \[\begin{array}{l} \\ x \end{array} \]
        (FPCore (x y) :precision binary64 x)
        double code(double x, double y) {
        	return x;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = x
        end function
        
        public static double code(double x, double y) {
        	return x;
        }
        
        def code(x, y):
        	return x
        
        function code(x, y)
        	return x
        end
        
        function tmp = code(x, y)
        	tmp = x;
        end
        
        code[x_, y_] := x
        
        \begin{array}{l}
        
        \\
        x
        \end{array}
        
        Derivation
        1. Initial program 99.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. Simplified54.7%

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

          Reproduce

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