Linear.Quaternion:$cexp from linear-1.19.1.3

Percentage Accurate: 99.8% → 99.8%
Time: 7.1s
Alternatives: 8
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 8 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.9%

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

Alternative 2: 63.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \leq 10^{-21}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (sin.f64 y) y) < 9.99999999999999908e-22

    1. Initial program 99.7%

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

        \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
      2. lift-sin.f64N/A

        \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
      3. sin-+PI-revN/A

        \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
      4. sin-neg-revN/A

        \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
      5. +-commutativeN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
      6. distribute-neg-inN/A

        \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
      7. sin-sumN/A

        \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
      8. cos-neg-revN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
      9. cos-neg-revN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
      10. sin-neg-revN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
      11. lift-sin.f64N/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
      12. distribute-rgt-neg-inN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
      13. *-commutativeN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
      14. distribute-lft-neg-inN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
      15. lift-sin.f64N/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
      16. sin-neg-revN/A

        \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
      17. lower-fma.f64N/A

        \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
    4. Applied rewrites98.7%

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

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

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

        \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
      3. sin-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
      4. sin-PIN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
      5. metadata-evalN/A

        \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
      6. mul0-lft28.0

        \[\leadsto \color{blue}{0} \]
    7. Applied rewrites28.0%

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

    if 9.99999999999999908e-22 < (/.f64 (sin.f64 y) y)

    1. Initial program 100.0%

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

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

        \[\leadsto \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)} + x \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(0.008333333333333333 \cdot y, y, -0.16666666666666666\right), 1\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites98.8%

        \[\leadsto x \cdot \mathsf{fma}\left(\left(\left(0.008333333333333333 \cdot y\right) \cdot y\right) \cdot y, \color{blue}{y}, \mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right)\right) \]
    7. Recombined 2 regimes into one program.
    8. Final simplification68.6%

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

    Alternative 3: 63.8% accurate, 0.8× speedup?

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

      1. Initial program 99.7%

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

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
        2. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
        3. sin-+PI-revN/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
        4. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
        5. +-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
        6. distribute-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
        7. sin-sumN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
        8. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        9. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        10. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
        11. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
        12. distribute-rgt-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
        13. *-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
        14. distribute-lft-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
        15. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        16. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        17. lower-fma.f64N/A

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
      4. Applied rewrites98.7%

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

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

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

          \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
        3. sin-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
        4. sin-PIN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
        5. metadata-evalN/A

          \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
        6. mul0-lft28.0

          \[\leadsto \color{blue}{0} \]
      7. Applied rewrites28.0%

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

      if 9.99999999999999908e-22 < (/.f64 (sin.f64 y) y)

      1. Initial program 100.0%

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

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

          \[\leadsto \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)} + x \]
        4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 39.0% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \leq 5 \cdot 10^{-307}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
    (FPCore (x y) :precision binary64 (if (<= (* x (/ (sin y) y)) 5e-307) 0.0 x))
    double code(double x, double y) {
    	double tmp;
    	if ((x * (sin(y) / y)) <= 5e-307) {
    		tmp = 0.0;
    	} else {
    		tmp = x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if ((x * (sin(y) / y)) <= 5d-307) then
            tmp = 0.0d0
        else
            tmp = x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if ((x * (Math.sin(y) / y)) <= 5e-307) {
    		tmp = 0.0;
    	} else {
    		tmp = x;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if (x * (math.sin(y) / y)) <= 5e-307:
    		tmp = 0.0
    	else:
    		tmp = x
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (Float64(x * Float64(sin(y) / y)) <= 5e-307)
    		tmp = 0.0;
    	else
    		tmp = x;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if ((x * (sin(y) / y)) <= 5e-307)
    		tmp = 0.0;
    	else
    		tmp = x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 5e-307], 0.0, x]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \cdot \frac{\sin y}{y} \leq 5 \cdot 10^{-307}:\\
    \;\;\;\;0\\
    
    \mathbf{else}:\\
    \;\;\;\;x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 x (/.f64 (sin.f64 y) y)) < 5.00000000000000014e-307

      1. Initial program 99.9%

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

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
        2. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
        3. sin-+PI-revN/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
        4. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
        5. +-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
        6. distribute-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
        7. sin-sumN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
        8. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        9. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        10. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
        11. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
        12. distribute-rgt-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
        13. *-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
        14. distribute-lft-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
        15. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        16. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        17. lower-fma.f64N/A

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
      4. Applied rewrites53.7%

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

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

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

          \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
        3. sin-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
        4. sin-PIN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
        5. metadata-evalN/A

          \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
        6. mul0-lft20.5

          \[\leadsto \color{blue}{0} \]
      7. Applied rewrites20.5%

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

      if 5.00000000000000014e-307 < (*.f64 x (/.f64 (sin.f64 y) y))

      1. Initial program 99.9%

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

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
        2. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
        3. sin-+PI-revN/A

          \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
        4. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
        5. +-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
        6. distribute-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
        7. sin-sumN/A

          \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
        8. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        9. cos-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
        10. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
        11. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
        12. distribute-rgt-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
        13. *-commutativeN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
        14. distribute-lft-neg-inN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
        15. lift-sin.f64N/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        16. sin-neg-revN/A

          \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
        17. lower-fma.f64N/A

          \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
      4. Applied rewrites38.4%

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

        \[\leadsto \color{blue}{\frac{x \cdot y + x \cdot \sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}{y}} \]
      6. Step-by-step derivation
        1. div-addN/A

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

          \[\leadsto \frac{\color{blue}{y \cdot x}}{y} + \frac{x \cdot \sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}{y} \]
        3. associate-/l*N/A

          \[\leadsto \color{blue}{y \cdot \frac{x}{y}} + \frac{x \cdot \sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)}{y} \]
        4. *-commutativeN/A

          \[\leadsto y \cdot \frac{x}{y} + \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot x}}{y} \]
        5. associate-/l*N/A

          \[\leadsto y \cdot \frac{x}{y} + \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
        6. distribute-rgt-outN/A

          \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(y + \sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)\right)} \]
        7. +-commutativeN/A

          \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + y\right)} \]
        8. sin-negN/A

          \[\leadsto \frac{x}{y} \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} + y\right) \]
        9. sin-PIN/A

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

          \[\leadsto \frac{x}{y} \cdot \left(\color{blue}{0} + y\right) \]
        11. +-lft-identityN/A

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

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

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

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

          \[\leadsto \color{blue}{x \cdot \frac{y}{y}} \]
        16. *-inversesN/A

          \[\leadsto x \cdot \color{blue}{1} \]
        17. *-rgt-identity66.2

          \[\leadsto \color{blue}{x} \]
      7. Applied rewrites66.2%

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

    Alternative 5: 57.5% accurate, 1.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot y\right) \cdot x\\ \mathbf{if}\;y \leq 50000000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, y \cdot y, 0.008333333333333333\right), \left(y \cdot y\right) \cdot t\_0, \mathsf{fma}\left(-0.16666666666666666, t\_0, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (* (* y y) x)))
       (if (<= y 50000000000.0)
         (fma
          (fma -0.0001984126984126984 (* y y) 0.008333333333333333)
          (* (* y y) t_0)
          (fma -0.16666666666666666 t_0 x))
         0.0)))
    double code(double x, double y) {
    	double t_0 = (y * y) * x;
    	double tmp;
    	if (y <= 50000000000.0) {
    		tmp = fma(fma(-0.0001984126984126984, (y * y), 0.008333333333333333), ((y * y) * t_0), fma(-0.16666666666666666, t_0, x));
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	t_0 = Float64(Float64(y * y) * x)
    	tmp = 0.0
    	if (y <= 50000000000.0)
    		tmp = fma(fma(-0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(Float64(y * y) * t_0), fma(-0.16666666666666666, t_0, x));
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, 50000000000.0], N[(N[(-0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(-0.16666666666666666 * t$95$0 + x), $MachinePrecision]), $MachinePrecision], 0.0]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(y \cdot y\right) \cdot x\\
    \mathbf{if}\;y \leq 50000000000:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, y \cdot y, 0.008333333333333333\right), \left(y \cdot y\right) \cdot t\_0, \mathsf{fma}\left(-0.16666666666666666, t\_0, x\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 5e10

      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 + {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)} \]
      4. Applied rewrites74.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y \cdot y\right) \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, y \cdot y, 0.008333333333333333\right) \cdot y, y, -0.16666666666666666\right), x\right)} \]
      5. Step-by-step derivation
        1. Applied rewrites74.0%

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

        if 5e10 < y

        1. Initial program 99.7%

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

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
          2. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
          3. sin-+PI-revN/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
          4. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
          5. +-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
          6. distribute-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
          7. sin-sumN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
          8. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          9. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          10. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
          11. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
          12. distribute-rgt-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
          13. *-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
          14. distribute-lft-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
          15. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          16. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          17. lower-fma.f64N/A

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
        4. Applied rewrites98.7%

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

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

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

            \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
          3. sin-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
          4. sin-PIN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
          5. metadata-evalN/A

            \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
          6. mul0-lft24.5

            \[\leadsto \color{blue}{0} \]
        7. Applied rewrites24.5%

          \[\leadsto \color{blue}{0} \]
      6. Recombined 2 regimes into one program.
      7. Final simplification62.8%

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

      Alternative 6: 57.5% accurate, 2.6× speedup?

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

        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 + {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)} \]
        4. Applied rewrites74.0%

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

        if 5e10 < y

        1. Initial program 99.7%

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

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
          2. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
          3. sin-+PI-revN/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
          4. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
          5. +-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
          6. distribute-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
          7. sin-sumN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
          8. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          9. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          10. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
          11. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
          12. distribute-rgt-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
          13. *-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
          14. distribute-lft-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
          15. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          16. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          17. lower-fma.f64N/A

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
        4. Applied rewrites98.7%

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

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

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

            \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
          3. sin-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
          4. sin-PIN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
          5. metadata-evalN/A

            \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
          6. mul0-lft24.5

            \[\leadsto \color{blue}{0} \]
        7. Applied rewrites24.5%

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

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

      Alternative 7: 57.5% accurate, 5.1× speedup?

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

        1. Initial program 99.9%

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x \cdot \sin y\right)\right)\right)}{y}} \]
          8. *-commutativeN/A

            \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y \cdot x}\right)\right)\right)}{y} \]
          9. distribute-lft-neg-inN/A

            \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot x}\right)}{y} \]
          10. distribute-lft-neg-inN/A

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

            \[\leadsto \frac{\color{blue}{\sin y} \cdot x}{y} \]
          12. lower-*.f6485.9

            \[\leadsto \frac{\color{blue}{\sin y \cdot x}}{y} \]
        4. Applied rewrites85.9%

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y \cdot y\right) \cdot x, -0.16666666666666666, x\right)} \]
        8. Step-by-step derivation
          1. Applied rewrites73.4%

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

          if 2.7e13 < y

          1. Initial program 99.7%

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

              \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
            2. lift-sin.f64N/A

              \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
            3. sin-+PI-revN/A

              \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
            4. sin-neg-revN/A

              \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
            5. +-commutativeN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
            6. distribute-neg-inN/A

              \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
            7. sin-sumN/A

              \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
            8. cos-neg-revN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
            9. cos-neg-revN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
            10. sin-neg-revN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
            11. lift-sin.f64N/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
            12. distribute-rgt-neg-inN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
            13. *-commutativeN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
            14. distribute-lft-neg-inN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
            15. lift-sin.f64N/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
            16. sin-neg-revN/A

              \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
            17. lower-fma.f64N/A

              \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
          4. Applied rewrites98.7%

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

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

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

              \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
            3. sin-negN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
            4. sin-PIN/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
            5. metadata-evalN/A

              \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
            6. mul0-lft24.8

              \[\leadsto \color{blue}{0} \]
          7. Applied rewrites24.8%

            \[\leadsto \color{blue}{0} \]
        9. Recombined 2 regimes into one program.
        10. Final simplification62.6%

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

        Alternative 8: 16.1% accurate, 117.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.9%

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

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin y\right)\right)\right)}}{y} \]
          2. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)\right)}{y} \]
          3. sin-+PI-revN/A

            \[\leadsto x \cdot \frac{\mathsf{neg}\left(\color{blue}{\sin \left(y + \mathsf{PI}\left(\right)\right)}\right)}{y} \]
          4. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\left(y + \mathsf{PI}\left(\right)\right)\right)\right)}}{y} \]
          5. +-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{PI}\left(\right) + y\right)}\right)\right)}{y} \]
          6. distribute-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \color{blue}{\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}}{y} \]
          7. sin-sumN/A

            \[\leadsto x \cdot \frac{\color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\mathsf{neg}\left(y\right)\right) + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}}{y} \]
          8. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\cos y} + \cos \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          9. cos-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\cos \mathsf{PI}\left(\right)} \cdot \sin \left(\mathsf{neg}\left(y\right)\right)}{y} \]
          10. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right)}}{y} \]
          11. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \cos \mathsf{PI}\left(\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right)}{y} \]
          12. distribute-rgt-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\cos \mathsf{PI}\left(\right) \cdot \sin y\right)\right)}}{y} \]
          13. *-commutativeN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot \cos \mathsf{PI}\left(\right)}\right)\right)}{y} \]
          14. distribute-lft-neg-inN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\left(\mathsf{neg}\left(\sin y\right)\right) \cdot \cos \mathsf{PI}\left(\right)}}{y} \]
          15. lift-sin.f64N/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \left(\mathsf{neg}\left(\color{blue}{\sin y}\right)\right) \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          16. sin-neg-revN/A

            \[\leadsto x \cdot \frac{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \cos y + \color{blue}{\sin \left(\mathsf{neg}\left(y\right)\right)} \cdot \cos \mathsf{PI}\left(\right)}{y} \]
          17. lower-fma.f64N/A

            \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), \cos y, \sin \left(\mathsf{neg}\left(y\right)\right) \cdot \cos \mathsf{PI}\left(\right)\right)}}{y} \]
        4. Applied rewrites47.7%

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

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

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

            \[\leadsto \color{blue}{\sin \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \frac{x}{y}} \]
          3. sin-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sin \mathsf{PI}\left(\right)\right)\right)} \cdot \frac{x}{y} \]
          4. sin-PIN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{0}\right)\right) \cdot \frac{x}{y} \]
          5. metadata-evalN/A

            \[\leadsto \color{blue}{0} \cdot \frac{x}{y} \]
          6. mul0-lft14.0

            \[\leadsto \color{blue}{0} \]
        7. Applied rewrites14.0%

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

        Reproduce

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