Safely cast values to float, int, or string