Last week, when the major indices reached new all-time highs, this bull market officially became the longest on record. One of the consequences of such a long period of relative prosperity is that it is becoming ever more difficult to find stocks that are attractively valued, something that is especially true for companies showing consistent growth. Yet, if one looks hard enough, undervalued gems can still be found. In fact, after HP Inc (NYSE:HPQ) recently reported its third-quarter earnings, I believe investors could see that this computer and printer manufacturer offers a compelling combination of growth and value.

In the company's third quarter, revenue rose to $14.6 billion, a 12% increase year over year, while adjusted earnings per share (EPS) grew to $0.52, a 21% increase year over year. The company's personal systems segment, the segment responsible for products such as desktops and notebooks, saw revenue increase 12% with an operating margin of 3.9%. Printing, the segment rather obviously responsible for printers and printing supplies, saw revenue grow 11% year over year with an operating margin of 16%.

While I have long been a shareholder, here are three reasons I believe the company's stock is a compelling buy right now.

HP Metrics 2018 Q3 2017 Q3 Change
Net revenue $14.6 billion $13.1 billion 12%
Personal systems revenue $9.4 billion $8.4 billion 12%
Printing revenue $5.2 billion $4.7 billion 11%
EPS (non-GAAP) $0.52 $0.43 21%

Data source: HP Inc. 

Printing money

The company's printing business contributed $5.2 billion of revenue to HP's quarter, about 36% of the company's total. Yet because of its superior operating margin, the division is responsible for twice as much of earnings as the personal systems segment. The company has been trying to steer its printing division into deeper relationships with its commercial customers by moving from a transactional relationship to a contractual one. This motivation was clearly behind its $494 million Apogee acquisition earlier this quarter. CEO Dion Weisler stated:

The Apogee acquisition was obviously designed and strategic rationale was to tap into this growing trend toward contractual. For those of you who are not familiar with Apogee, they are the largest independent print and document service provider in Europe. They've got a really proven track record ... for growth, and a deep set of capabilities in the contractual space. So, with Apogee, we're going to gain access to new profit pools while expanding our ability to deliver value-added services and accelerate the deployment of our technology into this growing contractual office printing market, especially among SMBs.

Later, CFO Steve Fieler stated that, while margins in the printing business have been a bit compressed lately because of the integration of Samsung's (NASDAQOTH:SSNLF) printing unit and other investments, he does believe the shift to a contractual relationship will have long-term benefits, including rising margins. He said:

We are investing in our growth categories and we do think there's long-term opportunity there, but you first have to build your install base, place those units and you're going to get the supplies attached later on.

Printer prints out color displays while woman works on laptop in background.

HP's printing segment saw revenue increase 11% with an operating margin of 16%. The company believes a shift to contractual relationships with commercial printing customers will eventually lead to higher margins and greater long-term growth. Image source: Getty Images.

Rising sales practices

One of the biggest boons to HP in recent quarters has been the rising average sales price (ASPs) of the hardware products in its personal systems segment. When Fieler stated the division's operating margin had risen to 3.9%, he said, "the increase was primarily driven by higher ASPs." This stems from the company's strategy to chase the higher-end PC and notebook market. In his opening comments, Weisler said HP's premium pipeline was strong:

In May, we unveiled a bold new lineup of premium notebooks, desktops, and displays across our Elite and Envy portfolios, including the world's smallest business convertible and the first detachable with integrated privacy screen. The team is leveraging design and engineering leadership to deliver the ultimate combination of style, performance, and versatility, what I like to call our sprinkles of magic.

Shareholder-friendly management

During the third quarter, HP returned $919 million to shareholders through buybacks and dividends, most of which, $700 million, came in the form of share repurchases, good enough to retire 30.4 million shares on the open market. Earlier in the quarter, the company approved an additional $4 billion in share repurchases, even while it still had $1.2 billion in share repurchase funds remaining. With a market cap still under $40 billion, this new authorization represents more than 10% of the company's shares.

HP also currently pays a quarterly dividend of $0.14, good for a decent yield of 2.3%. Even better, the payout ratio is fairly low, just 30%, meaning there is plenty of room for the company to grow the dividend in the years to come.

In the company's third-quarter conference call, Fieler stated the company's goal was to return 50% to 75% of its free cash flow to shareholders. Year to date, though, the company has returned about 80%, above its stated goal. When asked if that was sustainable, Fieler replied that HP's capital allocation strategy gave the company more than enough flexibility to reinvest back in the business to realize its strategic initiatives, but earlier in the year, the company saw an opportune time to buy back shares at a compelling value and took advantage of it.

A bargain for investors

While these reasons combine to make a convincing case for the company, in my humble opinion, the best reason to buy shares today is HP's bargain-level price. With a trailing-12-month adjusted EPS of $1.92, shares sport a P/E ratio of just 12.6. That's for a company that has grown earnings by at least 20% in the past four quarters. If HP hits the midpoint of its EPS guidance next quarter, it will be five straight quarters of 20% earnings growth. That's a compelling value for investors, aging bull market or not.

Matthew Cochrane owns shares of HP. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.