U.S. stocks rallied before closing Tuesday, as investors took in testimony by Federal Reserve (Fed) Chairman Ben Bernanke and refocused on positive earnings. In U.S. news, Bernanke told a Senate panel that risks to economic growth have heightened and that the Fed is “looking for ways to address the weakness in the economy should more action be needed." However, investors were encouraged by better-than-expected earnings from Coca-Cola, Mattel, and Goldman Sachs, along with several economic reports that indicated modest improvement. The dollar fell against the euro and the pound, but gained versus the yen. Light sweet crude oil for August delivery rose 79 cents to $89.22 a barrel on the New York Mercantile Exchange. Gold futures dropped $2.10 to $1,589.50 an ounce. The Dow Jones industrial average gained 78.33, or 0.62 percent, to 12,805.54. The broader Standard & Poor's 500 index rose 10.03, or 0.74 percent, to 1,363.67. The technology-heavy Nasdaq composite index moved up 13.10, or 0.45 percent, to 2,910.04.