Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29679

$inc generating some wrong value when incremented with negative decimal value

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.2
    • Component/s: Querying
    • None
    • ALL
    • Hide

      1.Insert

      db.test.insert({"qty":4.464})
      

      2.check results

      db.test.find()
      

      3.increment the value with negative fractional value

      db.test.update({},{$inc:{"qty":-0.608}})
      

      4.check the output

      db.test.find()
      

      Actual Output: "qty" : 3.8560000000000003
      Expected Output: "qty" : 3.856

      Show
      1.Insert db.test.insert({"qty":4.464}) 2.check results db.test.find() 3.increment the value with negative fractional value db.test.update({},{$inc:{"qty":-0.608}}) 4.check the output db.test.find() Actual Output: "qty" : 3.8560000000000003 Expected Output: "qty" : 3.856
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      While using $inc to decrement a value by some fractional value,ganerated output differs with expected output.

            Assignee:
            mark.agarunov Mark Agarunov (Inactive)
            Reporter:
            sawantsuraj91@gmail.com Suraj Sawant
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: