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

Function BsonNumberAsLongDouble

pg_documentdb_core/src/query/bson_compare.c:1419–1454  ·  view source on GitHub ↗

* Converts a bsonValue numeric type to long double type * with 80 bit precision. */

Source from the content-addressed store, hash-verified

1417 * with 80 bit precision.
1418 */
1419static long double
1420BsonNumberAsLongDouble(const bson_value_t *value)
1421{
1422 switch (value->value_type)
1423 {
1424 case BSON_TYPE_BOOL:
1425 {
1426 return (long double) value->value.v_bool;
1427 }
1428
1429 case BSON_TYPE_DOUBLE:
1430 {
1431 return (long double) value->value.v_double;
1432 }
1433
1434 case BSON_TYPE_INT32:
1435 {
1436 return (long double) value->value.v_int32;
1437 }
1438
1439 case BSON_TYPE_INT64:
1440 {
1441 return (long double) value->value.v_int64;
1442 }
1443
1444 case BSON_TYPE_DECIMAL128:
1445 {
1446 return GetBsonDecimal128AsLongDouble(value);
1447 }
1448
1449 default:
1450 {
1451 return 0;
1452 }
1453 }
1454}
1455
1456
1457/*

Callers 1

CompareNumbersFunction · 0.85

Calls 1

Tested by

no test coverage detected