Here is the problem: I started to look but immediately saw: this is not your C# code. This is the code which cannot compile, quite apparently. So, it could not be the code which can give any results you are referring to, different or not.
The code won't compile due to undeclared object
This
(don't mix up with the reference
this
which also would not compile). However, it would compile if you add a
double
field or property with this name in a declaring class, but then it would be inadequate implementation. Here is the hint: declare the method
static
and use only stack memory in it. That would be a correct code design. The general impression that this C# code has very little do to with original code. For example, you never use
double.NegativeInfinity
and
double.PositiveInfinity
, which are essentially used in the original code. Please see:
http://msdn.microsoft.com/en-us/library/system.double.negativeinfinity.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.double.positiveinfinity.aspx[
^].
I think this is enough; there is no much sense to analyze it any further. You need to make a real translation, to have something to discuss.
—SA