Fix strformat neg zero (#7954)
* fix strformat handling of neg zero with sign * better tests for neg zero with sign * use inplace insertion of the sign as suggested by Varriount
This commit is contained in:
parent
fd102f39bb
commit
230692a22f
2 changed files with 14 additions and 1 deletions
|
|
@ -46,3 +46,11 @@ doAssert fmt"{-1.5:0>8}" == "0000-1.5" # even that does not work for negative fl
|
|||
doAssert fmt"{-1.5:08}" == "-00001.5" # works
|
||||
doAssert fmt"{1.5:+08}" == "+00001.5" # works
|
||||
doAssert fmt"{1.5: 08}" == " 00001.5" # works
|
||||
|
||||
# only add explicitly requested sign if value != -0.0 (neg zero)
|
||||
doAssert fmt"{-0.0:g}" == "-0"
|
||||
doassert fmt"{-0.0:+g}" == "-0"
|
||||
doassert fmt"{-0.0: g}" == "-0"
|
||||
doAssert fmt"{0.0:g}" == "0"
|
||||
doAssert fmt"{0.0:+g}" == "+0"
|
||||
doAssert fmt"{0.0: g}" == " 0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue