To hear Mike Lynch tell it, he’s not above stretching the truth. In 2010, back when he was CEO of the UK software firm Autonomy (and a year before Hewlett-Packard regrettably paid $11.4 billion for it), he recounted an early and formative meeting with a potential investor — a cigar-chomping billionaire too dim to understand the complex math driving Autonomy’s data-management software.

Desperate for a simple pitch, Lynch, who earned a PhD in mathematical computing at Cambridge University, compared his software to the way the human brain works, even though “every sinew” of his body told him this wasn’t scientifically true. Lynch saw this as some sort of triumph: It was the moment when the scholar steeped in the cold logic of science embraced the warm and fuzzy art of marketing.

That anecdote is a key to understanding HP’s bombshell announcement Tuesday that it is taking an $8.8 billion writedown, largely because of what CEO Meg Whitman called “serious accounting improprieties, disclosure failures and outright misrepresentations” at Autonomy in the years before HP bought it. HP stopped short of accusing Autonomy of fraud under Lynch, leaving that question to regulators in the US and the UK. What’s already clear is that there is a lot of truth-stretching and marketing spin happening on both sides.

In an interview with CNBC, Whitman said she “fired” Lynch earlier this year. (At the time, Lynch said he was leaving, because HP was “too bureaucratic.”) After Lynch left, Whitman said, a senior member of his team came clean about Autonomy’s misleading accounting. HP’s allegations echo the lesson Lynch learned from his meeting with the cigar-chomping billionaire: Tell the story your investors want to hear. Even if, strictly speaking, your sinews know it’s not true.

There were three ways Autonomy fudged its numbers, according to HP. Low-margin hardware sales were booked as high-margin software sales. Long-term subscriptions were booked as up-front licensing, boosting short-term revenue. And many licenses were sold to middlemen vendors (like HP) and not actual customers. Or as CFO Cathie Lesjak put it, “They weren’t, in some sense, real sales, because there was no end user.”

High margins and growing revenue were two reasons why Whitman’s predecessor Léo Apotheker pounded the table for the Autonomy deal, even though many considered it too expensive. HP had a long history of overpaying for companies. It won a costly bidding war with Dell over 3Par, a storage-software company, paying 10 times its revenue. It paid $14 billion for troubled IT giant EDS, and wrote off $8 billion in charges a quarter ago. And it bought Autonomy for 13 times its 2011 revenue and 25 times its EBITDA.

So it’s also a little disingenuous for HP to paint itself as the victim. It’s not clear how much of the writedown is due to misleading accounting, and how much is due to HP overpaying for an underperforming acquisition. The company’s board should have seen the deal was expensive, even based on fudged numbers. Oracle saw that clearly. In April, Lynch and investment banker Frank Quattrone showed up with a three-month-old presentation detailing why Autonomy was an attractive investment.

Quattrone is the Scott Boras of tech investment banking. He helped negotiate the overpriced 3Par deal, as well as another regrettable deal for HP, its $1.2 billion purchase of Palm. But Oracle thought Autonomy’s $6 billion valuation was too rich then. And after HP agreed to pay nearly twice as much, Oracle set up a page on its site titled “Please Buy Autonomy” mocking the deal.

According to a recent feature from Fortune, there was a loud voice inside HP arguing against the Autonomy deal. CFO Lesjak “made an impassioned case against the acquisition before the board.” Although the board was shaken by Lesjak’s objections, it rubber stamped the deal. One of those board members, of course, was Meg Whitman.

It’s not the board’s role to dig deep into the accounting of a potential acquisition. As Whitman told investors today, HP not only relied on Autonomy’s auditor Deloitte, it hired KPMG to conduct due diligence on the deal. Only when HP hired a third accounting firm, PwC, was the depth of the accounting hole revealed. Even so, Whitman’s board vote for the Autonomy purchase shows she’s complicit in a deal that smelled bad to a less desperate tech giant like Oracle.

In a call with investors, Whitman described the writedown as “an $8.8 billion non-cash impairment charge related to Autonomy.” That wording is disingenuous because it conceals the fact that Autonomy was responsible for only $5 billion of the writedown. The rest is related to the decline in HP’s stock price – HP is down 54 percent this year. Some news sites took the bait, running headlines indicating the writedown is only caused by Autonomy.

In truth, HP’s problems go well beyond Autonomy. The company’s revenue has declined for five straight quarters, as smartphones and tablets eat into demand for its PC business, and as cloud computing obviates need for printing photos, documents, and boarding passes. HP was already in the midst of an arduous and unlikely turnaround, and the problems with Autonomy are going to make the turnaround that much more improbable.

Autonomy was supposed to be HP’s big push into cloud computing. Whitman insists the technology is sound and will be a central part of HP’s future growth. But the investigation and inevitable court battles between HP and Autonomy are going to tarnish both brands, limiting their appeal to corporate clients.

After HP’s announcement, Apotheker emerged to say he was “stunned” by the news. A spokewoman for Lynch said he “flatly rejects these allegations, which are false.” It will take some time to sort out what really happened at Autonomy. But I suspect time will show some stretching of the truth on both sides — misleading accounting if not outright fraud at Autonomy, and HP exaggerating the damage to distract from deeper problems in the company.

HP is a Silicon Valley veteran valued at $23 billion (even after today’s 12 percent decline), but the Autonomy fiasco offers a cautionary tale for startups and their investors. The business of software, and its accounting, can seem dauntingly complex. To market yourself to investors, you sometimes have to simplify or spin the complex truth. But the line between the art of marketing and the science of cold hard facts isn’t always a clear one. Losing sight of it can be costly a lot in the long run.

[Image courtesy of jetsandzeppelins on Flicker]