Change doubleToInteger and longToInteger to unified toInteger method