October 2011
1 post
1 tag
Rounding decimal value to 0.0 or 0.5
Today morning I was need to convert values ranging 0.0 to 1.0 where rounding will be necessary 0.0 or 0.5. For instance, if your original value 7.3 it should be floored to 7.0 and on the other hand if your value is 7.8 it should be floored to 7.5. The original code was written by Indian developers where they thousands if-else conditions like if (value >= 0.0 && value < 0.5)     ...
Oct 17th