Adds an implementation of Brent's algorithm