| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13120 |
\[\frac{\sinh y}{\frac{x}{\sin x}}
\]

(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
(FPCore (x y) :precision binary64 (/ (sinh y) (/ x (sin x))))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
double code(double x, double y) {
return sinh(y) / (x / sin(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
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sinh(y) / (x / sin(x))
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) {
return Math.sinh(y) / (x / Math.sin(x));
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
def code(x, y): return math.sinh(y) / (x / math.sin(x))
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function code(x, y) return Float64(sinh(y) / Float64(x / sin(x))) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
function tmp = code(x, y) tmp = sinh(y) / (x / sin(x)); end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sin x \cdot \sinh y}{x}
\frac{\sinh y}{\frac{x}{\sin x}}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
| Original | 89.3% |
|---|---|
| Target | 99.9% |
| Herbie | 99.9% |
Initial program 87.7%
Simplified99.9%
[Start]87.7% | \[ \frac{\sin x \cdot \sinh y}{x}
\] |
|---|---|
associate-*r/ [<=]99.9% | \[ \color{blue}{\sin x \cdot \frac{\sinh y}{x}}
\] |
Applied egg-rr99.9%
[Start]99.9% | \[ \sin x \cdot \frac{\sinh y}{x}
\] |
|---|---|
add-log-exp [=>]65.4% | \[ \color{blue}{\log \left(e^{\sin x \cdot \frac{\sinh y}{x}}\right)}
\] |
*-un-lft-identity [=>]65.4% | \[ \log \color{blue}{\left(1 \cdot e^{\sin x \cdot \frac{\sinh y}{x}}\right)}
\] |
log-prod [=>]65.4% | \[ \color{blue}{\log 1 + \log \left(e^{\sin x \cdot \frac{\sinh y}{x}}\right)}
\] |
metadata-eval [=>]65.4% | \[ \color{blue}{0} + \log \left(e^{\sin x \cdot \frac{\sinh y}{x}}\right)
\] |
add-log-exp [<=]99.9% | \[ 0 + \color{blue}{\sin x \cdot \frac{\sinh y}{x}}
\] |
Simplified99.9%
[Start]99.9% | \[ 0 + \sin x \cdot \frac{\sinh y}{x}
\] |
|---|---|
+-lft-identity [=>]99.9% | \[ \color{blue}{\sin x \cdot \frac{\sinh y}{x}}
\] |
*-commutative [=>]99.9% | \[ \color{blue}{\frac{\sinh y}{x} \cdot \sin x}
\] |
associate-/r/ [<=]99.9% | \[ \color{blue}{\frac{\sinh y}{\frac{x}{\sin x}}}
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Accuracy | 86.2% |
| Cost | 19784 |
| Alternative 3 | |
|---|---|
| Accuracy | 86.3% |
| Cost | 19784 |
| Alternative 4 | |
|---|---|
| Accuracy | 86.3% |
| Cost | 19784 |
| Alternative 5 | |
|---|---|
| Accuracy | 72.2% |
| Cost | 19528 |
| Alternative 6 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13120 |
| Alternative 7 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13120 |
| Alternative 8 | |
|---|---|
| Accuracy | 87.1% |
| Cost | 7372 |
| Alternative 9 | |
|---|---|
| Accuracy | 52.6% |
| Cost | 6724 |
| Alternative 10 | |
|---|---|
| Accuracy | 53.1% |
| Cost | 649 |
| Alternative 11 | |
|---|---|
| Accuracy | 48.5% |
| Cost | 648 |
| Alternative 12 | |
|---|---|
| Accuracy | 49.3% |
| Cost | 320 |
| Alternative 13 | |
|---|---|
| Accuracy | 27.1% |
| Cost | 64 |
herbie shell --seed 2023229
(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))