Average Error: 0.5 → 0.4
Time: 8.1m
Precision: 64
Internal Precision: 128
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[\frac{\frac{a2 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot a2 + \frac{a1}{\sqrt[3]{\sqrt{2}}} \cdot \frac{a1 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

Derivation

  1. Initial program 0.5

    \[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  2. Taylor expanded around inf 0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}}\]
  3. Simplified0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \color{blue}{a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\cos th}{\sqrt{\color{blue}{1 \cdot 2}}} \cdot \left(a1 \cdot a1\right) + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  6. Applied sqrt-prod0.5

    \[\leadsto \frac{\cos th}{\color{blue}{\sqrt{1} \cdot \sqrt{2}}} \cdot \left(a1 \cdot a1\right) + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  7. Applied associate-/r*0.5

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt{1}}}{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  8. Applied associate-*l/0.5

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt{1}} \cdot \left(a1 \cdot a1\right)}{\sqrt{2}}} + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  9. Simplified0.4

    \[\leadsto \frac{\color{blue}{a1 \cdot \left(\cos th \cdot a1\right)}}{\sqrt{2}} + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  10. Using strategy rm
  11. Applied add-cube-cbrt0.4

    \[\leadsto \frac{a1 \cdot \left(\cos th \cdot a1\right)}{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}}} + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  12. Applied associate-*r*0.4

    \[\leadsto \frac{\color{blue}{\left(a1 \cdot \cos th\right) \cdot a1}}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}} + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  13. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{a1 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{a1}{\sqrt[3]{\sqrt{2}}}} + a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}}\]
  14. Using strategy rm
  15. Applied add-cube-cbrt0.4

    \[\leadsto \frac{a1 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{a1}{\sqrt[3]{\sqrt{2}}} + a2 \cdot \frac{a2 \cdot \cos th}{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}}}\]
  16. Applied associate-/r*0.4

    \[\leadsto \frac{a1 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{a1}{\sqrt[3]{\sqrt{2}}} + a2 \cdot \color{blue}{\frac{\frac{a2 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}}}\]
  17. Final simplification0.4

    \[\leadsto \frac{\frac{a2 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot a2 + \frac{a1}{\sqrt[3]{\sqrt{2}}} \cdot \frac{a1 \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\]

Reproduce

herbie shell --seed 2019088 
(FPCore (a1 a2 th)
  :name "Migdal et al, Equation (64)"
  (+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))