Created
September 19, 2014 10:59
-
-
Save kashmervil/d8d070dcdcb54cf94f35 to your computer and use it in GitHub Desktop.
Неприятный баг в тестовой системе. Особенно заметный при использовании функций с generics-параметрами. Два файла: До загрузки и после
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Integral | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var result = Integral(((x, y) => 1.0), 0, Math.PI/2); | |
Console.WriteLine(result); | |
} | |
private static double Integral(Func, Tuple>>>, double, double> f, double a, double b) | |
{ | |
const int n = 10000; | |
var h = (b - a)/n; | |
var result = 0.0; | |
for (var i = 0; i < n; i++) | |
{ | |
result += f(new Object(), 1.0); | |
} | |
return result*h; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Integral | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var result = Integral(((x, y) => 1.0), 0, Math.PI/2); | |
Console.WriteLine(result); | |
} | |
private static double Integral(Func<Tuple<int, Tuple<string, int, Func<Func<int, UInt16>, Tuple<object, object>>>>, double, double> f, double a, double b) | |
{ | |
const int n = 10000; | |
var h = (b - a)/n; | |
var result = 0.0; | |
for (var i = 0; i < n; i++) | |
{ | |
result += 0.1; | |
} | |
return result*h; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment