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

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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 (a1 \cdot a1 + \left(a2 \cdot a2\right))_*}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.5

    \[\leadsto \frac{\cos th}{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\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[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  6. Using strategy rm
  7. Applied fma-udef0.5

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

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

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

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

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

Runtime

Time bar (total: 2.4m)Debug logProfile

herbie shell --seed 2018198 +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))))