Linear.Quaternion:$ccosh from linear-1.19.1.3

Percentage Accurate: 89.0% → 99.9%
Time: 7.7s
Alternatives: 9
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 9 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: 89.0% 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.2%

    \[\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. Add Preprocessing
  5. Final simplification99.9%

    \[\leadsto \frac{\sin x}{x} \cdot \sinh y \]
  6. Add Preprocessing

Alternative 2: 76.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sinh y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\sin x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (sinh y) 2e-5) (* (sin x) (/ y x)) (sinh y)))
double code(double x, double y) {
	double tmp;
	if (sinh(y) <= 2e-5) {
		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 (sinh(y) <= 2d-5) 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 (Math.sinh(y) <= 2e-5) {
		tmp = Math.sin(x) * (y / x);
	} else {
		tmp = Math.sinh(y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if math.sinh(y) <= 2e-5:
		tmp = math.sin(x) * (y / x)
	else:
		tmp = math.sinh(y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (sinh(y) <= 2e-5)
		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 (sinh(y) <= 2e-5)
		tmp = sin(x) * (y / x);
	else
		tmp = sinh(y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-5], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sinh.f64 y) < 2.00000000000000016e-5

    1. Initial program 85.2%

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

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

        \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
      3. *-commutative99.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. Add Preprocessing
    5. Taylor expanded in y around 0 51.4%

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

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

        \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
    7. Simplified72.0%

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

    if 2.00000000000000016e-5 < (sinh.f64 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. Add Preprocessing
    5. Taylor expanded in x around 0 76.8%

      \[\leadsto \color{blue}{1} \cdot \sinh y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sinh y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\sin x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 70.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sinh y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin x}{x} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (sinh y) 2e-5) (* (/ (sin x) x) y) (sinh y)))
double code(double x, double y) {
	double tmp;
	if (sinh(y) <= 2e-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 (sinh(y) <= 2d-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 (Math.sinh(y) <= 2e-5) {
		tmp = (Math.sin(x) / x) * y;
	} else {
		tmp = Math.sinh(y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if math.sinh(y) <= 2e-5:
		tmp = (math.sin(x) / x) * y
	else:
		tmp = math.sinh(y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (sinh(y) <= 2e-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 (sinh(y) <= 2e-5)
		tmp = (sin(x) / x) * y;
	else
		tmp = sinh(y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], 2e-5], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[Sinh[y], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq 2 \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 (sinh.f64 y) < 2.00000000000000016e-5

    1. Initial program 85.2%

      \[\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. Add Preprocessing
    5. Taylor expanded in y around 0 66.1%

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

    if 2.00000000000000016e-5 < (sinh.f64 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. Add Preprocessing
    5. Taylor expanded in x around 0 76.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sinh y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin x}{x} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\sinh y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 58.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sinh y \leq 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 (<= (sinh y) 1e-8)
   (/ y (* x (+ (* x 0.16666666666666666) (/ 1.0 x))))
   (sinh y)))
double code(double x, double y) {
	double tmp;
	if (sinh(y) <= 1e-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 (sinh(y) <= 1d-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 (Math.sinh(y) <= 1e-8) {
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
	} else {
		tmp = Math.sinh(y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if math.sinh(y) <= 1e-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 (sinh(y) <= 1e-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 (sinh(y) <= 1e-8)
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
	else
		tmp = sinh(y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], 1e-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}\;\sinh y \leq 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 (sinh.f64 y) < 1e-8

    1. Initial program 85.2%

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

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

        \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
      3. *-commutative99.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. Add Preprocessing
    5. Taylor expanded in y around 0 51.4%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    7. Simplified66.0%

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

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

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

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

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

    if 1e-8 < (sinh.f64 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. Add Preprocessing
    5. Taylor expanded in x around 0 76.8%

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

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

Alternative 5: 99.8% 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.2%

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

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

      \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
    3. *-commutative99.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. Add Preprocessing
  5. Final simplification99.9%

    \[\leadsto \sin x \cdot \frac{\sinh y}{x} \]
  6. Add Preprocessing

Alternative 6: 49.1% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 310:\\ \;\;\;\;\frac{y}{x \cdot \left(x \cdot 0.16666666666666666 + \frac{1}{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 310.0)
   (/ y (* x (+ (* x 0.16666666666666666) (/ 1.0 x))))
   (/ (/ y x) (* x 0.16666666666666666))))
double code(double x, double y) {
	double tmp;
	if (y <= 310.0) {
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
	} else {
		tmp = (y / x) / (x * 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 <= 310.0d0) then
        tmp = y / (x * ((x * 0.16666666666666666d0) + (1.0d0 / x)))
    else
        tmp = (y / x) / (x * 0.16666666666666666d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 310.0) {
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
	} else {
		tmp = (y / x) / (x * 0.16666666666666666);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 310.0:
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)))
	else:
		tmp = (y / x) / (x * 0.16666666666666666)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 310.0)
		tmp = Float64(y / Float64(x * Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x))));
	else
		tmp = Float64(Float64(y / x) / Float64(x * 0.16666666666666666));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 310.0)
		tmp = y / (x * ((x * 0.16666666666666666) + (1.0 / x)));
	else
		tmp = (y / x) / (x * 0.16666666666666666);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 310.0], N[(y / N[(x * N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 85.3%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. *-commutative85.3%

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

        \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
      3. *-commutative99.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. Add Preprocessing
    5. Taylor expanded in y around 0 51.4%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
    7. Simplified66.0%

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

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

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

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

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

    if 310 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

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

        \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
      3. *-commutative100.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. Add Preprocessing
    5. Taylor expanded in y around 0 4.3%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
    8. Step-by-step derivation
      1. associate-/r/4.3%

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
      2. div-inv4.3%

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

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

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

      \[\leadsto \frac{\frac{y}{x}}{\color{blue}{0.16666666666666666 \cdot x + \frac{1}{x}}} \]
    11. Taylor expanded in x around inf 44.4%

      \[\leadsto \frac{\frac{y}{x}}{\color{blue}{0.16666666666666666 \cdot x}} \]
    12. Step-by-step derivation
      1. *-commutative44.4%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x \cdot 0.16666666666666666}} \]
    13. Simplified44.4%

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

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

Alternative 7: 53.2% accurate, 17.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 240:\\ \;\;\;\;x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 240.0) (* x (/ y x)) (/ (/ y x) (* x 0.16666666666666666))))
double code(double x, double y) {
	double tmp;
	if (y <= 240.0) {
		tmp = x * (y / x);
	} else {
		tmp = (y / x) / (x * 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 <= 240.0d0) then
        tmp = x * (y / x)
    else
        tmp = (y / x) / (x * 0.16666666666666666d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 240.0) {
		tmp = x * (y / x);
	} else {
		tmp = (y / x) / (x * 0.16666666666666666);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 240.0:
		tmp = x * (y / x)
	else:
		tmp = (y / x) / (x * 0.16666666666666666)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 240.0)
		tmp = Float64(x * Float64(y / x));
	else
		tmp = Float64(Float64(y / x) / Float64(x * 0.16666666666666666));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 240.0)
		tmp = x * (y / x);
	else
		tmp = (y / x) / (x * 0.16666666666666666);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 240.0], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 240:\\
\;\;\;\;x \cdot \frac{y}{x}\\

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


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

    1. Initial program 85.3%

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{x} \]
    5. Step-by-step derivation
      1. *-commutative27.1%

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

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

        \[\leadsto \color{blue}{\frac{y}{x} \cdot x} \]
    8. Applied egg-rr56.4%

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

    if 240 < y

    1. Initial program 100.0%

      \[\frac{\sin x \cdot \sinh y}{x} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

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

        \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
      3. *-commutative100.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. Add Preprocessing
    5. Taylor expanded in y around 0 4.3%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
    8. Step-by-step derivation
      1. associate-/r/4.3%

        \[\leadsto \color{blue}{\frac{y}{\frac{x}{\sin x}}} \]
      2. div-inv4.3%

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

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

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

      \[\leadsto \frac{\frac{y}{x}}{\color{blue}{0.16666666666666666 \cdot x + \frac{1}{x}}} \]
    11. Taylor expanded in x around inf 44.4%

      \[\leadsto \frac{\frac{y}{x}}{\color{blue}{0.16666666666666666 \cdot x}} \]
    12. Step-by-step derivation
      1. *-commutative44.4%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x \cdot 0.16666666666666666}} \]
    13. Simplified44.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 240:\\ \;\;\;\;x \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.2% 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.2%

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

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

    \[\leadsto \frac{\color{blue}{x \cdot y}}{x} \]
  5. Step-by-step derivation
    1. *-commutative22.8%

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

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

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

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

    \[\leadsto x \cdot \frac{y}{x} \]
  10. Add Preprocessing

Alternative 9: 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.2%

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

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

      \[\leadsto \color{blue}{\frac{\sinh y}{x} \cdot \sin x} \]
    3. *-commutative99.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. Add Preprocessing
  5. Taylor expanded in y around 0 38.9%

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

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

      \[\leadsto \color{blue}{\frac{y}{x} \cdot \sin x} \]
  7. Simplified61.3%

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

    \[\leadsto \color{blue}{y} \]
  9. Final simplification28.7%

    \[\leadsto y \]
  10. Add Preprocessing

Developer target: 99.8% 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 2024024 
(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))