Skip to content

Fix BigInteger to double conversion rounding on s390x - #131491

Open
abhishekabhi73cc-design wants to merge 3 commits into
dotnet:mainfrom
abhishekabhi73cc-design:fix-mono-bigint-convert-double-s390x
Open

Fix BigInteger to double conversion rounding on s390x#131491
abhishekabhi73cc-design wants to merge 3 commits into
dotnet:mainfrom
abhishekabhi73cc-design:fix-mono-bigint-convert-double-s390x

Conversation

@abhishekabhi73cc-design

Copy link
Copy Markdown
Contributor

Summary

Fix the rounding mode used by the s390x CDLGBR instruction during BigInteger to double conversion in the Mono JIT.

The CDLGBR instruction encodes the IEEE-754 rounding mode in its M3 field. The implementation was using M3 = 6 (round toward +infinity), which produced incorrect results for values that require round-to-nearest-even behavior.

This change updates the M3 field to 4, which corresponds to round to nearest with ties to even, matching the expected .NET floating-point conversion semantics.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 28, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Labels

area-VM-meta-mono community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant