"ALONG CAME Polly" is all about math, but not in the way you might think.

Yes, Ben Stiller does play a risk analyst, an insurance company employee whose job it is to calculate the statistical probability of bad things happening to people, but that's not the kind of math I'm talking about here. I'm talking the highly idiosyncratic calculus we all use to determine whether the whole of a movie is greater or less than the sum of its parts. I'm talking about whether you're the sort of person who would agree or disagree with the (in my opinion, mathematically flawed) assessment I overheard from an audience member, who opined on the way out that, "The movie itself sucked, but it had a lot of really funny bits."

Like Stiller's character Reuben Feffer, who calculates one's insurability by plugging aspects of a potential customer's lifestyle into "Riskmaster" computer software, let's do the math.

While it's true that this romantic comedy about the odd coupling of staid and stodgy Reuben (Stiller) -- a schlemiel whose brand-new wife (Debra Messing) cheats on him while still on their honeymoon -- with free and funky waitress Polly (Jennifer Aniston), has a lot of really funny bits, many of them having to do with bodily functions. So, if sound and sight gags about flatulence, vomiting, coughing, bathroom activities and a rather extraordinary something called "sharting" (which I will only leave to your imagination) offend you, you might want to put that in the negative column.

I, on the other hand, laughed myself sick.

Other positives: The talented cast, which along with Stiller, Aniston and Messing includes Philip Seymour Hoffman as Reuben's washed-up-actor best friend; Alec Baldwin as his gruff and hysterically unhygienic boss; Hank Azaria as the nudist scuba instructor who seduces Reuben's wife; Michele Lee and Bob Dishy as his talkative/taciturn parents; and Aussie Bryan Brown as his recklessly risk-embracing insurance client. All of these pros know comic acting inside and out, and if you don't think Baldwin is funny, you need to watch some reruns of him hosting "Saturday Night Live."

Best of all, though, is the tart, sharply observed script by director John Hamburg, co-writer of such hits as "Meet the Parents" and writer-director of the underrated gem and 1998 Sundance charmer "Safe Men." Hamburg has a gift for absurd humor grounded in real life and, let's face it, sometimes that includes passing gas.

But it's not all middle-school, middle-brow yuks. Hamburg's films are funny because his characters behave like us, or at least like we would if subjected to the kinds of indignities that would make Job wince. They're not unimaginable. They're merely everyday indignities that happen with greater frequency.

Is "Along Came Polly" a great film? No, probably not, but it is a very amusing one. It's a movie whose simple, carpe-diem moral can be summed up in a single line, uttered by the immortal Dishy in his ludicrously laconic character's one speaking scene. And it's a moral that applies not only to life in this case but to watching -- and evaluating -- film comedies. "There's no point in going through all this crap," says Reuben's father, with the wisdom of the laughing Buddha, "if you're not going to enjoy the ride."

ALONG CAME POLLY (PG-13, 90 minutes) -- Contains some obscenity, comic sex scenes, glimpses of a couple of naked buttocks and a fair amount of humor related to bodily functions. Area theaters.