Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3377

Double value retrieved from bson is different than expected

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.13.0
    • Component/s: libbson
    • None

      Example code:

      #include <bson.h>
      #include <stdio.h>
       
      int main() {
       bson_t b = BSON_INITIALIZER;
       BSON_APPEND_DOUBLE (&b, "a", 3399.99);
       
       size_t len;
       char *str;
       str = bson_as_json (&b, &len);
       printf ("%s\n", str);
       
       bson_free (str);
       return 0;
      }

      Actual output:

      { "a" : 3399.9899999999997817}

      Expected output:

      { "a" : 3399.99}

       

       

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            azitouni@magnitude.com Aziz Zitouni
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: