?

Average Error: 14.4 → 0.7
Time: 10.1s
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 -0.00037:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-41}:\\ \;\;\;\;y + y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)\\ \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 -0.00037)
     t_0
     (if (<= x 1.7e-41)
       (+ y (* y (* -0.16666666666666666 (pow x 2.0))))
       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 <= -0.00037) {
		tmp = t_0;
	} else if (x <= 1.7e-41) {
		tmp = y + (y * (-0.16666666666666666 * pow(x, 2.0)));
	} 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 <= (-0.00037d0)) then
        tmp = t_0
    else if (x <= 1.7d-41) then
        tmp = y + (y * ((-0.16666666666666666d0) * (x ** 2.0d0)))
    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 <= -0.00037) {
		tmp = t_0;
	} else if (x <= 1.7e-41) {
		tmp = y + (y * (-0.16666666666666666 * Math.pow(x, 2.0)));
	} 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 <= -0.00037:
		tmp = t_0
	elif x <= 1.7e-41:
		tmp = y + (y * (-0.16666666666666666 * math.pow(x, 2.0)))
	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 <= -0.00037)
		tmp = t_0;
	elseif (x <= 1.7e-41)
		tmp = Float64(y + Float64(y * Float64(-0.16666666666666666 * (x ^ 2.0))));
	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 <= -0.00037)
		tmp = t_0;
	elseif (x <= 1.7e-41)
		tmp = y + (y * (-0.16666666666666666 * (x ^ 2.0)));
	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, -0.00037], t$95$0, If[LessEqual[x, 1.7e-41], N[(y + N[(y * N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -0.00037:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.7 \cdot 10^{-41}:\\
\;\;\;\;y + y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Split input into 2 regimes
  2. if x < -3.6999999999999999e-4 or 1.6999999999999999e-41 < x

    1. Initial program 0.4

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

    if -3.6999999999999999e-4 < x < 1.6999999999999999e-41

    1. Initial program 30.8

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

      \[\leadsto \frac{\sin x \cdot \color{blue}{y}}{x} \]
    3. Taylor expanded in x around 0 1.1

      \[\leadsto \color{blue}{y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)} \]
    4. Simplified1.1

      \[\leadsto \color{blue}{y + y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)} \]
      Proof

      [Start]1.1

      \[ y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right) \]

      rational_best_oopsla_all_46_json_45_simplify-7 [=>]1.1

      \[ y + \color{blue}{y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.00037:\\ \;\;\;\;\frac{\sin x \cdot \sinh y}{x}\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-41}:\\ \;\;\;\;y + y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin x \cdot \sinh y}{x}\\ \end{array} \]

Alternatives

Alternative 1
Error1.2
Cost7176
\[\begin{array}{l} t_0 := \frac{\sin x \cdot y}{x}\\ \mathbf{if}\;x \leq -0.001:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.0003:\\ \;\;\;\;y + y \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error1.2
Cost6984
\[\begin{array}{l} t_0 := \frac{\sin x \cdot y}{x}\\ \mathbf{if}\;x \leq -2.8 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-18}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error31.1
Cost64
\[y \]

Error

Reproduce?

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