You're about to get to know the most maligned metric in investing, the P/E. Why all the hate? At the top of the list is that the P/E, or price-to-earnings ratio, is easy to manipulate. I'll get to how in a minute. But first, an introduction. The P/E is simply a stock's current price divided by some period of earnings per share.

I say "some period" because there are a bazillion different ways to calculate earnings, and therefore create different P/E ratios. For example, according to Capital IQ, Starbucks (NASDAQ:SBUX) earned $0.69 per diluted share over the trailing 12 months. Therefore, its "trailing P/E" is calculated as such:

$35.98 (current share price)
-------------------------------------- = 52.1
$0.69 (trailing earnings)

Starbucks has a trailing P/E ratio of 52.1. You could say that Starbucks trades for 52.1 times trailing earnings or for a 52.1 multiple to earnings.

Make that half-decaf with no foam, please
Now, let's make it slightly more difficult by calculating the "forward P/E." It's exactly like the trailing P/E, except that the denominator (i.e., the earnings number) is what analysts expect the company to earn. For Starbucks, the consensus estimate is $0.72 for fiscal 2006 and $0.87 for fiscal 2007.

$35.98 (current share price)
-------------------------------------- = 50.0
$0.72 (expected 2006 EPS)

And:

$35.98 (current share price)
-------------------------------------- = 41.4
$0.87 (expected 2007 EPS)

Still with me? Good. Let's talk a bit about when the P/E ratio can be useful.

The P/E as benchmark
P/E ratios are often used to compare companies with their competitors and the market. The thinking is that companies that trade for less than their peers and the market on an earnings basis may be cheap. And this is sometimes true. Some famous investors have made careers of low-P/E investing, including John Neff, former manager of Vanguard Windsor, who beat the market by more than 3 percentage points annually over more than 30 years of picking stocks.

Another school of thought is to compare the P/E with the expected growth rate to arrive at the price-to-earnings-to-growth ratio, or PEG. Calculate the PEG by dividing the P/E by the most relevant consensus growth rate. It's generally best to confine your calculation to the year ahead. Let's again use Starbucks as an example.

First, we need to know the growth rate. According to Thomson, analysts expect Starbucks to grow earnings 22% per year over the next five years. Now, let's put that into the PEG equation. (We're going to use the trailing P/E here since the forward P/E already accounts for growth.)

52.1 (trailing P/E)
-------------------------------------- = 2.4
22.0 (expected growth rate)

Most consider a PEG below 1.0 to be cheap. A PEG of 2.0 or greater is expensive. Starbucks, which is still a high-growth business, is clearly expensive. But that's only if you believe in the PEG as a relevant metric. You may not want to.

The P/E can (small-f) fool you
Of the problems with the P/E, the biggest is that earnings are an accounting metric and may be manipulated -- so much so that, quite often, reported earnings barely resemble the real cash-generating ability of the business being measured. That can make both the P/E and the PEG utterly useless.

Let's use AkamaiTechnologies (NASDAQ:AKAM) as an example. According to Yahoo! Finance, it sports a trailing P/E ratio of 15.9. If that seems low for a business that expects to see 30% to 40% growth on the bottom line for the next few years, you're right -- that number doesn't reflect reality at Akamai. In 2005, the company turned profitable and realized a $285 million income tax benefit. But no one cut Akamai a huge check; that $285 million was essentially the result of some papers being shuffled about.

Follow the money
The P/E ratio probably gets more hate than it deserves. It can, after all, be useful for a thumbnail check-up on a stock. Just remember that companies that play fast and loose with accounting rules may unfairly represent earnings and, in doing so, mangle their P/E. That's why Fools often substitute free cash flow (FCF) for earnings when analyzing the investing merits of a stock. Learn more about FCF and the cash flow statement by reading our Foolish Fundamentals series.

And be sure to check back here often. We'll be publishing new articles on investing basics every week. If you want even more hands-on help, consider Motley Fool GreenLight. Our personal-finance newsletter service is here to help you take control of your financial destiny. A 30-day free pass to the service is yours for free.

Fool contributor Tim Beyers likes to invest in companies with big, fat piles of cash. He's just greedy that way. Tim owns shares of Akamai. Check out all of his stock holdings by at Tim's Fool profile. Akamai is a Rule Breakers pick. Starbucks is a Stock Advisor pick. The Motley Fool has an ironclad disclosure policy.