Average Error: 30.8 → 30.8
Time: 23.3s
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 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\ \left(2 \cdot \left({b}^{2} \cdot t_0\right) - 2 \cdot \left(t_0 \cdot {a}^{2}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\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}
t_0 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\left(2 \cdot \left({b}^{2} \cdot t_0\right) - 2 \cdot \left(t_0 \cdot {a}^{2}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\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
 (let* ((t_0 (sin (* 0.005555555555555556 (* angle PI)))))
   (*
    (- (* 2.0 (* (pow b 2.0) t_0)) (* 2.0 (* t_0 (pow a 2.0))))
    (cos (* PI (/ angle 180.0))))))
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 = sin(0.005555555555555556 * (angle * ((double) M_PI)));
	return ((2.0 * (pow(b, 2.0) * t_0)) - (2.0 * (t_0 * pow(a, 2.0)))) * cos(((double) M_PI) * (angle / 180.0));
}

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. Initial program 30.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 0 30.8

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

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

Reproduce

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