\[\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\]
↓
\[\frac{r \cdot \sin b}{\mathsf{fma}\left(\sin b, -\sin a, \cos b \cdot \cos a\right)}
\]
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
↓
(FPCore (r a b)
:precision binary64
(/ (* r (sin b)) (fma (sin b) (- (sin a)) (* (cos b) (cos a)))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((a + b));
}
↓
double code(double r, double a, double b) {
return (r * sin(b)) / fma(sin(b), -sin(a), (cos(b) * cos(a)));
}
function code(r, a, b)
return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
end
↓
function code(r, a, b)
return Float64(Float64(r * sin(b)) / fma(sin(b), Float64(-sin(a)), Float64(cos(b) * cos(a))))
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[b], $MachinePrecision] * (-N[Sin[a], $MachinePrecision]) + N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
↓
\frac{r \cdot \sin b}{\mathsf{fma}\left(\sin b, -\sin a, \cos b \cdot \cos a\right)}
Alternatives
| Alternative 1 |
|---|
| Error | 0.5% |
|---|
| Cost | 39040 |
|---|
\[\frac{r \cdot \sin b}{\mathsf{fma}\left(\cos a, \cos b, \sin b \cdot \left(-\sin a\right)\right)}
\]
| Alternative 2 |
|---|
| Error | 0.51% |
|---|
| Cost | 32704 |
|---|
\[r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\]
| Alternative 3 |
|---|
| Error | 0.59% |
|---|
| Cost | 32512 |
|---|
\[\frac{r}{\mathsf{fma}\left(\cos b, \frac{\cos a}{\sin b}, -\sin a\right)}
\]
| Alternative 4 |
|---|
| Error | 0.59% |
|---|
| Cost | 32512 |
|---|
\[\frac{r}{\mathsf{fma}\left(\frac{\cos b}{\sin b}, \cos a, -\sin a\right)}
\]
| Alternative 5 |
|---|
| Error | 0.61% |
|---|
| Cost | 26176 |
|---|
\[\frac{r}{\cos a \cdot \frac{\cos b}{\sin b} - \sin a}
\]
| Alternative 6 |
|---|
| Error | 23.63% |
|---|
| Cost | 13384 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \leq -2.5 \cdot 10^{-5}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 0.0028:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 23.47% |
|---|
| Cost | 13248 |
|---|
\[\sin b \cdot \frac{r}{\cos \left(b - a\right)}
\]
| Alternative 8 |
|---|
| Error | 23.31% |
|---|
| Cost | 13248 |
|---|
\[r \cdot \frac{\sin b}{\cos \left(b + a\right)}
\]
| Alternative 9 |
|---|
| Error | 23.62% |
|---|
| Cost | 6985 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \leq -0.0006 \lor \neg \left(b \leq 0.000115\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 23.65% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \leq -0.000105:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 23.62% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-5}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 0.0007:\\
\;\;\;\;\frac{r \cdot b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 61.04% |
|---|
| Cost | 6592 |
|---|
\[r \cdot \sin b
\]
| Alternative 13 |
|---|
| Error | 39.84% |
|---|
| Cost | 6592 |
|---|
\[r \cdot \tan b
\]
| Alternative 14 |
|---|
| Error | 64.69% |
|---|
| Cost | 576 |
|---|
\[\frac{r}{b \cdot -0.3333333333333333 + \frac{1}{b}}
\]
| Alternative 15 |
|---|
| Error | 65.52% |
|---|
| Cost | 192 |
|---|
\[r \cdot b
\]