?

Average Error: 15.0 → 0.3
Time: 13.9s
Precision: binary64
Cost: 32704

?

\[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
\[\frac{\sin b}{\cos a \cdot \cos b - \sin b \cdot \sin a} \cdot r \]
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
(FPCore (r a b)
 :precision binary64
 (* (/ (sin b) (- (* (cos a) (cos b)) (* (sin b) (sin a)))) r))
double code(double r, double a, double b) {
	return (r * sin(b)) / cos((a + b));
}
double code(double r, double a, double b) {
	return (sin(b) / ((cos(a) * cos(b)) - (sin(b) * sin(a)))) * r;
}
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (r * sin(b)) / cos((a + b))
end function
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (sin(b) / ((cos(a) * cos(b)) - (sin(b) * sin(a)))) * r
end function
public static double code(double r, double a, double b) {
	return (r * Math.sin(b)) / Math.cos((a + b));
}
public static double code(double r, double a, double b) {
	return (Math.sin(b) / ((Math.cos(a) * Math.cos(b)) - (Math.sin(b) * Math.sin(a)))) * r;
}
def code(r, a, b):
	return (r * math.sin(b)) / math.cos((a + b))
def code(r, a, b):
	return (math.sin(b) / ((math.cos(a) * math.cos(b)) - (math.sin(b) * math.sin(a)))) * r
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
end
function code(r, a, b)
	return Float64(Float64(sin(b) / Float64(Float64(cos(a) * cos(b)) - Float64(sin(b) * sin(a)))) * r)
end
function tmp = code(r, a, b)
	tmp = (r * sin(b)) / cos((a + b));
end
function tmp = code(r, a, b)
	tmp = (sin(b) / ((cos(a) * cos(b)) - (sin(b) * sin(a)))) * r;
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[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[a], $MachinePrecision] * N[Cos[b], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\frac{\sin b}{\cos a \cdot \cos b - \sin b \cdot \sin a} \cdot r

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 15.0

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Applied egg-rr0.3

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos a \cdot \cos b + \left(-\sin a\right) \cdot \sin b}} \]
  3. Simplified0.3

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\mathsf{fma}\left(\sin b, -\sin a, \cos b \cdot \cos a\right)}} \]
    Proof

    [Start]0.3

    \[ \frac{r \cdot \sin b}{\cos a \cdot \cos b + \left(-\sin a\right) \cdot \sin b} \]

    +-commutative [=>]0.3

    \[ \frac{r \cdot \sin b}{\color{blue}{\left(-\sin a\right) \cdot \sin b + \cos a \cdot \cos b}} \]

    *-commutative [=>]0.3

    \[ \frac{r \cdot \sin b}{\color{blue}{\sin b \cdot \left(-\sin a\right)} + \cos a \cdot \cos b} \]

    fma-def [=>]0.3

    \[ \frac{r \cdot \sin b}{\color{blue}{\mathsf{fma}\left(\sin b, -\sin a, \cos a \cdot \cos b\right)}} \]

    *-commutative [=>]0.3

    \[ \frac{r \cdot \sin b}{\mathsf{fma}\left(\sin b, -\sin a, \color{blue}{\cos b \cdot \cos a}\right)} \]
  4. Taylor expanded in r around 0 0.3

    \[\leadsto \color{blue}{\frac{\sin b \cdot r}{-1 \cdot \left(\sin a \cdot \sin b\right) + \cos a \cdot \cos b}} \]
  5. Simplified0.3

    \[\leadsto \color{blue}{\frac{\sin b}{\cos a \cdot \cos b - \sin b \cdot \sin a} \cdot r} \]
    Proof

    [Start]0.3

    \[ \frac{\sin b \cdot r}{-1 \cdot \left(\sin a \cdot \sin b\right) + \cos a \cdot \cos b} \]

    associate-/l* [=>]0.4

    \[ \color{blue}{\frac{\sin b}{\frac{-1 \cdot \left(\sin a \cdot \sin b\right) + \cos a \cdot \cos b}{r}}} \]

    associate-/r/ [=>]0.3

    \[ \color{blue}{\frac{\sin b}{-1 \cdot \left(\sin a \cdot \sin b\right) + \cos a \cdot \cos b} \cdot r} \]

    +-commutative [=>]0.3

    \[ \frac{\sin b}{\color{blue}{\cos a \cdot \cos b + -1 \cdot \left(\sin a \cdot \sin b\right)}} \cdot r \]

    *-commutative [<=]0.3

    \[ \frac{\sin b}{\color{blue}{\cos b \cdot \cos a} + -1 \cdot \left(\sin a \cdot \sin b\right)} \cdot r \]

    *-commutative [<=]0.3

    \[ \frac{\sin b}{\cos b \cdot \cos a + -1 \cdot \color{blue}{\left(\sin b \cdot \sin a\right)}} \cdot r \]

    mul-1-neg [=>]0.3

    \[ \frac{\sin b}{\cos b \cdot \cos a + \color{blue}{\left(-\sin b \cdot \sin a\right)}} \cdot r \]

    unsub-neg [=>]0.3

    \[ \frac{\sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \cdot r \]

    *-commutative [=>]0.3

    \[ \frac{\sin b}{\color{blue}{\cos a \cdot \cos b} - \sin b \cdot \sin a} \cdot r \]
  6. Final simplification0.3

    \[\leadsto \frac{\sin b}{\cos a \cdot \cos b - \sin b \cdot \sin a} \cdot r \]

Alternatives

Alternative 1
Error0.4
Cost26176
\[\frac{r}{\cos a \cdot \frac{\cos b}{\sin b} - \sin a} \]
Alternative 2
Error15.2
Cost13385
\[\begin{array}{l} \mathbf{if}\;a \leq -22 \lor \neg \left(a \leq 9.5 \cdot 10^{-6}\right):\\ \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
Alternative 3
Error15.2
Cost13376
\[\sin b \cdot \left(r \cdot \frac{1}{\cos \left(b - a\right)}\right) \]
Alternative 4
Error15.0
Cost13248
\[r \cdot \frac{\sin b}{\cos \left(b + a\right)} \]
Alternative 5
Error15.2
Cost6985
\[\begin{array}{l} \mathbf{if}\;b \leq -8.6 \cdot 10^{-6} \lor \neg \left(b \leq 0.003\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{\frac{\cos a}{r}}\\ \end{array} \]
Alternative 6
Error15.2
Cost6985
\[\begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{-6} \lor \neg \left(b \leq 0.003\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r}{\frac{\cos a}{b}}\\ \end{array} \]
Alternative 7
Error15.2
Cost6985
\[\begin{array}{l} \mathbf{if}\;b \leq -7.3 \cdot 10^{-6} \lor \neg \left(b \leq 0.003\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot r}{\cos a}\\ \end{array} \]
Alternative 8
Error39.8
Cost6592
\[\sin b \cdot r \]
Alternative 9
Error26.0
Cost6592
\[r \cdot \tan b \]
Alternative 10
Error42.1
Cost576
\[\frac{r}{b \cdot -0.3333333333333333 + \frac{1}{b}} \]
Alternative 11
Error42.7
Cost192
\[b \cdot r \]

Error

Reproduce?

herbie shell --seed 2023041 
(FPCore (r a b)
  :name "rsin A (should all be same)"
  :precision binary64
  (/ (* r (sin b)) (cos (+ a b))))