Average Error: 29.6 → 28.3
Time: 10.6s
Precision: binary64
\[\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} \]
\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;
}

Error

Bits error versus a

Bits error versus b

Bits error versus angle

Derivation

  1. Split input into 4 regimes
  2. if b < -9.3898312012064578e153

    1. Initial program 38.8

      \[\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) \]
    2. Taylor expanded in b around inf 31.1

      \[\leadsto \color{blue}{\left(2 \cdot \left({b}^{2} \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right)} \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]

    if -9.3898312012064578e153 < b < 1.44576246954470435e75

    1. Initial program 26.3

      \[\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) \]
    2. Taylor expanded in angle around inf 26.4

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \color{blue}{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]

    if 1.44576246954470435e75 < b < 2.50502790533179877e241

    1. Initial program 36.0

      \[\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) \]
    2. Taylor expanded in angle around 0 36.7

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right) - 2.8577960676726107 \cdot 10^{-8} \cdot \left({angle}^{3} \cdot {\pi}^{3}\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    3. Simplified36.6

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \color{blue}{\mathsf{fma}\left(angle, \pi \cdot 0.005555555555555556, {\pi}^{3} \cdot \left({angle}^{3} \cdot -2.8577960676726107 \cdot 10^{-8}\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]

    if 2.50502790533179877e241 < b

    1. Initial program 33.5

      \[\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) \]
    2. Taylor expanded in angle around inf 35.4

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \color{blue}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \]
    3. Applied add-sqr-sqrt_binary6450.8

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {\color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)}}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    4. Applied unpow-prod-down_binary6450.8

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - \color{blue}{{\left(\sqrt{a}\right)}^{2} \cdot {\left(\sqrt{a}\right)}^{2}}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    5. Applied add-sqr-sqrt_binary6450.8

      \[\leadsto \left(\left(2 \cdot \left({\color{blue}{\left(\sqrt{b} \cdot \sqrt{b}\right)}}^{2} - {\left(\sqrt{a}\right)}^{2} \cdot {\left(\sqrt{a}\right)}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    6. Applied unpow-prod-down_binary6450.8

      \[\leadsto \left(\left(2 \cdot \left(\color{blue}{{\left(\sqrt{b}\right)}^{2} \cdot {\left(\sqrt{b}\right)}^{2}} - {\left(\sqrt{a}\right)}^{2} \cdot {\left(\sqrt{a}\right)}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    7. Applied difference-of-squares_binary6445.2

      \[\leadsto \left(\left(2 \cdot \color{blue}{\left(\left({\left(\sqrt{b}\right)}^{2} + {\left(\sqrt{a}\right)}^{2}\right) \cdot \left({\left(\sqrt{b}\right)}^{2} - {\left(\sqrt{a}\right)}^{2}\right)\right)}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    8. Simplified45.2

      \[\leadsto \left(\left(2 \cdot \left(\color{blue}{\left(a + b\right)} \cdot \left({\left(\sqrt{b}\right)}^{2} - {\left(\sqrt{a}\right)}^{2}\right)\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
    9. Simplified24.7

      \[\leadsto \left(\left(2 \cdot \left(\left(a + b\right) \cdot \color{blue}{\left(b - a\right)}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification28.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -9.389831201206458 \cdot 10^{+153}:\\ \;\;\;\;\left(2 \cdot \left({b}^{2} \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\\ \mathbf{elif}\;b \leq 1.4457624695447043 \cdot 10^{+75}:\\ \;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)\\ \mathbf{elif}\;b \leq 2.5050279053317988 \cdot 10^{+241}:\\ \;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \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 \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\ \end{array} \]

Reproduce

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)))))