Linear.Quaternion:$ccosh from linear-1.19.1.3

Percentage Accurate: 88.9% → 99.9%
Time: 7.9s
Alternatives: 10
Speedup: 1.0×

Specification

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

\\
\frac{\sin x \cdot \sinh y}{x}
\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 10 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: 88.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*l/99.9%

      \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
  4. Final simplification99.9%

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

Alternative 2: 99.9% accurate, 1.0× speedup?

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

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

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  4. Final simplification99.9%

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

Alternative 3: 86.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -500000000000:\\ \;\;\;\;\sinh y\\ \mathbf{elif}\;y \leq 0.00255:\\ \;\;\;\;\sin x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -500000000000.0)
   (sinh y)
   (if (<= y 0.00255) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
	double tmp;
	if (y <= -500000000000.0) {
		tmp = sinh(y);
	} else if (y <= 0.00255) {
		tmp = sin(x) * (y / x);
	} else {
		tmp = sinh(y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-500000000000.0d0)) then
        tmp = sinh(y)
    else if (y <= 0.00255d0) then
        tmp = sin(x) * (y / x)
    else
        tmp = sinh(y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -500000000000.0) {
		tmp = Math.sinh(y);
	} else if (y <= 0.00255) {
		tmp = Math.sin(x) * (y / x);
	} else {
		tmp = Math.sinh(y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -500000000000.0:
		tmp = math.sinh(y)
	elif y <= 0.00255:
		tmp = math.sin(x) * (y / x)
	else:
		tmp = math.sinh(y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -500000000000.0)
		tmp = sinh(y);
	elseif (y <= 0.00255)
		tmp = Float64(sin(x) * Float64(y / x));
	else
		tmp = sinh(y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -500000000000.0)
		tmp = sinh(y);
	elseif (y <= 0.00255)
		tmp = sin(x) * (y / x);
	else
		tmp = sinh(y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -500000000000.0], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 0.00255], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -500000000000:\\
\;\;\;\;\sinh y\\

\mathbf{elif}\;y \leq 0.00255:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\sinh y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5e11 or 0.0025500000000000002 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    4. Taylor expanded in x around 0 75.9%

      \[\leadsto \color{blue}{1} \cdot \sinh y \]

    if -5e11 < y < 0.0025500000000000002

    1. Initial program 78.8%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*r/99.8%

        \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    4. Taylor expanded in y around 0 77.0%

      \[\leadsto \color{blue}{\frac{y \cdot \sin x}{x}} \]
    5. Step-by-step derivation
      1. associate-/l*98.1%

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
      2. associate-/r/98.1%

        \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
    6. Simplified98.1%

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -500000000000:\\ \;\;\;\;\sinh y\\ \mathbf{elif}\;y \leq 0.00255:\\ \;\;\;\;\sin x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \]

Alternative 4: 86.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -500000000000:\\ \;\;\;\;\sinh y\\ \mathbf{elif}\;y \leq 5.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin x}{x} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -500000000000.0)
   (sinh y)
   (if (<= y 5.9e-5) (* (/ (sin x) x) y) (sinh y))))
