restrict switch() label types to input type
fix float casts to be always be well-defined