What happened

Shares of communications equipment company Applied Optoelectronics (AAOI -2.00%), which builds lasers and other subcomponents for fiber-optic networking, leapt 40.1% through 10:10 a.m. ET this morning after beating earnings expectations last night.

Analysts weren't overly optimistic about Applied Optoelectronics heading into Q2 results, predicting the company would lose $0.28 per share on sales of only $45.4 million for the quarter. The company easily cleared those low bars, however, delivering a smaller-than-expected loss of $0.21 per share, and greater-than-expected revenue $52.3 million.  

So what

Still, the news wasn't great. Although revenue exceeded analyst expectations, it still declined 20.5% year over year. Granted, Applied Optoelectronics succeeded in improving its gross profit margin by 250 basis points, to 19%. But the company's operating profit margin deteriorated dramatically, falling nearly 14 full percentage points to negative 38.5%, as falling revenue struggled to keep up with rising operating costs.  

Ultimately, Applied Optoelectronics ended up with a $0.57 per share GAAP loss on the bottom line -- 10% worse than a year ago. (The $0.21 per share loss that investors seem so pleased with today was a non-GAAP number.)

Now what

Given the size of Applied Optoelectronics' real losses in Q2, though, what explains investors' sudden enthusiasm for the stock? It isn't just that they're happy the results were slightly less dismal than had been predicted, is it?

Actually, no. It isn't.

The real reason investors seem to be betting on Applied Optoelectronics today isn't the bad numbers management reported for Q2, but the much better numbers management thinks it can deliver in Q3. Turning to guidance, Applied Optoelectronics said it's expecting a sharp rebound in sales this coming quarter -- to $60 million-$66 million. That's a whole lot better than the $48.4 million that analysts have been forecasting for Q3.

And even better, Applied Optoelectronics says that while it might lose as much as $0.06 per share (non-GAAP) this quarter, there's a slim chance it will eke out as much as a $0.01 per share profit.

Granted, a $0.01 per share GAAP profit would be better. But beggars can't be choosers. If Applied Optoelectronics can produce any kind of profit at all in Q3, it might be enough to keep this momentum going.