Skip to content

Instantly share code, notes, and snippets.

open System
open System.Linq
open ArgumentParser
open ArgumentParser.Reflection
open ArgumentParser.Reflection.POSIX
type private GlobalContext() =
static member public Instance = new GlobalContext()
member public this.Test = null
interface IParserContext with
@notpeelz
notpeelz / DoubleComparer.cs
Created March 7, 2015 04:42
Floating-point number comparer
readonly Comparer<Double> doubleComparer = Comparer<Double>.Create((x, y) =>
{
long firstValue = BitConverter.DoubleToInt64Bits(x);
long secondValue = BitConverter.DoubleToInt64Bits(y);
// Compare the bit-sign
if (firstValue >> 63 != secondValue >> 63)
return firstValue == secondValue ? 0 : firstValue.CompareTo(secondValue);
long difference = Math.Abs(firstValue - secondValue);