Average Error: 0.5 → 0.4
Time: 1.3m
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)\]
\[(a1 \cdot a1 + \left(a2 \cdot a2\right))_* \cdot \left(\frac{\frac{\cos th}{\sqrt{\sqrt{2}}}}{\sqrt{\sqrt{\sqrt{2}}}} \cdot \frac{1}{\sqrt{\sqrt{\sqrt{2}}}}\right)\]

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. Simplified0.5

    \[\leadsto \color{blue}{\frac{\cos th}{\sqrt{2}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.5

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

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt{\sqrt{2}}}}{\sqrt{\sqrt{2}}}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt0.5

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot \cos th}}{\sqrt{1} \cdot \sqrt{\sqrt{2}}}}{\sqrt{\sqrt{\sqrt{2}}} \cdot \sqrt{\sqrt{\sqrt{2}}}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  11. Applied times-frac0.5

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

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

    \[\leadsto \left(\color{blue}{\frac{1}{\sqrt{\sqrt{\sqrt{2}}}}} \cdot \frac{\frac{\cos th}{\sqrt{\sqrt{2}}}}{\sqrt{\sqrt{\sqrt{2}}}}\right) \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  14. Final simplification0.4

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

Reproduce

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