-Added ICloneable and DeepClone to JToken

-Changed DeepEquals to take into account possible floating point errors
This commit is contained in:
JamesNK
2010-12-27 21:25:06 +00:00
parent f32e1f53c5
commit 3ad33f7329
4 changed files with 111 additions and 4 deletions
@@ -124,5 +124,11 @@ namespace Newtonsoft.Json.Utilities
return Math.Max(val1.Value, val2.Value);
}
public static bool ApproxEquals(double d1, double d2)
{
// are values equal to within 12 (or so) digits of precision?
return Math.Abs(d1 - d2) < (Math.Abs(d1) * 1e-12);
}
}
}