double code(double x, double y) {
	double tmp;
	if (y <= -500000000000.0) {
		tmp = sinh(y);
	} else if (y <= 5.9e-5) {
		tmp = (sin(x) / x) * y;
	} else {
		tmp = sinh(y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-500000000000.0d0)) then
        tmp = sinh(y)
    else if (y <= 5.9d-5) then
        tmp = (sin(x) / x) * y
    else
        tmp = sinh(y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -500000000000.0) {
		tmp = Math.sinh(y);
	} else if (y <= 5.9e-5) {
		tmp = (Math.sin(x) / x) * y;
	} else {
		tmp = Math.sinh(y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -500000000000.0:
		tmp = math.sinh(y)
	elif y <= 5.9e-5:
		tmp = (math.sin(x) / x) * y
	else:
		tmp = math.sinh(y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -500000000000.0)
		tmp = sinh(y);
	elseif (y <= 5.9e-5)
		tmp = Float64(Float64(sin(x) / x) * y);
	else
		tmp = sinh(y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -500000000000.0)
		tmp = sinh(y);
	elseif (y <= 5.9e-5)
		tmp = (sin(x) / x) * y;
	else
		tmp = sinh(y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -500000000000.0], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 5.9e-5], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -500000000000:\\
\;\;\;\;\sinh y\\

\mathbf{elif}\;y \leq 5.9 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\

\mathbf{else}:\\
\;\;\;\;\sinh y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5e11 or 5.8999999999999998e-5 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    4. Taylor expanded in x around 0 75.9%

      \[\leadsto \color{blue}{1} \cdot \sinh y \]

    if -5e11 < y < 5.8999999999999998e-5

    1. Initial program 78.8%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*r/99.8%

        \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    4. Taylor expanded in y around 0 77.0%

      \[\leadsto \color{blue}{\frac{y \cdot \sin x}{x}} \]
    5. Step-by-step derivation
      1. associate-/l*98.1%

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    6. Simplified98.1%

      \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    7. Step-by-step derivation
      1. clear-num96.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{x}{\sin x}}{y}}} \]
      2. associate-/r/98.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{x}{\sin x}} \cdot y} \]
      3. clear-num98.1%

        \[\leadsto \color{blue}{\frac{\sin x}{x}} \cdot y \]
    8. Applied egg-rr98.1%

      \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -500000000000:\\ \;\;\;\;\sinh y\\ \mathbf{elif}\;y \leq 5.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin x}{x} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \]

Alternative 5: 74.1% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -500000000000:\\
\;\;\;\;\sinh y\\

\mathbf{elif}\;y \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{x \cdot \left(x \cdot 0.16666666666666666 + \frac{1}{x}\right)}\\

\mathbf{else}:\\
\;\;\;\;\sinh y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5e11 or 2.9000000000000002e-8 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \sinh y} \]
    4. Taylor expanded in x around 0 75.9%

      \[\leadsto \color{blue}{1} \cdot \sinh y \]

    if -5e11 < y < 2.9000000000000002e-8

    1. Initial program 78.8%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*r/99.8%

        \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    4. Taylor expanded in y around 0 77.0%

      \[\leadsto \color{blue}{\frac{y \cdot \sin x}{x}} \]
    5. Step-by-step derivation
      1. associate-/l*98.1%

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    6. Simplified98.1%

      \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    7. Step-by-step derivation
      1. clear-num98.1%

        \[\leadsto \frac{y}{\color{blue}{\frac{1}{\frac{\sin x}{x}}}} \]
      2. associate-/r/98.0%

        \[\leadsto \frac{y}{\color{blue}{\frac{1}{\sin x} \cdot x}} \]
    8. Applied egg-rr98.0%

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{\sin x} \cdot x}} \]
    9. Taylor expanded in x around 0 76.8%

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

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

