0

Why switch case can't accept float value?

6th Jun 2018, 5:15 PM
Devil Sagar
Devil Sagar - avatar
2 Antworten
+ 2
the problem with float are the rounding errors that would make a switch statement useless on rounding: https://randomascii.wordpress.com/2017/06/19/sometimes-floating-point-math-is-perfect/
6th Jun 2018, 5:30 PM
Max
Max - avatar
0
It's not allowed, you have to type-cast to integer, or char. or any other type that switch support
6th Jun 2018, 5:32 PM
Owenizedd
Owenizedd - avatar