| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 19584 |
\[{\sin B}^{-1} - \frac{x}{\tan B}
\]

(FPCore (B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (- (pow (sin B) -1.0) (/ 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 pow(sin(B), -1.0) - (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 = (sin(b) ** (-1.0d0)) - (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.pow(Math.sin(B), -1.0) - (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.pow(math.sin(B), -1.0) - (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((sin(B) ^ -1.0) - Float64(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 = (sin(B) ^ -1.0) - (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[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\begin{array}{l}
\\
{\sin B}^{-1} - \frac{x}{\tan B}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
Initial program 99.7%
Simplified99.8%
[Start]99.7% | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\] |
|---|---|
+-commutative [=>]99.7% | \[ \color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}
\] |
unsub-neg [=>]99.7% | \[ \color{blue}{\frac{1}{\sin B} - x \cdot \frac{1}{\tan B}}
\] |
associate-*r/ [=>]99.8% | \[ \frac{1}{\sin B} - \color{blue}{\frac{x \cdot 1}{\tan B}}
\] |
*-rgt-identity [=>]99.8% | \[ \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B}
\] |
Applied egg-rr99.8%
[Start]99.8% | \[ \frac{1}{\sin B} - \frac{x}{\tan B}
\] |
|---|---|
inv-pow [=>]99.8% | \[ \color{blue}{{\sin B}^{-1}} - \frac{x}{\tan B}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 19584 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.4% |
| Cost | 7240 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.4% |
| Cost | 7113 |
| Alternative 5 | |
|---|---|
| Accuracy | 75.2% |
| Cost | 6856 |
| Alternative 6 | |
|---|---|
| Accuracy | 51.9% |
| Cost | 704 |
| Alternative 7 | |
|---|---|
| Accuracy | 50.5% |
| Cost | 521 |
| Alternative 8 | |
|---|---|
| Accuracy | 51.5% |
| Cost | 320 |
| Alternative 9 | |
|---|---|
| Accuracy | 2.7% |
| Cost | 192 |
| Alternative 10 | |
|---|---|
| Accuracy | 26.2% |
| Cost | 192 |
herbie shell --seed 2023167
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))