public static FloatCompare ( double a, double b, double delta = 1e-5 ) : bool | ||
a | double | |
b | double | |
delta | double | |
return | bool |
public static bool FloatCompare(double a, double b, double delta=1e-5)
{
return Math.Abs(a - b) < delta;
}
public bool SameNode(int meI, CTWContextTreeNode he) { var me = this.Nodes[meI]; return(Utils.FloatCompare(me.LogProbability, he.LogProbability) && Utils.FloatCompare(me.LogKt, he.LogKt) && Utils.FloatCompare(me.NumberOf0S, he.NumberOf0S) && Utils.FloatCompare(me.NumberOf1S, he.NumberOf1S) && (me.Child1 != -1) == he.Children.ContainsKey(1) && (me.Child0 != -1) == he.Children.ContainsKey(0)); }