The charge is the result of a writedown of the value of its services business, reflecting that the company overpaid for when it bought Electronic Data Systems in 2008 for $14 billion.
HP said it will take an $8 billion charge for the reduced value of Enterprise Services in the quarter that ended in July. The division, which provides information technology and outsourcing services to corporations, has seen flat revenue for the last two years, and its operating profit has declined.
The Palo Alto, Calif. company said the charge and other accounting adjustments will lead to a loss of $4.31 to $4.49 per share. That works out to about $8.5 billion to $8.9 billion.
In the last 15 years, HP has only posted one quarterly loss.
The charge comes as CEO Meg Whitman is trying to turn HP around. The company's main businesses, PCs, services and printers, are stagnant or shrinking. Whitman, the former CEO of eBay, took over in September.
It also said its early retirement program is meeting with unexpectedly high acceptance, meaning it will take a charge of $1.5 billion to $1.7 billion for severance payments in the third quarter, rather than the $1 billion it expected.
The restructuring, announced in May, is expected to slash 27,000 jobs, or 8 per cent of HP's work force, by 2014. It's the largest downsizing in the company's history.
Excluding charges, HP said it expects to report fiscal third-quarter earnings of $1 per share, up from a previous range of 94 cents to 97 cents. Analysts expected earnings of 97 cents per share, according to a poll by FactSet.
The computer company also said the head of Enterprise Services, its second-largest division, is leaving "to pursue other interests." John Visentin will be replaced on an interim basis by Mike Nefkens, currently the head of Enterprise Services in Europe, the Middle East and Africa.
HP appointed Visentin to head Enterprise Services last August, after leading the Americas division. Before that, he worked at IBM.
HP's stock rose 54 cents, or 2.8 per cent, to $19.50 in midday trading. The shares are close to their lowest level in eight years.
HP is set to report third-quarter financial results on Aug. 22.Suggest a correction