Linear.Quaternion:$ccos from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 8.4s
Alternatives: 15
Speedup: 1.0×

Specification

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

\\
\sin x \cdot \frac{\sinh 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 15 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: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

    \[\sin x \cdot \frac{\sinh y}{y} \]
  2. Final simplification100.0%

    \[\leadsto \sin x \cdot \frac{\sinh y}{y} \]

Alternative 2: 80.8% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3} + y \cdot 2\right)}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7200.0)
   (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
   (if (<= y 6.9e+102)
     (pow x -3.0)
     (if (<= y 1.35e+154)
       (/ (* 0.5 (+ (* 0.3333333333333333 (pow y 3.0)) (* y 2.0))) (/ y x))
       (* 0.16666666666666666 (* (sin x) (* y y)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 6.9e+102) {
		tmp = pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (0.5 * ((0.3333333333333333 * pow(y, 3.0)) + (y * 2.0))) / (y / x);
	} else {
		tmp = 0.16666666666666666 * (sin(x) * (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 <= 7200.0d0) then
        tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    else if (y <= 6.9d+102) then
        tmp = x ** (-3.0d0)
    else if (y <= 1.35d+154) then
        tmp = (0.5d0 * ((0.3333333333333333d0 * (y ** 3.0d0)) + (y * 2.0d0))) / (y / x)
    else
        tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 6.9e+102) {
		tmp = Math.pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (0.5 * ((0.3333333333333333 * Math.pow(y, 3.0)) + (y * 2.0))) / (y / x);
	} else {
		tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7200.0:
		tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)))
	elif y <= 6.9e+102:
		tmp = math.pow(x, -3.0)
	elif y <= 1.35e+154:
		tmp = (0.5 * ((0.3333333333333333 * math.pow(y, 3.0)) + (y * 2.0))) / (y / x)
	else:
		tmp = 0.16666666666666666 * (math.sin(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7200.0)
		tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))));
	elseif (y <= 6.9e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = Float64(Float64(0.5 * Float64(Float64(0.3333333333333333 * (y ^ 3.0)) + Float64(y * 2.0))) / Float64(y / x));
	else
		tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7200.0)
		tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	elseif (y <= 6.9e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = (0.5 * ((0.3333333333333333 * (y ^ 3.0)) + (y * 2.0))) / (y / x);
	else
		tmp = 0.16666666666666666 * (sin(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7200.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.9e+102], N[Power[x, -3.0], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(0.5 * N[(N[(0.3333333333333333 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\
\;\;\;\;{x}^{-3}\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3} + y \cdot 2\right)}{\frac{y}{x}}\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow284.3%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified84.3%

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

    if 7200 < y < 6.89999999999999966e102

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*80.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/80.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp80.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified80.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr37.0%

      \[\leadsto \color{blue}{{x}^{-3}} \]

    if 6.89999999999999966e102 < y < 1.35000000000000003e154

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*72.7%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/72.7%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp72.7%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified72.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 72.7%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(0.3333333333333333 \cdot {y}^{3} + 2 \cdot y\right)}}{\frac{y}{x}} \]

    if 1.35000000000000003e154 < y

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot \sin x\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \sin x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\left(y \cdot y\right) \cdot \sin x\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3} + y \cdot 2\right)}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 3: 67.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7200.0)
   (sin x)
   (if (<= y 5.5e+102)
     (pow x -3.0)
     (if (<= y 1.35e+154)
       (* (/ x y) (* 0.16666666666666666 (pow y 3.0)))
       (* 0.16666666666666666 (* (sin x) (* y y)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = sin(x);
	} else if (y <= 5.5e+102) {
		tmp = pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (x / y) * (0.16666666666666666 * pow(y, 3.0));
	} else {
		tmp = 0.16666666666666666 * (sin(x) * (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 <= 7200.0d0) then
        tmp = sin(x)
    else if (y <= 5.5d+102) then
        tmp = x ** (-3.0d0)
    else if (y <= 1.35d+154) then
        tmp = (x / y) * (0.16666666666666666d0 * (y ** 3.0d0))
    else
        tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = Math.sin(x);
	} else if (y <= 5.5e+102) {
		tmp = Math.pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (x / y) * (0.16666666666666666 * Math.pow(y, 3.0));
	} else {
		tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7200.0:
		tmp = math.sin(x)
	elif y <= 5.5e+102:
		tmp = math.pow(x, -3.0)
	elif y <= 1.35e+154:
		tmp = (x / y) * (0.16666666666666666 * math.pow(y, 3.0))
	else:
		tmp = 0.16666666666666666 * (math.sin(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 5.5e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = Float64(Float64(x / y) * Float64(0.16666666666666666 * (y ^ 3.0)));
	else
		tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 5.5e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = (x / y) * (0.16666666666666666 * (y ^ 3.0));
	else
		tmp = 0.16666666666666666 * (sin(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7200.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 5.5e+102], N[Power[x, -3.0], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(x / y), $MachinePrecision] * N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;{x}^{-3}\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

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

    if 7200 < y < 5.49999999999999981e102

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*80.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/80.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp80.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified80.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr37.0%

      \[\leadsto \color{blue}{{x}^{-3}} \]

    if 5.49999999999999981e102 < y < 1.35000000000000003e154

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*72.7%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/72.7%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp72.7%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified72.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 72.7%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(0.3333333333333333 \cdot {y}^{3} + 2 \cdot y\right)}}{\frac{y}{x}} \]
    6. Taylor expanded in y around inf 72.7%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(0.3333333333333333 \cdot {y}^{3}\right)}}{\frac{y}{x}} \]
    7. Step-by-step derivation
      1. clear-num72.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)}}} \]
      2. associate-/r/72.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}} \cdot \left(0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)\right)} \]
      3. clear-num72.7%

        \[\leadsto \color{blue}{\frac{x}{y}} \cdot \left(0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)\right) \]
      4. associate-*r*72.7%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\left(0.5 \cdot 0.3333333333333333\right) \cdot {y}^{3}\right)} \]
      5. metadata-eval72.7%

        \[\leadsto \frac{x}{y} \cdot \left(\color{blue}{0.16666666666666666} \cdot {y}^{3}\right) \]
    8. Applied egg-rr72.7%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)} \]

    if 1.35000000000000003e154 < y

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot \sin x\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \sin x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\left(y \cdot y\right) \cdot \sin x\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification70.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 4: 80.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7200.0)
   (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
   (if (<= y 6.9e+102)
     (pow x -3.0)
     (if (<= y 1.35e+154)
       (* (/ x y) (* 0.16666666666666666 (pow y 3.0)))
       (* 0.16666666666666666 (* (sin x) (* y y)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 6.9e+102) {
		tmp = pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (x / y) * (0.16666666666666666 * pow(y, 3.0));
	} else {
		tmp = 0.16666666666666666 * (sin(x) * (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 <= 7200.0d0) then
        tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
    else if (y <= 6.9d+102) then
        tmp = x ** (-3.0d0)
    else if (y <= 1.35d+154) then
        tmp = (x / y) * (0.16666666666666666d0 * (y ** 3.0d0))
    else
        tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	} else if (y <= 6.9e+102) {
		tmp = Math.pow(x, -3.0);
	} else if (y <= 1.35e+154) {
		tmp = (x / y) * (0.16666666666666666 * Math.pow(y, 3.0));
	} else {
		tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7200.0:
		tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)))
	elif y <= 6.9e+102:
		tmp = math.pow(x, -3.0)
	elif y <= 1.35e+154:
		tmp = (x / y) * (0.16666666666666666 * math.pow(y, 3.0))
	else:
		tmp = 0.16666666666666666 * (math.sin(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7200.0)
		tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))));
	elseif (y <= 6.9e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = Float64(Float64(x / y) * Float64(0.16666666666666666 * (y ^ 3.0)));
	else
		tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7200.0)
		tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
	elseif (y <= 6.9e+102)
		tmp = x ^ -3.0;
	elseif (y <= 1.35e+154)
		tmp = (x / y) * (0.16666666666666666 * (y ^ 3.0));
	else
		tmp = 0.16666666666666666 * (sin(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7200.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.9e+102], N[Power[x, -3.0], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(x / y), $MachinePrecision] * N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\
\;\;\;\;{x}^{-3}\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow284.3%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified84.3%

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

    if 7200 < y < 6.89999999999999966e102

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*80.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/80.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp80.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified80.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr37.0%

      \[\leadsto \color{blue}{{x}^{-3}} \]

    if 6.89999999999999966e102 < y < 1.35000000000000003e154

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*72.7%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/72.7%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp72.7%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified72.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 72.7%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(0.3333333333333333 \cdot {y}^{3} + 2 \cdot y\right)}}{\frac{y}{x}} \]
    6. Taylor expanded in y around inf 72.7%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(0.3333333333333333 \cdot {y}^{3}\right)}}{\frac{y}{x}} \]
    7. Step-by-step derivation
      1. clear-num72.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{x}}{0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)}}} \]
      2. associate-/r/72.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}} \cdot \left(0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)\right)} \]
      3. clear-num72.7%

        \[\leadsto \color{blue}{\frac{x}{y}} \cdot \left(0.5 \cdot \left(0.3333333333333333 \cdot {y}^{3}\right)\right) \]
      4. associate-*r*72.7%

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\left(0.5 \cdot 0.3333333333333333\right) \cdot {y}^{3}\right)} \]
      5. metadata-eval72.7%

        \[\leadsto \frac{x}{y} \cdot \left(\color{blue}{0.16666666666666666} \cdot {y}^{3}\right) \]
    8. Applied egg-rr72.7%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)} \]

    if 1.35000000000000003e154 < y

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot \sin x\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \sin x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\left(y \cdot y\right) \cdot \sin x\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+102}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{x}{y} \cdot \left(0.16666666666666666 \cdot {y}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 5: 67.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7200.0)
   (sin x)
   (if (<= y 1.35e+154)
     (pow x -3.0)
     (* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = sin(x);
	} else if (y <= 1.35e+154) {
		tmp = pow(x, -3.0);
	} else {
		tmp = 0.16666666666666666 * (sin(x) * (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 <= 7200.0d0) then
        tmp = sin(x)
    else if (y <= 1.35d+154) then
        tmp = x ** (-3.0d0)
    else
        tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = Math.sin(x);
	} else if (y <= 1.35e+154) {
		tmp = Math.pow(x, -3.0);
	} else {
		tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7200.0:
		tmp = math.sin(x)
	elif y <= 1.35e+154:
		tmp = math.pow(x, -3.0)
	else:
		tmp = 0.16666666666666666 * (math.sin(x) * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 1.35e+154)
		tmp = x ^ -3.0;
	else
		tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 1.35e+154)
		tmp = x ^ -3.0;
	else
		tmp = 0.16666666666666666 * (sin(x) * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7200.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[Power[x, -3.0], $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;{x}^{-3}\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

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

    if 7200 < y < 1.35000000000000003e154

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*77.4%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/77.4%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp77.4%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified77.4%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr34.3%

      \[\leadsto \color{blue}{{x}^{-3}} \]

    if 1.35000000000000003e154 < y

    1. Initial program 100.0%

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

      \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
    4. Simplified100.0%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot \sin x\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto 0.16666666666666666 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \sin x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\left(y \cdot y\right) \cdot \sin x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 6: 64.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+154}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7200.0)
   (sin x)
   (if (<= y 3.3e+154)
     (pow x -3.0)
     (* x (+ 1.0 (* y (* y 0.16666666666666666)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = sin(x);
	} else if (y <= 3.3e+154) {
		tmp = pow(x, -3.0);
	} else {
		tmp = x * (1.0 + (y * (y * 0.16666666666666666)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 7200.0d0) then
        tmp = sin(x)
    else if (y <= 3.3d+154) then
        tmp = x ** (-3.0d0)
    else
        tmp = x * (1.0d0 + (y * (y * 0.16666666666666666d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7200.0) {
		tmp = Math.sin(x);
	} else if (y <= 3.3e+154) {
		tmp = Math.pow(x, -3.0);
	} else {
		tmp = x * (1.0 + (y * (y * 0.16666666666666666)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7200.0:
		tmp = math.sin(x)
	elif y <= 3.3e+154:
		tmp = math.pow(x, -3.0)
	else:
		tmp = x * (1.0 + (y * (y * 0.16666666666666666)))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 3.3e+154)
		tmp = x ^ -3.0;
	else
		tmp = Float64(x * Float64(1.0 + Float64(y * Float64(y * 0.16666666666666666))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7200.0)
		tmp = sin(x);
	elseif (y <= 3.3e+154)
		tmp = x ^ -3.0;
	else
		tmp = x * (1.0 + (y * (y * 0.16666666666666666)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7200.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 3.3e+154], N[Power[x, -3.0], $MachinePrecision], N[(x * N[(1.0 + N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+154}:\\
\;\;\;\;{x}^{-3}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\


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

    1. Initial program 100.0%

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

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

    if 7200 < y < 3.3e154

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*77.4%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/77.4%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp77.4%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified77.4%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr34.3%

      \[\leadsto \color{blue}{{x}^{-3}} \]

    if 3.3e154 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*30.6%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/30.6%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp30.6%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified30.6%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 66.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative66.7%

        \[\leadsto \color{blue}{x + 0.16666666666666666 \cdot \left({y}^{2} \cdot x\right)} \]
      2. *-un-lft-identity66.7%

        \[\leadsto \color{blue}{1 \cdot x} + 0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) \]
      3. associate-*r*66.7%

        \[\leadsto 1 \cdot x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot x} \]
      4. distribute-rgt-out66.7%

        \[\leadsto \color{blue}{x \cdot \left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
      5. unpow266.7%

        \[\leadsto x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      6. associate-*r*66.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}\right) \]
    7. Applied egg-rr66.7%

      \[\leadsto \color{blue}{x \cdot \left(1 + \left(0.16666666666666666 \cdot y\right) \cdot y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification64.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7200:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+154}:\\ \;\;\;\;{x}^{-3}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\ \end{array} \]

Alternative 7: 62.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 550:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 6.3 \cdot 10^{+75}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 550.0)
   (sin x)
   (if (<= y 6.3e+75) (* x x) (+ x (* 0.16666666666666666 (* x (* y y)))))))
double code(double x, double y) {
	double tmp;
	if (y <= 550.0) {
		tmp = sin(x);
	} else if (y <= 6.3e+75) {
		tmp = x * x;
	} else {
		tmp = x + (0.16666666666666666 * (x * (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 <= 550.0d0) then
        tmp = sin(x)
    else if (y <= 6.3d+75) then
        tmp = x * x
    else
        tmp = x + (0.16666666666666666d0 * (x * (y * y)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 550.0) {
		tmp = Math.sin(x);
	} else if (y <= 6.3e+75) {
		tmp = x * x;
	} else {
		tmp = x + (0.16666666666666666 * (x * (y * y)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 550.0:
		tmp = math.sin(x)
	elif y <= 6.3e+75:
		tmp = x * x
	else:
		tmp = x + (0.16666666666666666 * (x * (y * y)))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 550.0)
		tmp = sin(x);
	elseif (y <= 6.3e+75)
		tmp = Float64(x * x);
	else
		tmp = Float64(x + Float64(0.16666666666666666 * Float64(x * Float64(y * y))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 550.0)
		tmp = sin(x);
	elseif (y <= 6.3e+75)
		tmp = x * x;
	else
		tmp = x + (0.16666666666666666 * (x * (y * y)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 550.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 6.3e+75], N[(x * x), $MachinePrecision], N[(x + N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 6.3 \cdot 10^{+75}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;x + 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

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

    if 550 < y < 6.30000000000000036e75

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*75.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/75.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp75.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified75.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr14.3%

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

    if 6.30000000000000036e75 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*45.3%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/45.3%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp45.3%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified45.3%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 53.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) + x} \]
    6. Step-by-step derivation
      1. expm1-log1p-u32.7%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({y}^{2} \cdot x\right)\right)} + x \]
      2. expm1-udef32.7%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({y}^{2} \cdot x\right)} - 1\right)} + x \]
      3. *-commutative32.7%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{x \cdot {y}^{2}}\right)} - 1\right) + x \]
      4. unpow232.7%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{\left(y \cdot y\right)}\right)} - 1\right) + x \]
      5. associate-*r*29.2%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x \cdot y\right) \cdot y}\right)} - 1\right) + x \]
    7. Applied egg-rr29.2%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x \cdot y\right) \cdot y\right)} - 1\right)} + x \]
    8. Step-by-step derivation
      1. expm1-def29.2%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot y\right) \cdot y\right)\right)} + x \]
      2. expm1-log1p41.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(x \cdot y\right) \cdot y\right)} + x \]
      3. associate-*l*53.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot \left(y \cdot y\right)\right)} + x \]
    9. Simplified53.8%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot \left(y \cdot y\right)\right)} + x \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 550:\\ \;\;\;\;\sin x\\ \mathbf{elif}\;y \leq 6.3 \cdot 10^{+75}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 8: 37.3% accurate, 18.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 490:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+75}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 490.0)
   x
   (if (<= y 9e+75) (* x x) (* 0.16666666666666666 (* x (* y y))))))
