Why does 0.5 rounded with MidpointRounding.AwayFromZero result in 0?
问题 Why does this result in 0 and not 1? Math.Round(0.5, 0, MidpointRounding.AwayFromZero) Here's an example: http://ideone.com/ayMVO 回答1: Normally, with issues like that, it's because the number cannot be represented exactly in IEEE754 - it's most likely it's being converted to 0.4999999999... or something like that which would round to zero. However, 0.5 (1/2) is exactly representable in IEEE754 so that's not the case here. It's possible that the compiler made a mistake in converting the text