float switch function