Average Error: 20.1 → 20.1
Time: 13.9s
Precision: binary64
Cost: 19904
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\]
\[{b}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
{b}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
(FPCore (a b angle)
 :precision binary64
 (+
  (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
  (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
(FPCore (a b angle)
 :precision binary64
 (+ (pow b 2.0) (pow (* a (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
	return pow((a * sin((angle / 180.0) * ((double) M_PI))), 2.0) + pow((b * cos((angle / 180.0) * ((double) M_PI))), 2.0);
}
double code(double a, double b, double angle) {
	return pow(b, 2.0) + pow((a * sin(angle * (((double) M_PI) * 0.005555555555555556))), 2.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

Alternatives

Alternative 1
Error24.4
Cost14851
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -3.6964674387783653 \cdot 10^{+151}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{angle}{180} \leq -1.7805084439885507 \cdot 10^{-75}:\\ \;\;\;\;{b}^{2} + {\pi}^{2} \cdot \left(\left(a \cdot a\right) \cdot \left(3.08641975308642 \cdot 10^{-05} \cdot \left(angle \cdot angle\right)\right)\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 5.204745464537803 \cdot 10^{+182}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 2
Error24.2
Cost14851
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -3.6964674387783653 \cdot 10^{+151}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{angle}{180} \leq -2.7051897795506334 \cdot 10^{-17}:\\ \;\;\;\;{b}^{2} + {\pi}^{2} \cdot \left(3.08641975308642 \cdot 10^{-05} \cdot \left(\left(a \cdot a\right) \cdot \left(angle \cdot angle\right)\right)\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 5.204745464537803 \cdot 10^{+182}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 3
Error25.2
Cost13953
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5.204745464537803 \cdot 10^{+182}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 4
Error25.2
Cost13953
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5.265500795844197 \cdot 10^{+182}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 5
Error25.2
Cost13953
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 7.163792265325332 \cdot 10^{+182}:\\ \;\;\;\;{b}^{2} + {\left(\frac{angle}{180} \cdot \left(a \cdot \pi\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 6
Error52.8
Cost64
\[0\]
Alternative 7
Error60.7
Cost64
\[1\]

Error

Derivation

  1. Initial program 20.1

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\]
  2. Taylor expanded around 0 20.2

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2}\]
  3. Using strategy rm
  4. Applied div-inv_binary64_41620.2

    \[\leadsto {\left(a \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \pi\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}\]
  5. Applied associate-*l*_binary64_36020.1

    \[\leadsto {\left(a \cdot \sin \color{blue}{\left(angle \cdot \left(\frac{1}{180} \cdot \pi\right)\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2}\]
  6. Simplified20.1

    \[\leadsto {\left(a \cdot \sin \left(angle \cdot \color{blue}{\left(\pi \cdot 0.005555555555555556\right)}\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}\]
  7. Simplified20.1

    \[\leadsto \color{blue}{{b}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}}\]
  8. Final simplification20.1

    \[\leadsto {b}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (a b angle)
  :name "ab-angle->ABCF A"
  :precision binary64
  (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))