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

Fix Half comparison #39773

Merged
merged 3 commits into from
Jul 27, 2020
Merged

Fix Half comparison #39773

merged 3 commits into from
Jul 27, 2020

Conversation

Gnbrkm41
Copy link
Contributor

Fixes #39770

  • Fixes the comparison to be correct when both numbers are negative
  • Add relevant tests

cc @tannergooding

* Fixes the comparison to be correct when both numbers are negative
* Add relevant tests
@@ -116,7 +116,7 @@ private ushort Significand
// says they should be equal, even if the signs differ.
return leftIsNegative && !AreZero(left, right);
}
return (short)(left._value) < (short)(right._value);
return left._value < right._value ^ leftIsNegative;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's pretty much the same.

@tannergooding
Copy link
Member

@tarekgh, @GrabYourPitchforks; seems to be a number of ICU failures that are likely unrelated.

@tarekgh
Copy link
Member

tarekgh commented Jul 23, 2020

@safern CI started to get the following failures, any idea what has changed? Is this the issue that the PR #39833 is fixing?

Executed on dci-mac-build-043.local
+ ./RunTests.sh --runtime-path /tmp/helix/working/B6540A0D/p
----- start Thu Jul 23 02:11:51 PDT 2020 =============== To repro directly: =====================================================
pushd .
/tmp/helix/working/B6540A0D/p/dotnet exec --runtimeconfig Common.Tests.runtimeconfig.json --depsfile Common.Tests.deps.json xunit.console.dll Common.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing 
popd
===========================================================================================================
/private/tmp/helix/working/B6540A0D/w/AC97099A/e /private/tmp/helix/working/B6540A0D/w/AC97099A/e
Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.GlobalizationMode.get_Invariant()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_CachedCulturesByName()
   at System.Globalization.CultureInfo.GetCultureInfo(System.String)
   at System.Reflection.RuntimeAssembly.GetLocale()
   at System.Reflection.RuntimeAssembly.GetName(Boolean)
   at System.Reflection.Assembly.GetName()
   at Internal.Microsoft.Extensions.DependencyModel.DependencyContextLoader.LoadAssemblyContext(System.Reflection.Assembly, Internal.Microsoft.Extensions.DependencyModel.IDependencyContextReader)
   at Internal.Microsoft.Extensions.DependencyModel.DependencyContextLoader.Load(System.Reflection.Assembly)
   at Internal.Microsoft.Extensions.DependencyModel.DependencyContext.Load(System.Reflection.Assembly)
   at Xunit.AssemblyHelper..ctor(System.String, Xunit.Abstractions.IMessageSink)
   at Xunit.AssemblyHelper.SubscribeResolveForAssembly(System.Type, Xunit.Abstractions.IMessageSink)
   at Xunit.ConsoleClient.Program.Main(System.String[])

@tarekgh
Copy link
Member

tarekgh commented Jul 23, 2020

CC @akoeplinger for the ICU failures on OSX if this is related to #39833

@safern
Copy link
Member

safern commented Jul 23, 2020

CC @akoeplinger for the ICU failures on OSX if this is related to #39833

@tarekgh I just validated and the build didn't not have @akoeplinger changes. I will trigger a build again.

@safern
Copy link
Member

safern commented Jul 23, 2020

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@safern
Copy link
Member

safern commented Jul 23, 2020

/azp run dotnet-linker-tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tannergooding tannergooding merged commit 0404a4b into dotnet:master Jul 27, 2020
tannergooding pushed a commit to tannergooding/runtime that referenced this pull request Jul 27, 2020
* Fix Half comparison

* Fixes the comparison to be correct when both numbers are negative
* Add relevant tests

* Add parentheses for clarity

* Add tests validating comparison between negative numbers for Single/Double as well
tannergooding added a commit that referenced this pull request Jul 28, 2020
* Fix Half comparison

* Fixes the comparison to be correct when both numbers are negative
* Add relevant tests

* Add parentheses for clarity

* Add tests validating comparison between negative numbers for Single/Double as well

Co-authored-by: Ganbarukamo41 <[email protected]>
@Gnbrkm41 Gnbrkm41 deleted the halfcomparison branch July 31, 2020 16:35
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
* Fix Half comparison

* Fixes the comparison to be correct when both numbers are negative
* Add relevant tests

* Add parentheses for clarity

* Add tests validating comparison between negative numbers for Single/Double as well
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Half doesn't generate correct ordered comparison results when both sides are negative
6 participants