Linear.Quaternion:$cexp from linear-1.19.1.3

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

Alternative 2: 56.7% accurate, 7.5× speedup?

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

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

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


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

    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. *-rgt-identityN/A

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

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

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

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

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

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

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

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

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

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

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

    if 4.1e6 < y

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. Simplified28.4%

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{6}{y \cdot y}} \]
    10. Recombined 2 regimes into one program.
    11. Final simplification61.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4100000:\\ \;\;\;\;x \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{6}{y \cdot y}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 3: 56.9% accurate, 8.7× speedup?

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

      1. Initial program 99.9%

        \[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. Simplified70.1%

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

        if 2.39999999999999991 < y

        1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \frac{1}{6}\right)\right)\right)\right) \]
        9. Step-by-step derivation
          1. Simplified27.9%

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

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

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

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

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

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

        Alternative 4: 63.0% accurate, 9.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 63.0% accurate, 11.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{x}{1 + 0.16666666666666666 \cdot \left(y \cdot y\right)}} \]
            5. Final simplification68.2%

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

            Alternative 6: 56.4% accurate, 17.5× speedup?

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

              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. Simplified66.2%

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

                if 6.9999999999999998e84 < y

                1. Initial program 99.5%

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

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

              Alternative 7: 15.7% accurate, 105.0× speedup?

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

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

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

              Reproduce

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