1BSON_DECIMAL128_T(3) libbson BSON_DECIMAL128_T(3)
2
3
4
6 bson_decimal128_t - bson_decimal128_t
7
8 BSON Decimal128 Abstraction
9
11 #include <bson/bson.h>
12
13 #define BSON_DECIMAL128_STRING 43
14 #define BSON_DECIMAL128_INF "Infinity"
15 #define BSON_DECIMAL128_NAN "NaN"
16
17 typedef struct {
18 #if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN
19 uint64_t low;
20 uint64_t high;
21 #elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN
22 uint64_t high;
23 uint64_t low;
24 #endif
25 } bson_decimal128_t;
26
28 The bson_decimal128_t structure represents the IEEE-754 Decimal128 data
29 type.
30
32 #include <bson/bson.h>
33 #include <stdio.h>
34
35 int
36 main (int argc, char *argv[])
37 {
38 char string[BSON_DECIMAL128_STRING];
39 bson_decimal128_t decimal128;
40
41 bson_decimal128_from_string ("100.00", &decimal128);
42 bson_decimal128_to_string (&decimal128, string);
43 printf ("Decimal128 value: %s\n", string);
44
45 return 0;
46 }
47
49 MongoDB, Inc
50
52 2017-present, MongoDB, Inc
53
54
55
56
571.20.0 Nov 18, 2021 BSON_DECIMAL128_T(3)