Stocks flat after surprise announcement by Hewlett-Packard and warning by Federal Reserve chairman

Joseph Mastrolia, left, a trader with Barclays, and Chris Casaliggi, Euronext floor manager, begin early trading on the floor of the New York Stock Exchange on Tuesday, Nov. 20, 2012. (AP Photo/Bebeto Matthews)

Fred DeMarco, a trader with Bay Crest Partners, talks into a headset during early trading on the floor of the New York Stock Exchange on Tuesday, Nov. 20, 2012. (AP Photo/Bebeto Matthews)

Traders crowd a a Barclays booth during early trading on the floor of the New York Stock Exchange on Tuesday, Nov. 20, 2012. Stocks sank early Tuesday on Wall Street. Hewlett-Packard stock suffered a big decline after its executives said that a company HP bought for $10 billion last year lied about its finances. (AP Photo/Bebeto Matthews)

NEW YORK — Falling oil prices and a surprise announcement from Hewlett-Packard weighed on technology and energy stocks Tuesday.

HP plunged 12 percent after executives said that a company HP bought for $10 billion last year lied about its finances. CEO Meg Whitman said that there were “serious accounting improprieties” at the search-engine company, Autonomy.

To account for it, HP took an $8.8 billion charge in its latest quarter. HP’s stock lost $1.59 to $11.71.

A warning from the Federal Reserve chairman, Ben Bernanke, about the dangers of the “fiscal cliff” also weighed on the market in afternoon trading. The Dow Jones industrial average dropped as much as 94 points shortly after Bernanke spoke.

But the stock market crept higher through the late afternoon and ended the day flat. The Dow dropped 7.45 points to close at 12,788.51. The Standard & Poor’s 500 index gained 0.92 point to 1,3827.81.

On Monday, the Dow soared 207 points as investors focused on prospects for a deal between the White House and congressional Republicans to avoid the cliff, tax increases and government spending cuts set to take effect Jan. 1.

In a speech to the Economic Club of New York on Tuesday, Bernanke urged Congress to take action. Asked in a Q&A session whether the Fed could limit the economic hit posed by the budget-tightening measures, Bernanke said: “If the economy goes off the broad fiscal cliff, I don’t think the Fed has the tools to offset that.”

Many investors expect financial markets to turn turbulent when Congress returns from its Thanksgiving recess and begins bargaining with the White House to avoid the fiscal cliff.

John Linahan, head of T. Rowe Price’s U.S. equity group, said that if those negotiations stretch into late December, the stock market could resemble the wild trading of August 2011, when markets flipped from big gains one day to steep losses the next.

Energy stocks and the price of crude oil fell after the president of Egypt predicted that Israel’s weeklong offensive in the Gaza Strip would end in hours and the Israeli prime minister said Israel would be a “willing partner” to a cease-fire.

Crude oil was down $2.53, or 2.8 percent, to $86.75 per barrel. It traded above $89 earlier in the day. Energy stocks in the S&P slipped 0.4 percent as a group. Tech stocks fared the worst, losing 0.6 percent.

The Nasdaq composite index gained 0.61 of a point to 2,916.68. The yield on the benchmark 10-year U.S. Treasury note rose to 1.66 percent.

Among stocks making headlines:

— Hormel Foods dropped $1.25, or 4 percent, to $30.05 after its earnings and revenue fell below Wall Street expectations. The company said sales of Spam remained strong, and it increased its annual dividend 13 percent, to 68 cents per share.

— Best Buy fell $1.79, or 13 percent, to $11.96, its lowest in more than a decade. The company, which has struggled for years against increased competition from online electronics retailers, turned in another dismal earnings report.

— Krispy Kreme Doughnuts climbed $1.77, or 23 percent, to $9.31 after it forecast earnings for 2013 above what Wall Street was expecting.