?

Average Error: 14.2 → 0.3
Time: 1.2min
Precision: binary64
Cost: 13384

?

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

\mathbf{elif}\;x \leq 4.1 \cdot 10^{-60}:\\
\;\;\;\;\sinh y\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.2
Target0.2
Herbie0.3
\[\sin x \cdot \frac{\sinh y}{x} \]

Derivation?

  1. Split input into 2 regimes
  2. if x < -2.09999999999999994e-8 or 4.10000000000000013e-60 < x

    1. Initial program 0.6

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

    if -2.09999999999999994e-8 < x < 4.10000000000000013e-60

    1. Initial program 31.0

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

      \[\leadsto \frac{\color{blue}{x} \cdot \sinh y}{x} \]
    3. Applied egg-rr0.0

      \[\leadsto \color{blue}{\sinh y + 0} \]
    4. Simplified0.0

      \[\leadsto \color{blue}{\sinh y} \]
      Proof

      [Start]0.0

      \[ \sinh y + 0 \]

      rational_best-simplify-3 [<=]0.0

      \[ \color{blue}{0 + \sinh y} \]

      rational_best-simplify-6 [=>]0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;\frac{\sin x \cdot \sinh y}{x}\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{-60}:\\ \;\;\;\;\sinh y\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin x \cdot \sinh y}{x}\\ \end{array} \]

Alternatives

Alternative 1
Error0.2
Cost13568
\[\frac{0}{\frac{1}{x}} - \sin x \cdot \frac{-\sinh y}{x} \]
Alternative 2
Error0.8
Cost6984
\[\begin{array}{l} t_0 := \frac{\sin x \cdot y}{x}\\ \mathbf{if}\;x \leq -2.2 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-9}:\\ \;\;\;\;\sinh y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error16.6
Cost6728
\[\begin{array}{l} t_0 := \left(y \cdot 0.5 - \left(-1 - y \cdot 0.5\right)\right) + -1\\ \mathbf{if}\;x \leq -550:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+34}:\\ \;\;\;\;\sinh y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error18.2
Cost320
\[\frac{y}{x} \cdot x \]
Alternative 5
Error31.0
Cost64
\[y \]

Error

Reproduce?

herbie shell --seed 2023099 
(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))