lengthDistance method Null safety
- Term other
Returns a normalized measure of difference between this Term and
other on a log (base 2) scale:
- returns 0.0 if
otherand this are the same length; - returns 0.0 if both this and
otherare empty; - returns 999.0 if this or
otheris empty, but not both; - returns 1.0 if
otheris twice as long, or half as long as this;
abs(log2(other.length/this.length)
Implementation
double lengthDistance(Term other) => isEmpty
? other.isEmpty
? 0
: 999
: other.isEmpty
? 999
: (log(other.length / length) / log(2)).abs();