\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
t_1 := \cos t_0\\
t_2 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_3 := \sin t_2\\
\mathbf{if}\;b \leq -9.389831201206458 \cdot 10^{+153}:\\
\;\;\;\;\left(2 \cdot \left({b}^{2} \cdot t_3\right)\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := 2 \cdot \left({b}^{2} - {a}^{2}\right)\\
\mathbf{if}\;b \leq 1.4457624695447043 \cdot 10^{+75}:\\
\;\;\;\;t_1 \cdot \left(t_3 \cdot t_4\right)\\
\mathbf{elif}\;b \leq 2.5050279053317988 \cdot 10^{+241}:\\
\;\;\;\;t_1 \cdot \left(t_4 \cdot \mathsf{fma}\left(angle, 0.005555555555555556 \cdot \pi, {\pi}^{3} \cdot \left({angle}^{3} \cdot -2.8577960676726107 \cdot 10^{-8}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\right) \cdot \cos t_2\\
\end{array}\\
\end{array}
(FPCore (a b angle) :precision binary64 (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (/ angle 180.0)))
(t_1 (cos t_0))
(t_2 (* 0.005555555555555556 (* angle PI)))
(t_3 (sin t_2)))
(if (<= b -9.389831201206458e+153)
(* (* 2.0 (* (pow b 2.0) t_3)) t_1)
(let* ((t_4 (* 2.0 (- (pow b 2.0) (pow a 2.0)))))
(if (<= b 1.4457624695447043e+75)
(* t_1 (* t_3 t_4))
(if (<= b 2.5050279053317988e+241)
(*
t_1
(*
t_4
(fma
angle
(* 0.005555555555555556 PI)
(* (pow PI 3.0) (* (pow angle 3.0) -2.8577960676726107e-8)))))
(* (* (* 2.0 (* (+ b a) (- b a))) (sin t_0)) (cos t_2))))))))double code(double a, double b, double angle) {
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((double) M_PI) * (angle / 180.0))) * cos(((double) M_PI) * (angle / 180.0));
}
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
double t_1 = cos(t_0);
double t_2 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_3 = sin(t_2);
double tmp;
if (b <= -9.389831201206458e+153) {
tmp = (2.0 * (pow(b, 2.0) * t_3)) * t_1;
} else {
double t_4 = 2.0 * (pow(b, 2.0) - pow(a, 2.0));
double tmp_1;
if (b <= 1.4457624695447043e+75) {
tmp_1 = t_1 * (t_3 * t_4);
} else if (b <= 2.5050279053317988e+241) {
tmp_1 = t_1 * (t_4 * fma(angle, (0.005555555555555556 * ((double) M_PI)), (pow(((double) M_PI), 3.0) * (pow(angle, 3.0) * -2.8577960676726107e-8))));
} else {
tmp_1 = ((2.0 * ((b + a) * (b - a))) * sin(t_0)) * cos(t_2);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus angle
if b < -9.3898312012064578e153Initial program 38.8
Taylor expanded in b around inf 31.1
if -9.3898312012064578e153 < b < 1.44576246954470435e75Initial program 26.3
Taylor expanded in angle around inf 26.4
if 1.44576246954470435e75 < b < 2.50502790533179877e241Initial program 36.0
Taylor expanded in angle around 0 36.7
Simplified36.6
if 2.50502790533179877e241 < b Initial program 33.5
Taylor expanded in angle around inf 35.4
Applied add-sqr-sqrt_binary6450.8
Applied unpow-prod-down_binary6450.8
Applied add-sqr-sqrt_binary6450.8
Applied unpow-prod-down_binary6450.8
Applied difference-of-squares_binary6445.2
Simplified45.2
Simplified24.7
Final simplification28.3
herbie shell --seed 2022067
(FPCore (a b angle)
:name "ab-angle->ABCF B"
:precision binary64
(* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))