double code(double x, double y) {
	double tmp;
	if (y <= 490.0) {
		tmp = x;
	} else if (y <= 9e+75) {
		tmp = x * x;
	} else {
		tmp = 0.16666666666666666 * (x * (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 <= 490.0d0) then
        tmp = x
    else if (y <= 9d+75) then
        tmp = x * x
    else
        tmp = 0.16666666666666666d0 * (x * (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 490.0) {
		tmp = x;
	} else if (y <= 9e+75) {
		tmp = x * x;
	} else {
		tmp = 0.16666666666666666 * (x * (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 490.0:
		tmp = x
	elif y <= 9e+75:
		tmp = x * x
	else:
		tmp = 0.16666666666666666 * (x * (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 490.0)
		tmp = x;
	elseif (y <= 9e+75)
		tmp = Float64(x * x);
	else
		tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 490.0)
		tmp = x;
	elseif (y <= 9e+75)
		tmp = x * x;
	else
		tmp = 0.16666666666666666 * (x * (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 490.0], x, If[LessEqual[y, 9e+75], N[(x * x), $MachinePrecision], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 9 \cdot 10^{+75}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*16.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/16.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp16.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified16.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 36.0%

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

    if 490 < y < 9.0000000000000007e75

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*75.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/75.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp75.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified75.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr14.3%

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

    if 9.0000000000000007e75 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*45.3%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/45.3%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp45.3%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified45.3%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 53.8%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot x\right)} \]
    7. Step-by-step derivation
      1. unpow253.8%

        \[\leadsto 0.16666666666666666 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot x\right) \]
      2. *-commutative53.8%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot \left(y \cdot y\right)\right)} \]
    8. Simplified53.8%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification38.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 490:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+75}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 9: 47.3% accurate, 18.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+174}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.9e174

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*14.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/14.1%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp14.1%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified14.1%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr42.4%

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

    if -2.9e174 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*27.2%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/27.2%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp27.2%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified27.2%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 51.5%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative51.5%

        \[\leadsto \color{blue}{x + 0.16666666666666666 \cdot \left({y}^{2} \cdot x\right)} \]
      2. *-un-lft-identity51.5%

        \[\leadsto \color{blue}{1 \cdot x} + 0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) \]
      3. associate-*r*51.5%

        \[\leadsto 1 \cdot x + \color{blue}{\left(0.16666666666666666 \cdot {y}^{2}\right) \cdot x} \]
      4. distribute-rgt-out51.5%

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

        \[\leadsto x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      6. associate-*r*51.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(0.16666666666666666 \cdot y\right) \cdot y}\right) \]
    7. Applied egg-rr51.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + \left(0.16666666666666666 \cdot y\right) \cdot y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+174}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\ \end{array} \]

