| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
\[\sin x \cdot \frac{\sinh y}{x}
\]
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
(FPCore (x y) :precision binary64 (* (sinh y) (/ (sin x) x)))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
double code(double x, double y) {
return sinh(y) * (sin(x) / 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) * (sin(x) / 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) * (Math.sin(x) / x);
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
def code(x, y): return math.sinh(y) * (math.sin(x) / x)
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function code(x, y) return Float64(sinh(y) * Float64(sin(x) / x)) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
function tmp = code(x, y) tmp = sinh(y) * (sin(x) / 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[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\frac{\sin x \cdot \sinh y}{x}
\sinh y \cdot \frac{\sin x}{x}
Results
| Original | 13.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 13.7
Simplified0.1
[Start]13.7 | \[ \frac{\sin x \cdot \sinh y}{x}
\] |
|---|---|
rational.json-simplify-49 [=>]0.1 | \[ \color{blue}{\sinh y \cdot \frac{\sin x}{x}}
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 6720 |
| Alternative 3 | |
|---|---|
| Error | 16.2 |
| Cost | 704 |
| Alternative 4 | |
|---|---|
| Error | 16.6 |
| Cost | 320 |
| Alternative 5 | |
|---|---|
| Error | 31.3 |
| Cost | 64 |
herbie shell --seed 2023064
(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))