I've got a problem with rounding using sprintf. I get passed '%0.0f' as the format. sprintf rounds not as expected: 0.5 should be rounded to 1, instead it rounds to 0, which is against the general rounding rule, whereas 1.5, 2.5 etc. is being rounded correctly:
sprintf('%0.0f', 0.5)
=> "0"
sprintf('%0.0f', 1.5)
=> "2"
Why is this so and how can I achieve my expected behaviour?