| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 6720 |
\[x \cdot \frac{\sin y}{y}
\]
(FPCore (x y) :precision binary64 (* x (/ (sin y) y)))
(FPCore (x y) :precision binary64 (/ x (/ y (sin y))))
double code(double x, double y) {
return x * (sin(y) / y);
}
double code(double x, double y) {
return x / (y / sin(y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (sin(y) / y)
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y / sin(y))
end function
public static double code(double x, double y) {
return x * (Math.sin(y) / y);
}
public static double code(double x, double y) {
return x / (y / Math.sin(y));
}
def code(x, y): return x * (math.sin(y) / y)
def code(x, y): return x / (y / math.sin(y))
function code(x, y) return Float64(x * Float64(sin(y) / y)) end
function code(x, y) return Float64(x / Float64(y / sin(y))) end
function tmp = code(x, y) tmp = x * (sin(y) / y); end
function tmp = code(x, y) tmp = x / (y / sin(y)); end
code[x_, y_] := N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(x / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \frac{\sin y}{y}
\frac{x}{\frac{y}{\sin y}}
Results
Initial program 99.8%
Applied egg-rr99.8%
[Start]99.8 | \[ x \cdot \frac{\sin y}{y}
\] |
|---|---|
clear-num [=>]99.8 | \[ x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}
\] |
un-div-inv [=>]99.8 | \[ \color{blue}{\frac{x}{\frac{y}{\sin y}}}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 6720 |
| Alternative 2 | |
|---|---|
| Accuracy | 63.0% |
| Cost | 841 |
| Alternative 3 | |
|---|---|
| Accuracy | 62.8% |
| Cost | 713 |
| Alternative 4 | |
|---|---|
| Accuracy | 62.2% |
| Cost | 585 |
| Alternative 5 | |
|---|---|
| Accuracy | 62.2% |
| Cost | 584 |
| Alternative 6 | |
|---|---|
| Accuracy | 63.0% |
| Cost | 576 |
| Alternative 7 | |
|---|---|
| Accuracy | 50.8% |
| Cost | 64 |
herbie shell --seed 2023157
(FPCore (x y)
:name "Linear.Quaternion:$cexp from linear-1.19.1.3"
:precision binary64
(* x (/ (sin y) y)))