Changed tolerance check and added bracket check.

Added a check ensuring a root is bracketed - that is, the function
changes sign between the lower and upper bound. Also changed convergence
check to be consistent with a relative tolerance.