toInt(), toFloat() and toString() safe casting functions