Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/3.0] Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic. #26017

Merged
merged 2 commits into from Aug 7, 2019

Conversation

@tannergooding
Copy link
Member

commented Aug 5, 2019

Description

The managed implementations of the Math.Round functions were not IEEE compliant and would return a different result between Debug and Release mode. In .NET Core 3 with the tiered JIT support they now return a different result for the first 29 calls of the function before the JIT recognizes them as "hot" and they are rejitted.

Customer Impact

Customers calling Math.Round or MathF.Round may get different behavior between two consecutive calls to the functions.

Regression?

Yes, as per the description.

Risk

Low. This is pulling in a port of a known good implementation from the BSD SoftFloat library. It was additionally validated that all 4 billion inputs for the single-precision input range are returning the correct values as compared to the intrinsic forms of these APIs (which compile down to the roundss and roundsd instructions).

tannergooding added some commits Aug 5, 2019

Updating Math.Round and MathF.Round to be IEEE compliant so that the …
…intrinsic and managed form are deterministic. (#25901)

* Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic.

* Fixing the Math.Round and MathF.Round handling for values greater than 0.5 and less than 1.0

* Applying formatting patch.
@tannergooding

This comment has been minimized.

Copy link
Member Author

commented Aug 5, 2019

This is a backport of #25901

@tannergooding

This comment has been minimized.

Copy link
Member Author

commented Aug 5, 2019

CC. @CarolEidt, @AndyAyersMS, @jkotas, @danmosemsft

I added one additional commit, which addresses @CarolEidt's request that we document that only the roundToNearestTiesToEven code path (see the request here: https://github.com/dotnet/coreclr/pull/25901/files/e248d2232ef0930583982053e19923c4edfd9d51#diff-3ad59bdf390b0bd6aa8fda8d4e7e3a6a)

@tannergooding tannergooding added this to the 3.0 milestone Aug 5, 2019

@CarolEidt
Copy link
Member

left a comment

LGTM - thanks!

@danmosemsft

This comment has been minimized.

Copy link
Member

commented Aug 6, 2019

Bug exposed by enabling tiering by default in 3.0

@danmosemsft

This comment has been minimized.

Copy link
Member

commented Aug 6, 2019

Approved by tactics for 3.0, @wtgodbe or @Anipik will merge when branch opens for preview 9.

@danmosemsft danmosemsft removed the ask-mode label Aug 6, 2019

@stephentoub stephentoub changed the title Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic. [release/3.0] Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic. Aug 7, 2019

@wtgodbe

This comment has been minimized.

Copy link
Member

commented Aug 7, 2019

Branch is open, merging

@wtgodbe wtgodbe merged commit f879b52 into dotnet:release/3.0 Aug 7, 2019

37 checks passed

WIP Ready for review
Details
coreclr-ci Build #20190805.27 succeeded with issues
Details
coreclr-ci (Build Linux arm checked) Build Linux arm checked succeeded
Details
coreclr-ci (Build Linux arm64 checked) Build Linux arm64 checked succeeded
Details
coreclr-ci (Build Linux arm64 release) Build Linux arm64 release succeeded
Details
coreclr-ci (Build Linux_musl x64 checked) Build Linux_musl x64 checked succeeded
Details
coreclr-ci (Build Linux_musl x64 release) Build Linux_musl x64 release succeeded with issues
Details
coreclr-ci (Build Linux_rhel6 x64 release) Build Linux_rhel6 x64 release succeeded
Details
coreclr-ci (Build Windows_NT arm Checked) Build Windows_NT arm Checked succeeded
Details
coreclr-ci (Build Windows_NT arm64 Checked) Build Windows_NT arm64 Checked succeeded
Details
coreclr-ci (Build Windows_NT x64 Checked) Build Windows_NT x64 Checked succeeded
Details
coreclr-ci (Build Windows_NT x64 Debug) Build Windows_NT x64 Debug succeeded
Details
coreclr-ci (Build Windows_NT x86 Checked) Build Windows_NT x86 Checked succeeded
Details
coreclr-ci (Build Windows_NT x86 Debug) Build Windows_NT x86 Debug succeeded
Details
coreclr-ci (Formatting Linux x64) Formatting Linux x64 succeeded
Details
coreclr-ci (Test Pri0 CoreFX Linux x64 checked) Test Pri0 CoreFX Linux x64 checked succeeded
Details
coreclr-ci (Test Pri0 CoreFX Windows_NT x64 checked) Test Pri0 CoreFX Windows_NT x64 checked succeeded
Details
coreclr-ci (Test Pri0 Linux x64 checked) Test Pri0 Linux x64 checked succeeded
Details
coreclr-ci (Test Pri0 Linux_musl x64 release) Test Pri0 Linux_musl x64 release succeeded
Details
coreclr-ci (Test Pri0 OSX x64 checked) Test Pri0 OSX x64 checked succeeded
Details
coreclr-ci (Test Pri0 R2R Linux x64 checked) Test Pri0 R2R Linux x64 checked succeeded
Details
coreclr-ci (Test Pri0 R2R OSX x64 checked) Test Pri0 R2R OSX x64 checked succeeded
Details
coreclr-ci (Test Pri0 R2R Windows_NT x64 checked) Test Pri0 R2R Windows_NT x64 checked succeeded
Details
coreclr-ci (Test Pri0 R2R Windows_NT x86 checked) Test Pri0 R2R Windows_NT x86 checked succeeded
Details
coreclr-ci (Test Pri0 Windows_NT arm checked) Test Pri0 Windows_NT arm checked succeeded
Details
coreclr-ci (Test Pri0 Windows_NT arm64 checked) Test Pri0 Windows_NT arm64 checked succeeded
Details
coreclr-ci (Test Pri0 Windows_NT x64 checked) Test Pri0 Windows_NT x64 checked succeeded
Details
coreclr-ci (Test Pri0 Windows_NT x86 checked) Test Pri0 Windows_NT x86 checked succeeded
Details
coreclr-ci (Test pri0 Linux arm checked) Test pri0 Linux arm checked succeeded
Details
coreclr-ci (Test pri0 Linux arm64 checked) Test pri0 Linux arm64 checked succeeded
Details
coreclr-ci (Test pri0 Linux_musl x64 checked) Test pri0 Linux_musl x64 checked succeeded
Details
coreclr-ci (build Linux x64 Checked) build Linux x64 Checked succeeded
Details
coreclr-ci (build OSX x64 Checked) build OSX x64 Checked succeeded
Details
coreclr-ci (build Windows_NT arm Release) build Windows_NT arm Release succeeded
Details
coreclr-ci (build Windows_NT arm64 Release) build Windows_NT arm64 Release succeeded
Details
coreclr-ci (build Windows_NT x64 Release) build Windows_NT x64 Release succeeded
Details
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.