Average Error: 19.8 → 19.8
Time: 1.5min
Precision: binary64
Cost: 39744
\[{\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}\]
\[{\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \sin \left(\frac{1}{\sqrt{180}} \cdot \left(\pi \cdot \frac{angle}{\sqrt{180}}\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}
{\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \sin \left(\frac{1}{\sqrt{180}} \cdot \left(\pi \cdot \frac{angle}{\sqrt{180}}\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 (cos (* angle (* PI 0.005555555555555556)))) 2.0)
  (pow
   (* a (sin (* (/ 1.0 (sqrt 180.0)) (* PI (/ angle (sqrt 180.0))))))
   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 * cos(angle * (((double) M_PI) * 0.005555555555555556))), 2.0) + pow((a * sin((1.0 / sqrt(180.0)) * (((double) M_PI) * (angle / sqrt(180.0))))), 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
Error19.8
Cost26688
\[{\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\]
Alternative 2
Error19.8
Cost26688
\[{\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\]
Alternative 3
Error19.8
Cost26688
\[{\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\]
Alternative 4
Error19.9
Cost19904
\[{b}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\]
Alternative 5
Error19.9
Cost19904
\[{\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {b}^{2}\]
Alternative 6
Error23.8
Cost14402
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -7.444707765119839 \cdot 10^{+170}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{angle}{180} \leq 1.9144210421251876 \cdot 10^{+116}:\\ \;\;\;\;{b}^{2} + {\left(\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot a\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 7
Error23.8
Cost14402
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -7.444707765119839 \cdot 10^{+170}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{angle}{180} \leq 1.9144210421251876 \cdot 10^{+116}:\\ \;\;\;\;{b}^{2} + {\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 8
Error23.8
Cost8450
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -7.444707765119839 \cdot 10^{+170}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{angle}{180} \leq 1.9144210421251876 \cdot 10^{+116}:\\ \;\;\;\;{b}^{2} + \left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot a\right)\right)\right) \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 9
Error23.8
Cost8194
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.574094598051373 \cdot 10^{+172}:\\ \;\;\;\;0\\ \mathbf{elif}\;angle \leq 5.769045571076974 \cdot 10^{+118}:\\ \;\;\;\;{b}^{2} + \left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot a\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 10
Error23.8
Cost8066
\[\begin{array}{l} \mathbf{if}\;angle \leq -8.002931884943875 \cdot 10^{+172}:\\ \;\;\;\;0\\ \mathbf{elif}\;angle \leq 3.781945789741156 \cdot 10^{+118}:\\ \;\;\;\;{b}^{2} + \left(angle \cdot \left(\pi \cdot a\right)\right) \cdot \left(\left(angle \cdot \left(\pi \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-05}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 11
Error52.8
Cost64
\[0\]
Alternative 12
Error60.8
Cost64
\[1\]

Error

Time

Derivation

  1. Initial program 19.8

    \[{\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. Using strategy rm
  3. Applied add-sqr-sqrt_binary64_10020.0

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{\color{blue}{\sqrt{180} \cdot \sqrt{180}}} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\]
  4. Applied *-un-lft-identity_binary64_7820.0

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

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

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\sqrt{180}} \cdot \color{blue}{\left(\pi \cdot \frac{angle}{\sqrt{180}}\right)}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\]
  8. Using strategy rm
  9. Applied div-inv_binary64_7519.8

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

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\sqrt{180}} \cdot \left(\pi \cdot \frac{angle}{\sqrt{180}}\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \color{blue}{\left(\pi \cdot 0.005555555555555556\right)}\right)\right)}^{2}\]
  12. Using strategy rm
  13. Applied pow1_binary64_13919.8

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

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

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

Reproduce

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