Skip to content

System.Half ToString() bug  #75204

@c-ohle

Description

@c-ohle

Description

System.Half ToString() produces incorrect numbers.

Example: Half.MaxValue shows 65500, Half.MinValue -65500
but should be 65504 and -65504.
Binary, the values are correct as I have checked:

image

Reproduction Steps

      var s1 = Half.MaxValue.ToString(); // 65500
      var s2 = ((double)Half.MaxValue).ToString(); // 65504

Expected behavior

      var s1 = Half.MaxValue.ToString(); // 65504

Actual behavior

      var s1 = Half.MaxValue.ToString(); // 65500

Regression?

No response

Known Workarounds

No response

Configuration

7.0.0-rc.1.22422.12

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions