Bug 31061 - MonoTests.System.MathTest.TestPow should use machine epsilon
Summary: MonoTests.System.MathTest.TestPow should use machine epsilon
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Other
: --- normal
Target Milestone: Untriaged
Assignee: Ludovic Henry
URL:
Depends on:
Blocks:
 
Reported: 2015-06-12 07:34 UTC by Marcin Cieślak
Modified: 2015-10-29 14:47 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Marcin Cieślak 2015-06-12 07:34:45 UTC
MonoTests.System.MathTest.TestPow incorrectly uses double.Epsilon value (4.9406564584124654E-324 on my box)
to compare double numbers. It should have been using some machine epsilon value - for 52 bit mantissa something
like 2.220446049250313080847263e-16

MonoTests.System.MathTest.TestPow fails on my FreeBSD box with:

5) MonoTests.System.MathTest.TestPow : Unexpected exception at iTest=1. e=NUnit.Framework.AssertionException:   1,3636094460602122 != 1,3636094460602119
  Expected: True
  But was:  False

  at NUnit.Framework.Assert.That (System.Object actual, NUnit.Framework.Constraints.Constraint constraint, System.String message, System.Object[] args) [0x00020] in /home/saper/sw/mono/mcs/nunit24/NUnitFramework/framework/Assert.cs:2205 
  at NUnit.Framework.Assert.IsTrue (Boolean condition, System.String message, System.Object[] args) [0x00000] in /home/saper/sw/mono/mcs/nunit24/NUnitFramewor
k/framework/Assert.cs:96 
  at NUnit.Framework.Assert.IsTrue (Boolean condition, System.String message) [0x00000] in /home/saper/sw/mono/mcs/nunit24/NUnitFramework/framework/Assert.cs:
107 
  at MonoTests.System.MathTest.TestPow () [0x0001c] in /home/saper/sw/mono/mcs/class/corlib/Test/System/MathTest.cs:488 ^M
at MonoTests.System.MathTest.TestPow () [0x00386] in /home/saper/sw/mono/mcs/class/corlib/Test/System/MathTest.cs:554
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /home/saper/sw/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
5) MonoTests.System.MathTest.TestPow : Unexpected exception at iTest=1. e=NUnit.Framework.AssertionException:   1,3636094460602122 != 1,3636094460602119
  Expected: True
  But was:  False

  at NUnit.Framework.Assert.That (System.Object actual, NUnit.Framework.Constraints.Constraint constraint, System.String message, System.Object[] args) [0x00020] in /home/saper/sw/mono/mcs/nunit24/NUnitFramework/framework/Assert.cs:2205 
  at NUnit.Framework.Assert.IsTrue (Boolean condition, System.String message, System.Object[] args) [0x00000] in /home/saper/sw/mono/mcs/nunit24/NUnitFramewor
k/framework/Assert.cs:96 
  at NUnit.Framework.Assert.IsTrue (Boolean condition, System.String message) [0x00000] in /home/saper/sw/mono/mcs/nunit24/NUnitFramework/framework/Assert.cs:
107 
  at MonoTests.System.MathTest.TestPow () [0x0001c] in /home/saper/sw/mono/mcs/class/corlib/Test/System/MathTest.cs:488 ^M
at MonoTests.System.MathTest.TestPow () [0x00386] in /home/saper/sw/mono/mcs/class/corlib/Test/System/MathTest.cs:554
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /home/saper/sw/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
Comment 1 Ludovic Henry 2015-10-29 14:24:40 UTC
Hi Marcin,

Sorry for the long delay, but this is now fixed on master with 5fb2e37f0c1b4a55045f552a0d61e8ecd729664e

Thank you for the report!
Comment 2 Marcin Cieślak 2015-10-29 14:47:22 UTC
Thank you very much! Can't test right now but will test at the nearest opportunity to play with mono again.