* Converts a bsonValue numeric type to long double type * with 80 bit precision. */
| 1417 | * with 80 bit precision. |
| 1418 | */ |
| 1419 | static long double |
| 1420 | BsonNumberAsLongDouble(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 | /* |
no test coverage detected