Alternative 10: 47.4% accurate, 18.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+174}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;x + 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.9e174

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*14.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/14.1%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp14.1%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified14.1%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr42.4%

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

    if -2.9e174 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*27.2%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/27.2%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp27.2%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified27.2%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 51.5%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left({y}^{2} \cdot x\right) + x} \]
    6. Step-by-step derivation
      1. expm1-log1p-u41.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({y}^{2} \cdot x\right)\right)} + x \]
      2. expm1-udef41.3%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({y}^{2} \cdot x\right)} - 1\right)} + x \]
      3. *-commutative41.3%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{x \cdot {y}^{2}}\right)} - 1\right) + x \]
      4. unpow241.3%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{\left(y \cdot y\right)}\right)} - 1\right) + x \]
      5. associate-*r*38.4%

        \[\leadsto 0.16666666666666666 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(x \cdot y\right) \cdot y}\right)} - 1\right) + x \]
    7. Applied egg-rr38.4%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x \cdot y\right) \cdot y\right)} - 1\right)} + x \]
    8. Step-by-step derivation
      1. expm1-def38.6%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot y\right) \cdot y\right)\right)} + x \]
      2. expm1-log1p44.9%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(\left(x \cdot y\right) \cdot y\right)} + x \]
      3. associate-*l*51.5%

        \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot \left(y \cdot y\right)\right)} + x \]
    9. Simplified51.5%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot \left(y \cdot y\right)\right)} + x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+174}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\ \end{array} \]

