| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 1088 |
\[\frac{\frac{y}{y + x}}{x + \left(y + 1\right)} \cdot \frac{x}{y + x}
\]
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y) :precision binary64 (/ (/ (* x (/ y (+ y x))) (+ y x)) (+ x (+ y 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
return ((x * (y / (y + x))) / (y + x)) / (x + (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y / (y + x))) / (y + x)) / (x + (y + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
return ((x * (y / (y + x))) / (y + x)) / (x + (y + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y): return ((x * (y / (y + x))) / (y + x)) / (x + (y + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function code(x, y) return Float64(Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(y + x)) / Float64(x + Float64(y + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
function tmp = code(x, y) tmp = ((x * (y / (y + x))) / (y + x)) / (x + (y + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\frac{\frac{x \cdot \frac{y}{y + x}}{y + x}}{x + \left(y + 1\right)}
Results
| Original | 68.1% |
|---|---|
| Target | 99.8% |
| Herbie | 99.8% |
Initial program 68.1%
Simplified73.2%
[Start]68.1 | \[ \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\] |
|---|---|
associate-/r* [=>]73.2 | \[ \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}}
\] |
associate-+l+ [=>]73.2 | \[ \frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\color{blue}{x + \left(y + 1\right)}}
\] |
Applied egg-rr99.8%
[Start]73.2 | \[ \frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{x + \left(y + 1\right)}
\] |
|---|---|
times-frac [=>]99.8 | \[ \frac{\color{blue}{\frac{x}{x + y} \cdot \frac{y}{x + y}}}{x + \left(y + 1\right)}
\] |
Simplified99.8%
[Start]99.8 | \[ \frac{\frac{x}{x + y} \cdot \frac{y}{x + y}}{x + \left(y + 1\right)}
\] |
|---|---|
*-commutative [<=]99.8 | \[ \frac{\color{blue}{\frac{y}{x + y} \cdot \frac{x}{x + y}}}{x + \left(y + 1\right)}
\] |
associate-*r/ [=>]99.8 | \[ \frac{\color{blue}{\frac{\frac{y}{x + y} \cdot x}{x + y}}}{x + \left(y + 1\right)}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 1088 |
| Alternative 2 | |
|---|---|
| Accuracy | 73.1% |
| Cost | 980 |
| Alternative 3 | |
|---|---|
| Accuracy | 80.2% |
| Cost | 976 |
| Alternative 4 | |
|---|---|
| Accuracy | 71.4% |
| Cost | 849 |
| Alternative 5 | |
|---|---|
| Accuracy | 64.6% |
| Cost | 848 |
| Alternative 6 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 844 |
| Alternative 7 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 844 |
| Alternative 8 | |
|---|---|
| Accuracy | 81.4% |
| Cost | 836 |
| Alternative 9 | |
|---|---|
| Accuracy | 77.0% |
| Cost | 712 |
| Alternative 10 | |
|---|---|
| Accuracy | 81.4% |
| Cost | 708 |
| Alternative 11 | |
|---|---|
| Accuracy | 44.0% |
| Cost | 589 |
| Alternative 12 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 580 |
| Alternative 13 | |
|---|---|
| Accuracy | 4.3% |
| Cost | 192 |
| Alternative 14 | |
|---|---|
| Accuracy | 26.5% |
| Cost | 192 |
herbie shell --seed 2023140
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))