Questions tagged [miscutils]

Jon Skeet's Miscellaneous Utility Library

Jon Skeet's Miscellaneous Utility Library

Here Jon's description of the library: "Every so often, someone on the newsgroup asks about something which doesn't exist in the framework, but which I think should. Sometimes, I'll write some code for them to plug the gap. Just occasionally, I'll tidy up the code, add XML documentation comments etc, and include it in my miscellaneous utility library. This library will, of course, grow over time."

4 questions
3
votes
2 answers

Why doesn't Compile() run every time the method is called?

Here is a code piece from MiscUtil library (by Jon Skeet & Marc Gravell): static T Add(T a, T b) { //TODO: re-use delegate! // declare the parameters ParameterExpression paramA = Expression.Parameter(typeof(T), "a"), paramB =…
starikcetin
  • 1,391
  • 1
  • 16
  • 24
2
votes
1 answer

Is this a bug in MiscUtils?

Is this a bug in MiscUtils or am I missing something? decimal a = (1M/30); int b = 59; Assert.AreEqual(a*b, Operator.MultiplyAlternative(a, b)); Assert.AreEqual(b*a, Operator.MultiplyAlternative(b, a)); Fails on the last line: expected:…
Phil Degenhardt
  • 7,215
  • 3
  • 35
  • 46
1
vote
4 answers

Generic Sqrt Implementation

I'm using the MiscUtils library (thanks Marc G. and Jon S.) and am trying to add a generic Sqrt function to it. The problem can be easily reproduced with this: class N { public N(T value) { Value = value; } public…
Ed S.
  • 122,712
  • 22
  • 185
  • 265
0
votes
1 answer

C# Misc Utils - Operator Generic Math Precision Issues

I'm using Jon Skeet's Misc Util library with Marc's Operator generic math class. I'm finding precision issues that I wouldn't otherwise find if I did the math normally. For example, I find an error of something like .0001 when computing vector cross…
HelloKitty
  • 64
  • 6