Here's what stock market valuations look like if you add back all the bad stuff companies like to take out

When a company announces its quarterly financial results, it'll sometimes offer a two sets of earnings.

The first is GAAP earnings, which are based on generally accepted accounting principles. This is an industry standard that requires every industry and company to account for and report items in a uniform way.

But some companies and industries believe GAAP earnings aren't always representative of the health of the underlying operations. GAAP requires companies to fully recognize unusual events like a big gain or loss on the sale of an asset, the writedown of an asset, an unusually large legal expense, or whatever else you might imagine could occur unexpectedly. So, some companies will offer a second set of earnings to remove this noise. These are sometimes referred to as pro forma earnings, adjusted earnings, earnings excluding non-recurring items, or just non-GAAP earnings.

In a note to clients on Wednesday, UBS strategist Julian Emanuel offered this chart of of GAAP PEs for the S&P 500 (blue bars) next to its pro forma PEs (beige bars). Interestingly, the blue bar is always higher, which means that the pro forma PEs always reflect earnings that are higher than GAAP earnings.

Two big blue spikes stand out. One after the dotcom bubble burst and another during the height of the credit crisis. During both of these periods, companies wrote down the value of tons of assets, which ate away at their GAAP earnings. But because companies didn't see these write offs as representative of their ongoing businesses, they added them back, which boosted earnings and lowered the PE ratios.

In other words, companies tend to make accounting adjustments in the income statements that make their businesses seem more profitable and their stocks more cheap.