
C# math gotchas - fogus
http://www.johndcook.com/blog/2010/06/08/c-math-gotchas/
======
gjm11
Yow. C# defines something it calls "double.Epsilon" but it _isn't_ the machine
epsilon as generally understood (i.e., the smallest thing you can add to 1 and
get something bigger than 1), it's the smallest representable (denormalized!)
positive double. In other words, something like 10^-324 rather than about
10^-16.

[EDITED to add: this isn't the only gotcha he describes, but it's the scary
one because if all you know is that C# has a thing called double.Epsilon, it
likely won't even occur to you that it might be anything other than the
machine epsilon. It's as if they'd defined something called "CPUClockRate" but
it was the number of scheduler ticks per second instead of the clock speed, or
something.]

------
TeHCrAzY
The double.MinValue follows the .NET convention

If you are going to use a function/value in a language/framework you are not
familiar with, have a look at how it works or look up the extensive
documentation first:

    
    
        "The value of this constant is negative 1.7976931348623157E+308."[1]
    
        "The value of the Epsilon property is not equivalent to machine epsilon,
         which represents the upper bound of the relative error due to rounding 
         in floating-point arithmetic."[2]
    

[1] [http://msdn.microsoft.com/en-
us/library/system.double.minval...](http://msdn.microsoft.com/en-
us/library/system.double.minvalue.aspx)

[2] [http://msdn.microsoft.com/en-
us/library/system.double.epsilo...](http://msdn.microsoft.com/en-
us/library/system.double.epsilon.aspx)

