Today i noticed following issue on IronPython2.7:
When formatting a format_string like so, i get a "negativ zero". I get the same result if i use Python2.7 or Python3.4 instead of IronPython.
>>> "%.2f" % -0.004
'-0.00'
Then i realized, that i can get rid of the negativ zero by passing two arguments to the format string like so:
>>> "%s%.2f" % ('x', -0.004)
'x0.00'
'x' is a random character. So, i format another string before the float value and the minus disappears. That does not work with Python2.7 and Python3.4 though, where i get:
>>> "%s%.2f" % ('x', -0.004)
'x-0.00'
Does anybody know what's going on here?
What is the purpose of the formatted "negativ zero" at all?
-0.0
. It's distinct from (but equal to) positive zero. No idea why IronPython makes the minus sign disappear with there's another value in the format string.