Skip to content

Wrong ILogB result for subnormal values #116912

Description

@huoyaoyuan

Math.ILogB incorrectly uses TZCNT instead of LZCNT for subnormal values:

return double.MinExponent - (BitOperations.TrailingZeroCount(x.TrailingSignificand) - double.BiasedExponentLength);

Math.ILogB(1e-308) returns -1024 on .NET 8, and -1012 on .NET 9. The correct result is -1024.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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