Average Error: 0.5 → 0.5
Time: 50.4s
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{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}} + \frac{a1 \cdot \cos th}{\sqrt{2}} \cdot a1\]

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 \color{blue}{\frac{{a1}^{2} \cdot \cos th}{\sqrt{2}}} + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  3. Simplified0.5

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

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

    \[\leadsto \color{blue}{\frac{\cos th \cdot a1}{\sqrt{2}} \cdot a1} + \frac{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}}\]
  8. Final simplification0.5

    \[\leadsto \frac{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}} + \frac{a1 \cdot \cos th}{\sqrt{2}} \cdot a1\]

Reproduce

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