?

Average Error: 23.61% → 0.55%
Time: 15.0s
Precision: binary64
Cost: 19648

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 23.61

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Simplified23.69

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

    [Start]23.61

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

    associate-/l* [=>]23.69

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

    +-commutative [=>]23.69

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

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

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

    [Start]0.69

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

    distribute-lft-neg-in [<=]0.69

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

    associate-*l/ [=>]0.64

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

    *-lft-identity [=>]0.64

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

    associate-*l/ [<=]0.66

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

    fma-def [=>]0.64

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

    associate-*l/ [=>]0.61

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

    *-lft-identity [=>]0.61

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

    distribute-frac-neg [=>]0.61

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

    associate-*l/ [<=]0.59

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

    distribute-lft-neg-in [=>]0.59

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

    *-inverses [=>]0.59

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

    metadata-eval [=>]0.59

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

    mul-1-neg [=>]0.59

    \[ \frac{r}{\mathsf{fma}\left(\frac{\cos b}{\sin b}, \cos a, \color{blue}{-\sin a}\right)} \]
  5. Applied egg-rr0.55

    \[\leadsto \frac{r}{\color{blue}{0 - \left(\sin a - \frac{\cos a}{\tan b}\right)}} \]
  6. Simplified0.55

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

    [Start]0.55

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

    associate--r- [=>]0.55

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

    +-commutative [=>]0.55

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

    sub0-neg [=>]0.55

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

    sub-neg [<=]0.55

    \[ \frac{r}{\color{blue}{\frac{\cos a}{\tan b} - \sin a}} \]
  7. Final simplification0.55

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

Alternatives

Alternative 1
Error23.8%
Cost13385
\[\begin{array}{l} \mathbf{if}\;b \leq -0.0009 \lor \neg \left(b \leq 0.096\right):\\ \;\;\;\;\sin b \cdot \frac{r}{\cos b}\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos \left(a + b\right)}\\ \end{array} \]
Alternative 2
Error23.8%
Cost13385
\[\begin{array}{l} \mathbf{if}\;b \leq -0.0008 \lor \neg \left(b \leq 0.096\right):\\ \;\;\;\;r \cdot \frac{\sin b}{\cos b}\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos \left(a + b\right)}\\ \end{array} \]
Alternative 3
Error23.8%
Cost13385
\[\begin{array}{l} \mathbf{if}\;b \leq -0.0008 \lor \neg \left(b \leq 0.096\right):\\ \;\;\;\;\frac{r}{\frac{\cos b}{\sin b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos \left(a + b\right)}\\ \end{array} \]
Alternative 4
Error23.66%
Cost13376
\[r \cdot \left(\frac{1}{\cos \left(a + b\right)} \cdot \sin b\right) \]
Alternative 5
Error23.63%
Cost13248
\[\sin b \cdot \frac{r}{\cos \left(a + b\right)} \]
Alternative 6
Error23.61%
Cost13248
\[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
Alternative 7
Error23.69%
Cost13248
\[\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}} \]
Alternative 8
Error45%
Cost13120
\[\sin b \cdot \frac{r}{\cos a} \]
Alternative 9
Error44.72%
Cost7113
\[\begin{array}{l} \mathbf{if}\;b \leq -4.2 \lor \neg \left(b \leq 52\right):\\ \;\;\;\;r \cdot \sin b\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos \left(a + b\right)}\\ \end{array} \]
Alternative 10
Error44.73%
Cost6985
\[\begin{array}{l} \mathbf{if}\;b \leq -1.55 \lor \neg \left(b \leq 180000\right):\\ \;\;\;\;r \cdot \sin b\\ \mathbf{else}:\\ \;\;\;\;r \cdot \frac{b}{\cos a}\\ \end{array} \]
Alternative 11
Error44.75%
Cost6985
\[\begin{array}{l} \mathbf{if}\;b \leq -1.15 \lor \neg \left(b \leq 3300\right):\\ \;\;\;\;r \cdot \sin b\\ \mathbf{else}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \end{array} \]
Alternative 12
Error60.93%
Cost6592
\[r \cdot \sin b \]
Alternative 13
Error65.52%
Cost192
\[r \cdot b \]

Error

Reproduce?

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