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

Error

Bits error versus r

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.7

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

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos a \cdot \cos b - \sin a \cdot \sin b}} \]
  3. Applied frac-2neg_binary640.3

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

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

    \[\leadsto \frac{-\sin b \cdot r}{\color{blue}{\mathsf{fma}\left(\cos a, -\cos b, \sin b \cdot \sin a\right)}} \]
  6. Applied *-un-lft-identity_binary640.3

    \[\leadsto \frac{-\sin b \cdot r}{\color{blue}{1 \cdot \mathsf{fma}\left(\cos a, -\cos b, \sin b \cdot \sin a\right)}} \]
  7. Applied distribute-rgt-neg-in_binary640.3

    \[\leadsto \frac{\color{blue}{\sin b \cdot \left(-r\right)}}{1 \cdot \mathsf{fma}\left(\cos a, -\cos b, \sin b \cdot \sin a\right)} \]
  8. Applied times-frac_binary640.3

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

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

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

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

Reproduce

herbie shell --seed 2022137 
(FPCore (r a b)
  :name "rsin A"
  :precision binary64
  (/ (* r (sin b)) (cos (+ a b))))