Skip to content

BigInteger TryParse_VeryLargeNegativeNumber fails on 64-bit since native-width limbs #138217

Description

@lewing

System.Numerics.Tests.parseTest.TryParse_VeryLargeNegativeNumber ([OuterLoop], src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs) fails on every 64-bit configuration of runtime-libraries-coreclr outerloop-linux on main. That's 7 linux x64/arm64 legs in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1694846, and every retained run back to 2026-10-25 (https://dev.azure.com/dnceng-public/public/_build/results?buildId=1648352). arm32 and wasm32 pass. It also fails on browser-wasm64, where the test now runs.

Assert.False() Failure
Expected: False
Actual:   True
   at System.Numerics.Tests.parseTest.TryParse_VeryLargeNegativeNumber() in parse.cs:line 375

The test sizes its input as BigInteger.MaxLength * 8 + 2 hex digits, assuming 8 digits (32 bits) per block. Since #125799 switched BigInteger to native-width limbs, DigitsPerBlock is nint.Size * 8 / BitsPerDigit (16 on 64-bit) and MaxLength is in 64-bit limbs. The input therefore no longer reaches the overflow limit, and TryParse returns true. The test should probably derive the length from the limb size, for example BigInteger.MaxLength * (nint.Size * 2) + 2, or expose the digits-per-block it depends on.

Note

This issue was drafted with GitHub Copilot.

Activity

  1. added
    untriaged
    on Nov 24, 2026
  2. dotnet-policy-service commented on Nov 24, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-numerics
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriaged
    on Nov 24, 2026
  4. added a commit that references this issue on Nov 24, 2026
    dec9ca8
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