Maybe the title is confusing, but I will try to explain with examples:
Given a float with precision = 2, I want to be able to round either to its closes integer, or to its closest .5. Examples:
Given: 4.12 --> 4
4.24 --> 4
4.25 --> 4.5
4.33 --> 4.5
4.53 --> 4.5
4.65 --> 4.5
4.75 --> 5
4.84 --> 5
What would be a good way to do this in Ruby?
Multiply by 2, round, divide by 2.