Alternative 11: 28.7% accurate, 40.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot x\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*16.0%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/16.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp16.0%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified16.0%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Taylor expanded in y around 0 36.0%

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

    if 660 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
    3. Step-by-step derivation
      1. associate-/l*52.2%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
      2. associate-*r/52.2%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
      3. rec-exp52.2%

        \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
    4. Simplified52.2%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
    5. Applied egg-rr19.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 660:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 12: 4.2% accurate, 205.0× speedup?

\[\begin{array}{l} \\ -3 \end{array} \]
(FPCore (x y) :precision binary64 -3.0)
double code(double x, double y) {
	return -3.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -3.0d0
end function
public static double code(double x, double y) {
	return -3.0;
}
def code(x, y):
	return -3.0
function code(x, y)
	return -3.0
end
function tmp = code(x, y)
	tmp = -3.0;
end
code[x_, y_] := -3.0
\begin{array}{l}

\\
-3
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow276.8%

      \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
  4. Simplified76.8%

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
  5. Applied egg-rr4.2%

    \[\leadsto \color{blue}{-3} \]
  6. Final simplification4.2%

    \[\leadsto -3 \]

Alternative 13: 4.7% accurate, 205.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
	return -1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
public static double code(double x, double y) {
	return -1.0;
}
def code(x, y):
	return -1.0
function code(x, y)
	return -1.0
end
function tmp = code(x, y)
	tmp = -1.0;
end
code[x_, y_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow276.8%

      \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
  4. Simplified76.8%

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
  5. Applied egg-rr4.6%

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification4.6%

    \[\leadsto -1 \]

Alternative 14: 4.6% accurate, 205.0× speedup?

\[\begin{array}{l} \\ -0.5 \end{array} \]
(FPCore (x y) :precision binary64 -0.5)
double code(double x, double y) {
	return -0.5;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -0.5d0
end function
public static double code(double x, double y) {
	return -0.5;
}
def code(x, y):
	return -0.5
function code(x, y)
	return -0.5
end
function tmp = code(x, y)
	tmp = -0.5;
end
code[x_, y_] := -0.5
\begin{array}{l}

\\
-0.5
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow276.8%

      \[\leadsto \sin x \cdot \left(1 + 0.16666666666666666 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
  4. Simplified76.8%

    \[\leadsto \sin x \cdot \color{blue}{\left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)} \]
  5. Applied egg-rr4.6%

    \[\leadsto \color{blue}{-0.5} \]
  6. Final simplification4.6%

    \[\leadsto -0.5 \]

Alternative 15: 26.3% accurate, 205.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
	return x;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x
end function
public static double code(double x, double y) {
	return x;
}
def code(x, y):
	return x
function code(x, y)
	return x
end
function tmp = code(x, y)
	tmp = x;
end
code[x_, y_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot x}{y}} \]
  3. Step-by-step derivation
    1. associate-/l*25.8%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{\frac{y}{x}}} \]
    2. associate-*r/25.8%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - \frac{1}{e^{y}}\right)}{\frac{y}{x}}} \]
    3. rec-exp25.8%

      \[\leadsto \frac{0.5 \cdot \left(e^{y} - \color{blue}{e^{-y}}\right)}{\frac{y}{x}} \]
  4. Simplified25.8%

    \[\leadsto \color{blue}{\frac{0.5 \cdot \left(e^{y} - e^{-y}\right)}{\frac{y}{x}}} \]
  5. Taylor expanded in y around 0 27.0%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification27.0%

    \[\leadsto x \]

Reproduce

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