NEW YORK - Swiss pharmaceutical giant Roche Holding Ltd. agreed yesterday to pay $46.8 billion in cash to buy the 44 percent of California biotech pioneer Genentech Inc. that it does not already own, ending a long corporate struggle between the companies.