Average Error: 29.3 → 27.6
Time: 19.4s
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 := {b}^{2} - {a}^{2}\\ t_3 := 2 \cdot t_2\\ \mathbf{if}\;t_2 \leq -5.8441155930856096 \cdot 10^{+293}:\\ \;\;\;\;\left(t_3 \cdot \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, {\pi}^{3} \cdot \left({angle}^{3} \cdot -2.8577960676726107 \cdot 10^{-8}\right)\right)\right) \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_4 := \sin t_0\\ \mathbf{if}\;t_2 \leq 1.707276081813076 \cdot 10^{+283}:\\ \;\;\;\;\left(t_3 \cdot t_4\right) \cdot \sqrt[3]{{t_1}^{3}}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_1 \cdot \left(angle \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot b - a \cdot a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_5 := \sqrt[3]{t_1}\\ \left(t_4 \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right) \cdot \left(t_5 \cdot t_5\right) \end{array}\\ \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 := {b}^{2} - {a}^{2}\\
t_3 := 2 \cdot t_2\\
\mathbf{if}\;t_2 \leq -5.8441155930856096 \cdot 10^{+293}:\\
\;\;\;\;\left(t_3 \cdot \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, {\pi}^{3} \cdot \left({angle}^{3} \cdot -2.8577960676726107 \cdot 10^{-8}\right)\right)\right) \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sin t_0\\
\mathbf{if}\;t_2 \leq 1.707276081813076 \cdot 10^{+283}:\\
\;\;\;\;\left(t_3 \cdot t_4\right) \cdot \sqrt[3]{{t_1}^{3}}\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;t_1 \cdot \left(angle \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot b - a \cdot a\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt[3]{t_1}\\
\left(t_4 \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right) \cdot \left(t_5 \cdot t_5\right)
\end{array}\\


\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 (- (pow b 2.0) (pow a 2.0)))
        (t_3 (* 2.0 t_2)))
   (if (<= t_2 -5.8441155930856096e+293)
     (*
      (*
       t_3
       (fma
        0.005555555555555556
        (* angle PI)
        (* (pow PI 3.0) (* (pow angle 3.0) -2.8577960676726107e-8))))
      t_1)
     (let* ((t_4 (sin t_0)))
       (if (<= t_2 1.707276081813076e+283)
         (* (* t_3 t_4) (cbrt (pow t_1 3.0)))
         (if (<= t_2 INFINITY)
           (*
            t_1
            (* angle (* 0.011111111111111112 (* PI (- (* b b) (* a a))))))
           (let* ((t_5 (cbrt t_1)))
             (* (* t_4 (* 2.0 (* (+ b a) (- b a)))) (* t_5 t_5)))))))))
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 = pow(b, 2.0) - pow(a, 2.0);
	double t_3 = 2.0 * t_2;
	double tmp;
	if (t_2 <= -5.8441155930856096e+293) {
		tmp = (t_3 * fma(0.005555555555555556, (angle * ((double) M_PI)), (pow(((double) M_PI), 3.0) * (pow(angle, 3.0) * -2.8577960676726107e-8)))) * t_1;
	} else {
		double t_4 = sin(t_0);
		double tmp_1;
		if (t_2 <= 1.707276081813076e+283) {
			tmp_1 = (t_3 * t_4) * cbrt(pow(t_1, 3.0));
		} else if (t_2 <= ((double) INFINITY)) {
			tmp_1 = t_1 * (angle * (0.011111111111111112 * (((double) M_PI) * ((b * b) - (a * a)))));
		} else {
			double t_5 = cbrt(t_1);
			tmp_1 = (t_4 * (2.0 * ((b + a) * (b - a)))) * (t_5 * t_5);
		}
		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 (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -5.8441155930856096e293

    1. Initial program 30.6

      \[\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 33.4

      \[\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. Simplified33.4

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \color{blue}{\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, {\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 -5.8441155930856096e293 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < 1.70727608181307596e283

    1. Initial program 24.7

      \[\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. Applied add-cbrt-cube_binary6424.7

      \[\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}{\sqrt[3]{\left(\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)}} \]
    3. Simplified24.7

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

    if 1.70727608181307596e283 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < +inf.0

    1. Initial program 29.4

      \[\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 30.4

      \[\leadsto \color{blue}{\left(angle \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot {b}^{2}\right) - 0.011111111111111112 \cdot \left({a}^{2} \cdot \pi\right)\right)\right)} \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    3. Simplified30.4

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

    if +inf.0 < (-.f64 (pow.f64 b 2) (pow.f64 a 2))

    1. Initial program 64.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. Applied add-cube-cbrt_binary6464.0

      \[\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}{\left(\left(\sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)} \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right)} \]
    3. Taylor expanded in angle around 0 64.0

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(\left(\sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)} \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \cdot \sqrt[3]{\color{blue}{1}}\right) \]
    4. Applied unpow2_binary6464.0

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - \color{blue}{a \cdot a}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(\left(\sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)} \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \cdot \sqrt[3]{1}\right) \]
    5. Applied unpow2_binary6464.0

      \[\leadsto \left(\left(2 \cdot \left(\color{blue}{b \cdot b} - a \cdot a\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(\left(\sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)} \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \cdot \sqrt[3]{1}\right) \]
    6. Applied difference-of-squares_binary6425.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{b}^{2} - {a}^{2} \leq -5.8441155930856096 \cdot 10^{+293}:\\ \;\;\;\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, {\pi}^{3} \cdot \left({angle}^{3} \cdot -2.8577960676726107 \cdot 10^{-8}\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\\ \mathbf{elif}\;{b}^{2} - {a}^{2} \leq 1.707276081813076 \cdot 10^{+283}:\\ \;\;\;\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \sqrt[3]{{\cos \left(\pi \cdot \frac{angle}{180}\right)}^{3}}\\ \mathbf{elif}\;{b}^{2} - {a}^{2} \leq \infty:\\ \;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(angle \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot b - a \cdot a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right) \cdot \left(\sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)} \cdot \sqrt[3]{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022068 
(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)))))