Rifling a barrel increases the accuracy of a weapon, and this principle can
be applied to large cannons as well as small arms.

Ordinary naval cannons are smoothbore weapons, meaning that the barrel is a
simple tube to contain the explosion. The limitations of casting mean that
cannons are quite crude and windage, the gap between the barrel and shot,
is always a problem. A shot often "rattles" down the barrel when fired,
making it inherently inaccurate. The loss of accuracy with a smoothbore
makes its maximum range of academic interest only, simply because it becomes
a matter of luck rather than judgement to hit anything far away!

A rifled cannon solves these problems. By using machines to bore out the
barrel from a blank casting, one inaccuracy is removed. Another machine cuts
a helical pattern of grooves into the barrel wall. This imparts a spin to
any shot as it travels down the barrel, and a spinning projectile flies true.
This makes the effective range of a rifled cannon shot much greater than one
from a smoothbore, although the maximum range for both is similar.

Historically, rifled cannons used manufacturing techniques developed for
making accurate steam pistons and cylinders.