Even better equality checking
This commit is contained in:
@@ -102,6 +102,15 @@ namespace Upsilon.BaseTypes.Number
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (IsFloat && obj is double d)
|
||||
{
|
||||
return Math.Abs(((ScriptNumberDouble) this).Value - d) < 0.0000001;
|
||||
}
|
||||
if (!IsFloat && obj is long l)
|
||||
{
|
||||
return ((ScriptNumberLong) this).Value == l;
|
||||
}
|
||||
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((ScriptNumber) obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user