Skip to content

printf format specifier with zero padding behaves incorrectly for negative zero (-0.0) on .NET Core #15558

Open
@jwosty

Description

@jwosty

printf formatting a value of -0.0 with %010f (or anything which adds some zero padding) incorrectly places the - symbol.

Expected behavior

sprintf "%010.3f" -0.0 should display -00000.000 sprintf "%010.3f" -0.0 should display 00000.000 (to match .NET Framework).

This works correctly for other negative values. For example, sprintf "%010.3f" -0.01 displays -00000.100.

Actual behavior

Displays 0000-0.000

Known workarounds

None known.

Related information

Potentially related to: #15557

  • macOS 12.6
  • .NET 6.0.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LibraryIssues for FSharp.Core not covered elsewhereBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions