How is the derivative of a `f(x)` typically calculated programmatically to ensure maximum accuracy?

I am implementing the [Newton-Raphson](http://en.wikipedia.org/wiki/Newton%27s_method) method, and it requires taking of the derivative of a function.