The short formula for gallons in a round pool is:

Diameter * Diameter * Height * 5.9.

Note that Diameter and Height are both in feet, and Height is the height of the water, not the pool wall.

So if you have a 4' high pool, your water is probably 3.5 to 3.75 feet high or between 6" to 3" below the rail.

The LONG formula is from your high school geometry:

Pi*R-squared*height*7.48

7.48 is the number of gallons in a cubic foot of water.