Why define PI = 4*ATAN(1.d0)

ccook picture ccook · Jan 28, 2010 · Viewed 54.6k times · Source

What is the motivation for defining PI as

PI=4.D0*DATAN(1.D0)

within Fortran 77 code? I understand how it works, but, what is the reasoning?

Answer

John Gietzen picture John Gietzen · Jan 28, 2010

This style ensures that the maximum precision available on ANY architecture is used when assigning a value to PI.