I notice that Math.Round() is more flexible than Decimal.Round(), since it is able to handle everything that Decimal.Round()
can, but also can do the same given double
inputs. So is there any situation where using Decimal.Round()
is better, or is using Math.Round()
all the time a better idea?
Look at the .NET source code: http://referencesource.microsoft.com/#mscorlib/system/math.cs,4f39179a0098ab01
Decimal Math::Round(Decimal)
is defined as a direct call to Decimal Decimal::Round(Decimal)
so the two are semantic analogues.
I suppose by default I'd use Decimal::Round
to avoid an extra function call, but the JIT should optimize that away anyway, so I'd probably use Math::Round
to be consistent with other Math
calls, if there were any, in the same code file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With