MCPcopy Create free account
hub / github.com/documentdb/documentdb / IsBsonValueInfinity

Function IsBsonValueInfinity

pg_documentdb_core/src/query/bson_compare.c:960–987  ·  view source on GitHub ↗

* Returns 0 if value is not Infinity * Returns 1 if value is Infinity * Returns -1 if value is -Infinity */

Source from the content-addressed store, hash-verified

958 * Returns -1 if value is -Infinity
959 */
960int
961IsBsonValueInfinity(const bson_value_t *value)
962{
963 if (value->value_type == BSON_TYPE_DECIMAL128)
964 {
965 bool isPositiveInfinity = false;
966 if (IsDecimal128Infinity(value, &isPositiveInfinity))
967 {
968 return isPositiveInfinity ? 1 : -1;
969 }
970 }
971 else if (value->value_type == BSON_TYPE_DOUBLE)
972 {
973 double doubleValue = BsonValueAsDouble(value);
974
975 if (doubleValue == (double) INFINITY)
976 {
977 return 1;
978 }
979
980 if (doubleValue == (double) -INFINITY)
981 {
982 return -1;
983 }
984 }
985
986 return 0;
987}
988
989
990bool

Callers 15

ProcessDollarSinFunction · 0.85
ProcessDollarCosFunction · 0.85
ProcessDollarTanFunction · 0.85
BsonValueGetCenterFunction · 0.85
BsonValueGetCenterSphereFunction · 0.85
HandleSliceInputDataFunction · 0.85

Calls 2

IsDecimal128InfinityFunction · 0.85
BsonValueAsDoubleFunction · 0.85

Tested by

no test coverage detected