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

Double value retrieved from bson is different than expected

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 1.13.0
    • libbson
    • None

    Description

      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}

       

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: