First off, 3.340" is the SAAMI maximum over all length. The length which will work best in your rifle is unknown until you determine it yourself thru trial and error. The COAL listed in loading manuals is listed in order to qualify the conditions under which the published data was obtained and means little else. This is something people who use published loading data need to understand.
Generally, the best COAL for YOUR rifle will be the longest length which both fits in & feeds from the magazine and does NOT engage the rifling when chambered. The bullet should be set so that it sits in the loaded round, when chambered, approximately .005" to .010" back from the rifling. There are special tool you can use to determine this length. Alternately, you can load a dummy round using only a sized case and bullet. Seat the bullet out longer than necessary. Smoke the bullet using a wood match, candle or sight black. Try to chamber the round, then immediately eject. If the smoked bullet shows marks from contacting the rifling, seat it slightly deaper, re-smoke the bullet and repeat until such time as the bullet no longer contacts the rifling. After you reach the desired length, double check that the round fits in the magazine and, if so, measure & record the COAL for that bullet.
Seating the bullet just off the rifling usually, but not always, provides the best accuracy but it never hurts to experiment further if you wish. Also, if you are loading for an autoloader which produces moderate or more recoil or loading for a rifle with a tubular magazine, you will need to crimp the bullet in place in order to prevent bullet setback. In that instance, you will need to use a bullet with a cannelure and the location of the cannelure will pretty much determine the COAL. Single shot and turnbolt action rifles not not require a crimp except for very heavy recoiling rounds.
After the COAL length is determined for your particular rifle, load development can continue.