| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
\[\frac{1}{\sin B} - \frac{x}{\tan B}
\]
(FPCore (B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (/ (- (/ (tan B) (sin B)) x) (tan B)))
double code(double B, double x) {
return -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
double code(double B, double x) {
return ((tan(B) / sin(B)) - x) / tan(B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end function
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((tan(b) / sin(b)) - x) / tan(b)
end function
public static double code(double B, double x) {
return -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
public static double code(double B, double x) {
return ((Math.tan(B) / Math.sin(B)) - x) / Math.tan(B);
}
def code(B, x): return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
def code(B, x): return ((math.tan(B) / math.sin(B)) - x) / math.tan(B)
function code(B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))) end
function code(B, x) return Float64(Float64(Float64(tan(B) / sin(B)) - x) / tan(B)) end
function tmp = code(B, x) tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end
function tmp = code(B, x) tmp = ((tan(B) / sin(B)) - x) / tan(B); end
code[B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[B_, x_] := N[(N[(N[(N[Tan[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{\frac{\tan B}{\sin B} - x}{\tan B}
Results
Initial program 99.6%
Simplified99.7%
[Start]99.6 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\] |
|---|---|
+-commutative [=>]99.6 | \[ \color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}
\] |
unsub-neg [=>]99.6 | \[ \color{blue}{\frac{1}{\sin B} - x \cdot \frac{1}{\tan B}}
\] |
associate-*r/ [=>]99.7 | \[ \frac{1}{\sin B} - \color{blue}{\frac{x \cdot 1}{\tan B}}
\] |
*-rgt-identity [=>]99.7 | \[ \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B}
\] |
Applied egg-rr99.7%
[Start]99.7 | \[ \frac{1}{\sin B} - \frac{x}{\tan B}
\] |
|---|---|
frac-sub [=>]87.4 | \[ \color{blue}{\frac{1 \cdot \tan B - \sin B \cdot x}{\sin B \cdot \tan B}}
\] |
associate-/r* [=>]99.7 | \[ \color{blue}{\frac{\frac{1 \cdot \tan B - \sin B \cdot x}{\sin B}}{\tan B}}
\] |
*-un-lft-identity [<=]99.7 | \[ \frac{\frac{\color{blue}{\tan B} - \sin B \cdot x}{\sin B}}{\tan B}
\] |
*-commutative [=>]99.7 | \[ \frac{\frac{\tan B - \color{blue}{x \cdot \sin B}}{\sin B}}{\tan B}
\] |
Applied egg-rr99.7%
[Start]99.7 | \[ \frac{\frac{\tan B - x \cdot \sin B}{\sin B}}{\tan B}
\] |
|---|---|
div-sub [=>]99.7 | \[ \frac{\color{blue}{\frac{\tan B}{\sin B} - \frac{x \cdot \sin B}{\sin B}}}{\tan B}
\] |
sub-neg [=>]99.7 | \[ \frac{\color{blue}{\frac{\tan B}{\sin B} + \left(-\frac{x \cdot \sin B}{\sin B}\right)}}{\tan B}
\] |
*-commutative [=>]99.7 | \[ \frac{\frac{\tan B}{\sin B} + \left(-\frac{\color{blue}{\sin B \cdot x}}{\sin B}\right)}{\tan B}
\] |
associate-/l* [=>]99.7 | \[ \frac{\frac{\tan B}{\sin B} + \left(-\color{blue}{\frac{\sin B}{\frac{\sin B}{x}}}\right)}{\tan B}
\] |
Simplified99.7%
[Start]99.7 | \[ \frac{\frac{\tan B}{\sin B} + \left(-\frac{\sin B}{\frac{\sin B}{x}}\right)}{\tan B}
\] |
|---|---|
sub-neg [<=]99.7 | \[ \frac{\color{blue}{\frac{\tan B}{\sin B} - \frac{\sin B}{\frac{\sin B}{x}}}}{\tan B}
\] |
associate-/r/ [=>]99.7 | \[ \frac{\frac{\tan B}{\sin B} - \color{blue}{\frac{\sin B}{\sin B} \cdot x}}{\tan B}
\] |
*-inverses [=>]99.7 | \[ \frac{\frac{\tan B}{\sin B} - \color{blue}{1} \cdot x}{\tan B}
\] |
*-lft-identity [=>]99.7 | \[ \frac{\frac{\tan B}{\sin B} - \color{blue}{x}}{\tan B}
\] |
Final simplification99.7%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 7241 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.5% |
| Cost | 7112 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.1% |
| Cost | 6985 |
| Alternative 5 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 6921 |
| Alternative 6 | |
|---|---|
| Accuracy | 75.1% |
| Cost | 6856 |
| Alternative 7 | |
|---|---|
| Accuracy | 49.6% |
| Cost | 521 |
| Alternative 8 | |
|---|---|
| Accuracy | 51.5% |
| Cost | 320 |
| Alternative 9 | |
|---|---|
| Accuracy | 26.4% |
| Cost | 192 |
herbie shell --seed 2023164
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))