printf formatting a value of -0.0 with a %f format specifier and setting the + flag adds a plus and a minus sign to the result.
sprintf "%f" +0.0 // 0.000000 (correct)
sprintf "%f" -0.0 // -0.000000 (correct)
sprintf "%f" -0.0000001 // -0.000000 (correct)
sprintf "%+f" +0.0 // +0.000000 (correct)
sprintf "%+f" -0.0 // +-0.000000 (incorrect)
sprintf "%+f" -0.0000001 // -0.000000 (correct)
Expected behavior
.NET Core: sprintf "%+f" -0.0 should display -0.000000 (matching .NET Core Double.ToString())
.NET Framework: sprintf "%+f" -0.0 should display +0.000000 (matching .NET Framework Double.ToString())
Original text
`sprintf "%+f" -0.0` should display `-0.000000` `sprintf "%+f" -0.0` should display `+0.000000` (to match .NET Framework behavior).
Actual behavior
Displays +-0.000000
Known workarounds
None known.
Related information
Potentially related to: dotnet/runtime#70460
printfformatting a value of-0.0with a%fformat specifier and setting the+flag adds a plus and a minus sign to the result.Expected behavior
.NET Core:
sprintf "%+f" -0.0should display-0.000000(matching .NET CoreDouble.ToString()).NET Framework:
sprintf "%+f" -0.0should display+0.000000(matching .NET FrameworkDouble.ToString())Original text
`sprintf "%+f" -0.0` should display `-0.000000``sprintf "%+f" -0.0` should display `+0.000000` (to match .NET Framework behavior).Actual behavior
Displays
+-0.000000Known workarounds
None known.
Related information
Potentially related to: dotnet/runtime#70460