I am developing an application in python, with some parts written in c# (for speed up), and I am baffled why c# floating point rounding behaves kind of "opposite" to python when using "round" function and string floating point formatting functions, here's an example:
Python (2.7)
>>> round(6.25, 1)
6.3
>>> "%.1f"%6.25
6.2
C#
>>> Math.Round(6.25,1)
6.2
>>> (6.25).ToString("F1")
6.3
Does anybody understand why the behavior is seemingly "reversed" between Python vs c#? Is there a way to round a "double" floating point value to N decimal digits to produce guaranteed same string output between Python and C#?