The function matches the interface of llvm::to_integer, but as we are
calling out to a C library function (implementing it ourselves seemed
way too complicated), I let it take a Twine argument, so we can avoid a
string copy at least in some cases.
I add a test and replace a couple of existing uses of strtod with this
function.