Alternative 6: 54.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.3 \cdot 10^{+165}:\\ \;\;\;\;x \cdot \frac{1}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{y \cdot y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 7.3e+165) (* x (/ 1.0 (/ x y))) (sqrt (* y y))))
double code(double x, double y) {
	double tmp;
	if (y <= 7.3e+165) {
		tmp = x * (1.0 / (x / y));
	} else {
		tmp = sqrt((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 <= 7.3d+165) then
        tmp = x * (1.0d0 / (x / y))
    else
        tmp = sqrt((y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 7.3e+165) {
		tmp = x * (1.0 / (x / y));
	} else {
		tmp = Math.sqrt((y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 7.3e+165:
		tmp = x * (1.0 / (x / y))
	else:
		tmp = math.sqrt((y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 7.3e+165)
		tmp = Float64(x * Float64(1.0 / Float64(x / y)));
	else
		tmp = sqrt(Float64(y * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 7.3e+165)
		tmp = x * (1.0 / (x / y));
	else
		tmp = sqrt((y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 7.3e+165], N[(x * N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.3 \cdot 10^{+165}:\\
\;\;\;\;x \cdot \frac{1}{\frac{x}{y}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\


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

    1. Initial program 88.4%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*r/99.9%

        \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    4. Taylor expanded in y around 0 43.9%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{x} \]
      3. associate-*l*48.4%

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{1}{x}\right)} \]
    8. Step-by-step derivation
      1. div-inv48.5%

        \[\leadsto x \cdot \color{blue}{\frac{y}{x}} \]
      2. clear-num50.3%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x}{y}}} \]
    9. Applied egg-rr50.3%

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x}{y}}} \]

    if 7.3000000000000003e165 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. associate-*r/100.0%

        \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
    4. Taylor expanded in y around 0 5.8%

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

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

        \[\leadsto \color{blue}{\left(y \cdot x\right) \cdot \frac{1}{x}} \]
      2. associate-*l*5.9%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot \frac{1}{x}\right)} \]
      3. div-inv5.9%

        \[\leadsto y \cdot \color{blue}{\frac{x}{x}} \]
      4. *-inverses5.9%

        \[\leadsto y \cdot \color{blue}{1} \]
      5. *-commutative5.9%

        \[\leadsto \color{blue}{1 \cdot y} \]
      6. *-un-lft-identity5.9%

        \[\leadsto \color{blue}{y} \]
      7. add-sqr-sqrt5.9%

        \[\leadsto \color{blue}{\sqrt{y} \cdot \sqrt{y}} \]
      8. sqrt-unprod80.6%

        \[\leadsto \color{blue}{\sqrt{y \cdot y}} \]
    7. Applied egg-rr80.6%

      \[\leadsto \color{blue}{\sqrt{y \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7.3 \cdot 10^{+165}:\\ \;\;\;\;x \cdot \frac{1}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{y \cdot y}\\ \end{array} \]

Alternative 7: 50.6% accurate, 29.3× speedup?

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

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

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  4. Taylor expanded in y around 0 39.3%

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{x} \]
    3. associate-*l*47.5%

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

    \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{1}{x}\right)} \]
  8. Step-by-step derivation
    1. div-inv47.6%

      \[\leadsto x \cdot \color{blue}{\frac{y}{x}} \]
    2. clear-num49.2%

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x}{y}}} \]
  9. Applied egg-rr49.2%

    \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x}{y}}} \]
  10. Final simplification49.2%

    \[\leadsto x \cdot \frac{1}{\frac{x}{y}} \]

Alternative 8: 50.1% accurate, 41.0× speedup?

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

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

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  4. Taylor expanded in y around 0 39.3%

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

    \[\leadsto \frac{\color{blue}{y \cdot x}}{x} \]
  6. Step-by-step derivation
    1. associate-/l*25.8%

      \[\leadsto \color{blue}{\frac{y}{\frac{x}{x}}} \]
    2. associate-/r/47.6%

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

    \[\leadsto \color{blue}{\frac{y}{x} \cdot x} \]
  8. Final simplification47.6%

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

Alternative 9: 49.4% accurate, 41.0× speedup?

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

\\
\frac{x}{\frac{x}{y}}
\end{array}
Derivation
  1. Initial program 89.8%

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  4. Taylor expanded in y around 0 39.3%

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

    \[\leadsto \frac{\color{blue}{y \cdot x}}{x} \]
  6. Step-by-step derivation
    1. associate-/l*25.8%

      \[\leadsto \color{blue}{\frac{y}{\frac{x}{x}}} \]
    2. associate-/r/47.6%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{x}{y}}} \cdot x \]
    2. associate-*l/48.9%

      \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{x}{y}}} \]
    3. *-un-lft-identity48.9%

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

    \[\leadsto \color{blue}{\frac{x}{\frac{x}{y}}} \]
  10. Final simplification48.9%

    \[\leadsto \frac{x}{\frac{x}{y}} \]

Alternative 10: 28.4% accurate, 205.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 89.8%

    \[\frac{\sin x \cdot \sinh y}{x} \]
  2. Step-by-step derivation
    1. associate-*r/99.9%

      \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\sin x \cdot \frac{\sinh y}{x}} \]
  4. Taylor expanded in y around 0 39.3%

    \[\leadsto \color{blue}{\frac{y \cdot \sin x}{x}} \]
  5. Step-by-step derivation
    1. associate-/l*49.4%

      \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    2. associate-/r/59.9%

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
  6. Simplified59.9%

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

    \[\leadsto \color{blue}{y} \]
  8. Final simplification25.8%

    \[\leadsto y \]

Developer target: 99.9% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023196 
(FPCore (x y)
  :name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (* (sin x) (/ (sinh y) x))

  (/ (* (sin x) (sinh y)) x))