C# Rounding MidpointRounding.ToEven vs MidpointRounding.AwayFromZero

前端 未结 2 1750
时光说笑
时光说笑 2021-01-01 17:20

In C# Is there any difference in the accuracy of the two decimal rounding strategies MidpointRounding.ToEven and MidpointRounding.AwayFromZero? I m

2条回答
  •  清酒与你
    2021-01-01 17:43

    If your value is 123.45 then

    123.5 <-- MidpointRounding.AwayFromZero
    123.4 <-- MidpointRounding.ToEven

提交回复
热议问题