You can generally count on built-in formulas to be correct, which might have to be recreated in a different language;*
At one point, at least, this wasn't true. At Quickoffice we ran into all sorts of problems implementing functions as our results didn't match what Excel would display. It was fascinating. Ours were mathematically correct, but "Excel correct" is what our users wanted.Most of the errors where inherited from very early versions of Excel. Instead of fixing the formula, they would just replicate the bug to keep everything consistent.
I'm straining to remember the specific examples (there were many), but it's been quite a few years since I was around that stuff.