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

Double value retrieved from bson is different than expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 1.13.0
    • Fix Version/s: None
    • Component/s: libbson
    • Labels:
      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

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: