Average Error: 0.5 → 0.4
Time: 3.4m
Precision: 64
Internal Precision: 384
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[\frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}} + \frac{a1 \cdot \cos th}{\frac{\sqrt{2}}{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. Applied simplify0.5

    \[\leadsto \color{blue}{\frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2 + a1 \cdot a1\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 \left(a2 \cdot a2 + a1 \cdot a1\right)\]
  5. Applied associate-/r*0.5

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt{\sqrt{2}}}}{\sqrt{\sqrt{2}}}} \cdot \left(a2 \cdot a2 + a1 \cdot a1\right)\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.5

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

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

    \[\leadsto \frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}} + \color{blue}{\frac{a1 \cdot \cos th}{\frac{\sqrt{2}}{a1}}}\]
  10. Removed slow pow expressions.

Runtime

Time bar (total: 3.4m)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(FPCore (a1 a2 th)
  :name "Migdal et al, Equation (64)"
  (+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))