| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
\[\cosh x \cdot \frac{\sin y}{y}
\]
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
(FPCore (x y) :precision binary64 (/ (sin y) (/ y (cosh x))))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
double code(double x, double y) {
return sin(y) / (y / cosh(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(y) / (y / cosh(x))
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
public static double code(double x, double y) {
return Math.sin(y) / (y / Math.cosh(x));
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
def code(x, y): return math.sin(y) / (y / math.cosh(x))
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function code(x, y) return Float64(sin(y) / Float64(y / cosh(x))) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
function tmp = code(x, y) tmp = sin(y) / (y / cosh(x)); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[Sin[y], $MachinePrecision] / N[(y / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\cosh x \cdot \frac{\sin y}{y}
\frac{\sin y}{\frac{y}{\cosh x}}
Results
| Original | 0.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 0.2
Applied egg-rr0.2
Applied egg-rr29.7
Simplified0.2
[Start]29.7 | \[ e^{\mathsf{log1p}\left(\sin y \cdot \frac{\cosh x}{y}\right)} - 1
\] |
|---|---|
expm1-def [=>]0.3 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin y \cdot \frac{\cosh x}{y}\right)\right)}
\] |
expm1-log1p [=>]0.3 | \[ \color{blue}{\sin y \cdot \frac{\cosh x}{y}}
\] |
associate-*r/ [=>]0.2 | \[ \color{blue}{\frac{\sin y \cdot \cosh x}{y}}
\] |
associate-/l* [=>]0.2 | \[ \color{blue}{\frac{\sin y}{\frac{y}{\cosh x}}}
\] |
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 1.0 |
| Cost | 7104 |
| Alternative 3 | |
|---|---|
| Error | 1.3 |
| Cost | 6592 |
| Alternative 4 | |
|---|---|
| Error | 30.9 |
| Cost | 1216 |
| Alternative 5 | |
|---|---|
| Error | 31.7 |
| Cost | 448 |
| Alternative 6 | |
|---|---|
| Error | 31.9 |
| Cost | 64 |
herbie shell --seed 2023010
(FPCore (x y)
:name "Linear.Quaternion:$csinh from linear-1.19.1.3"
:precision binary64
:herbie-target
(/ (* (cosh x) (sin y)) y)
(* (cosh x) (/ (sin y) y)))