Just how big a mistake, however, was not clear until Tuesday evening, when Ackman’s hedge fund Pershing Square disclosed how much money it was able to salvage in the Valeant stock sale. While Ackman had already admitted to losing more than $3 billion of his almost $4 billion initial investment in Valeant (VRX), as its stock price sank 93%, most people assumed that he would at least make $300 million on the sale of the shares he had left. Plus, other Valeant stock trades that Ackman had made in the meantime should have preserved at least some of his $4 billion bet.

But the newly released trading data reveal that not only did Ackman collect much less money than expected for the stock he owned in the troubled drugmaker, he actually had to pay even more money to get rid of the rest of his Valeant position. Indeed, Ackman’s Valeant holdings were structured in such a way that when he finally sold, he owed more than twice as much as his remaining shares were worth.

In total, Ackman lost even more than $4 billion on his Valeant investment, Fortune’s analysis found. To put the damage in its full brutal context, that equates to Ackman losing $7.7 million every day the market was open for more than two years.

Here’s how the math breaks down: Pershing Square bought its first shares of Valeant for about $161 per share in February 2015. On Monday, he sold the last of his shares for $11 apiece. But the hedge fund’s filings show that in addition to Valeant stock, much of Ackman’s final position was made up of put options—an investment derivative obligating the hedge fund manager to buy Valeant shares at more than four times their current price. (At the time Ackman entered into that contract last summer, he clearly believed Valeant’s stock price was on its way up.)

In the end, Ackman sold the rest of his Valeant stock for less than $200 million. But he had to spend nearly $435 million to close out the put options. (While he owned some other option contracts, known as call options, that he was able to sell for less than $3 million, those proceeds could hardly offset the other outlays.) All in all, it actually cost Pershing Square nearly $233 million to dump Valeant for good this week.

That’s why Ackman ultimately lost almost $4.1 billion, everything he spent on his original stock purchase and then some.

But while some have suggested that the hedge fund manager lost virtually 100% of his investment in Valeant, the truth is more complicated. After all, Ackman’s investment in Valeant consisted of not just the stock, but also about a billion dollars worth of put and call options. Combine that with a couple of intermediate stock purchases over the past two years, and overall, Ackman invested more than $5.5 billion in Valeant.

Still, the hedge fund mitigated its losses by selling some of its Valeant position at higher prices (albeit just for tax purposes), as well as collecting premiums on option contracts it sold to other investors. That salvaged almost $1.5 billion of Ackman’s total investment, meaning he really only lost 74% of what he put in. He’ll also recoup some of the losses in tax write-offs, which is the reason Ackman gave for selling the rest of his position.

Pershing Square itself is down 2.1% so far this year, after losing 13.5% in 2016 and 20.5% the year before.

Based on what Ackman paid out to the investors on the other side of his option trades, it’s safe to say his hedge fund would probably be billions of dollars richer right now if he’d gone in the opposite direction of the one he did. Hedge fund manager Jim Chanos, a short-seller who profited off Enron’s collapse, similarly bet against Valeant several years ago and has been laughing his way to the bank ever since.