Average Error: 30.9 → 31.2
Time: 15.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} \mathbf{if}\;\frac{angle}{180} \leq -1.0003839562376489 \cdot 10^{+88}:\\ \;\;\;\;0 \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \log \left(e^{\cos \left(\frac{angle}{180} \cdot \pi\right)}\right)\\ \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}
\mathbf{if}\;\frac{angle}{180} \leq -1.0003839562376489 \cdot 10^{+88}:\\
\;\;\;\;0 \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \log \left(e^{\cos \left(\frac{angle}{180} \cdot \pi\right)}\right)\\

\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
 (if (<= (/ angle 180.0) -1.0003839562376489e+88)
   (* 0.0 (cos (* (/ angle 180.0) PI)))
   (*
    (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI)))
    (log (exp (cos (* (/ angle 180.0) PI)))))))
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 tmp;
	if ((angle / 180.0) <= -1.0003839562376489e+88) {
		tmp = 0.0 * cos((angle / 180.0) * ((double) M_PI));
	} else {
		tmp = ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin((angle / 180.0) * ((double) M_PI))) * log(exp(cos((angle / 180.0) * ((double) M_PI))));
	}
	return tmp;
}

Error

Bits error versus a

Bits error versus b

Bits error versus angle

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 angle 180) < -1.0003839562376489e88

    1. Initial program 52.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 around 0 53.6

      \[\leadsto \color{blue}{0} \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\]

    if -1.0003839562376489e88 < (/.f64 angle 180)

    1. Initial program 27.1

      \[\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. Using strategy rm
    3. Applied add-log-exp_binary6427.1

      \[\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}{\log \left(e^{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -1.0003839562376489 \cdot 10^{+88}:\\ \;\;\;\;0 \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \log \left(e^{\cos \left(\frac{angle}{180} \cdot \pi\right)}\right)\\ \end{array}\]

Reproduce

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