Average Error: 0.1 → 0.3
Time: 5.7s
Precision: binary64
Cost: 6984
\[x \cdot \frac{\sin y}{y} \]
\[\begin{array}{l} t_0 := \sin y \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq -0.012611501421154598:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.5842635993859354 \cdot 10^{-33}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(FPCore (x y) :precision binary64 (* x (/ (sin y) y)))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (sin y) (/ x y))))
   (if (<= y -0.012611501421154598)
     t_0
     (if (<= y 4.5842635993859354e-33) x t_0))))
double code(double x, double y) {
	return x * (sin(y) / y);
}
double code(double x, double y) {
	double t_0 = sin(y) * (x / y);
	double tmp;
	if (y <= -0.012611501421154598) {
		tmp = t_0;
	} else if (y <= 4.5842635993859354e-33) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x * (sin(y) / y)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin(y) * (x / y)
    if (y <= (-0.012611501421154598d0)) then
        tmp = t_0
    else if (y <= 4.5842635993859354d-33) then
        tmp = x
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	return x * (Math.sin(y) / y);
}
public static double code(double x, double y) {
	double t_0 = Math.sin(y) * (x / y);
	double tmp;
	if (y <= -0.012611501421154598) {
		tmp = t_0;
	} else if (y <= 4.5842635993859354e-33) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	return x * (math.sin(y) / y)
def code(x, y):
	t_0 = math.sin(y) * (x / y)
	tmp = 0
	if y <= -0.012611501421154598:
		tmp = t_0
	elif y <= 4.5842635993859354e-33:
		tmp = x
	else:
		tmp = t_0
	return tmp
function code(x, y)
	return Float64(x * Float64(sin(y) / y))
end
function code(x, y)
	t_0 = Float64(sin(y) * Float64(x / y))
	tmp = 0.0
	if (y <= -0.012611501421154598)
		tmp = t_0;
	elseif (y <= 4.5842635993859354e-33)
		tmp = x;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp = code(x, y)
	tmp = x * (sin(y) / y);
end
function tmp_2 = code(x, y)
	t_0 = sin(y) * (x / y);
	tmp = 0.0;
	if (y <= -0.012611501421154598)
		tmp = t_0;
	elseif (y <= 4.5842635993859354e-33)
		tmp = x;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.012611501421154598], t$95$0, If[LessEqual[y, 4.5842635993859354e-33], x, t$95$0]]]
x \cdot \frac{\sin y}{y}
\begin{array}{l}
t_0 := \sin y \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -0.012611501421154598:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 4.5842635993859354 \cdot 10^{-33}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if y < -0.012611501421154598 or 4.58426359938593541e-33 < y

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\frac{\sin y \cdot x}{y}} \]
    3. Simplified0.4

      \[\leadsto \color{blue}{\sin y \cdot \frac{x}{y}} \]
      Proof
      (*.f64 (sin.f64 y) (/.f64 x y)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (sin.f64 y) x) y)): 75 points increase in error, 46 points decrease in error

    if -0.012611501421154598 < y < 4.58426359938593541e-33

    1. Initial program 0.0

      \[x \cdot \frac{\sin y}{y} \]
    2. Applied egg-rr31.4

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{\sin y}{y} \cdot x}\right)}^{2}} \]
    3. Taylor expanded in y around 0 0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.012611501421154598:\\ \;\;\;\;\sin y \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 4.5842635993859354 \cdot 10^{-33}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\sin y \cdot \frac{x}{y}\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost6984
\[\begin{array}{l} t_0 := \frac{x \cdot \sin y}{y}\\ \mathbf{if}\;y \leq -0.012611501421154598:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.76304409507475 \cdot 10^{-56}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.1
Cost6720
\[x \cdot \frac{\sin y}{y} \]
Alternative 3
Error0.1
Cost6720
\[\frac{x}{\frac{y}{\sin y}} \]
Alternative 4
Error22.9
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -24.812184995934174:\\ \;\;\;\;x \cdot \frac{6}{y \cdot y}\\ \mathbf{elif}\;y \leq 0.003935394346914117:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.16666666666666666 \cdot \left(y \cdot \frac{y}{x}\right)}\\ \end{array} \]
Alternative 5
Error22.9
Cost712
\[\begin{array}{l} t_0 := x \cdot \frac{6}{y \cdot y}\\ \mathbf{if}\;y \leq -24.812184995934174:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.003935394346914117:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error22.8
Cost704
\[\frac{x}{y \cdot \left(\frac{1}{y} + y \cdot 0.16666666666666666\right)} \]
Alternative 7
Error23.0
Cost584
\[\begin{array}{l} t_0 := \left(x + 1\right) + -1\\ \mathbf{if}\;y \leq -1.6750007543737113 \cdot 10^{+28}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.3684001821670084 \cdot 10^{+33}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error23.1
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -0.012611501421154598:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 3.3684001821670084 \cdot 10^{+33}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(x + 1\right) + -1\\ \end{array} \]
Alternative 9
Error30.1
Cost64
\[x \]

Error

Reproduce

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