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



Bits error versus r



Bits error versus a



Bits error versus b
Results
Initial program 14.7
Applied cos-sum_binary640.3
Taylor expanded in r around 0 0.3
Simplified0.4
Applied frac-sub_binary640.4
Applied associate-/r/_binary640.3
Simplified0.3
Applied quot-tan_binary640.3
Final simplification0.3
herbie shell --seed 2022137
(FPCore (r a b)
:name "rsin B"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))