It's been lost in the shadows of flashier computing companies lately, but HP (HPQ -0.45%) is finally enjoying some time in the sun. The company reported financial results for its fiscal second quarter of 2024 after the market closed yesterday. And investors bid the stock higher today, with shares rising as much as 20% around midday, pushing the stock to within striking distance of its all-time high.

Important improvements for HP

I wouldn't necessarily call Q2 a blowout success for HP. But it did show important improvements where the company needed it most. For starters, the bulk of its business is in personal computers (PCs), and PC sales have been sliding for a couple of years now. In Q2, this finally turned around, with PC sales increasing 3% year over year.

Here's another thing: Some investors have been concerned about HP's balance sheet, considering it had a net-debt position -- more debt than cash. But the company has made progress over the last year. It's gone from a net-debt position of $8.8 billion last year to a net-debt position of $7.2 billion this year. Debt is down, and cash is up.

Moreover, HP made this progress on its balance sheet without sacrificing giving back to shareholders. The company has continued to pay its dividend and repurchase shares. In summary, the Q2 report was reassuring enough for investors to celebrate today.

Can AI boost demand?

It's also possible that investors are excited about their favorite investing trend right now: artificial intelligence (AI). When it comes to AI, HP is pointing out its AI-enhanced PCs. The company says that it offers the largest portfolio of AI PCs. The hope is that these could stimulate sales demand.

With PC demand already showing signs of rebounding, HP stock could keep heading higher. At the very least, improvement to demand should help it with profitability as it works to continue to return cash to shareholders and clean up its balance sheet.