MCPcopy Create free account
hub / github.com/bytedance/bolt / lessThanWithEpsilon

Method lessThanWithEpsilon

bolt/type/Variant.cpp:894–914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892} // namespace
893
894bool variant::lessThanWithEpsilon(const variant& other) const {
895 if (other.kind_ != this->kind_) {
896 return other.kind_ < this->kind_;
897 }
898 if ((kind_ == TypeKind::REAL) or (kind_ == TypeKind::DOUBLE)) {
899 if (isNull() && !other.isNull()) {
900 return true;
901 }
902 if (isNull() || other.isNull()) {
903 return false;
904 }
905
906 // If floating point values are roughly equal, then none of them is less.
907 if (equalsFloatingPointWithEpsilon(*this, other)) {
908 return false;
909 }
910 return *this < other;
911 }
912
913 return BOLT_DYNAMIC_TYPE_DISPATCH_ALL(lessThan, kind_, *this, other);
914}
915
916// Uses kEpsilon to compare floating point types (REAL and DOUBLE).
917// For testing purposes.

Callers

nothing calls this directly

Calls 3

isNullFunction · 0.85
isNullMethod · 0.45

Tested by

no test coverage detected