[CDRIVER-1177] Update Decimal128 implementation to be spec compliant Created: 24/Mar/16  Updated: 28/Oct/16  Resolved: 08/Jun/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.4.0
Fix Version/s: 1.4.0

Type: Improvement Priority: Major - P3
Reporter: Hannes Magnusson Assignee: David Hatch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-1145 Implement Decimal 128 type spec Closed
is related to CDRIVER-1889 Implement BSON Corpus tests runner Closed

 Description   

There are handful of cases where we are supposed to error (per driver spec) but don't.
We need to update the test json with the missing tests and new ones when added.



 Comments   
Comment by Githook User [ 08/Jun/16 ]

Author:

{u'username': u'dhatch', u'name': u'David Hatch', u'email': u'david.hatch@mongodb.com'}

Message: CDRIVER-1177: Update Decimal128 implementation to be spec compliant

  • Properly interpret non-canonical significands as zero.
  • Select scientific/normal formatting according to new spec.
  • Calculate significant digits correctly for input strings with trailing
    zeros or radix points.
  • Clamp zeros with out of range exponents.
  • Disallow inexact rounding.
  • Accept (case-insensitive) "inf" and "infinity" only.
    Branch: master
    https://github.com/mongodb/libbson/commit/f0dd2900d298e65eb0773eb3339b14d54afca3be
Comment by Githook User [ 08/Jun/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-1177: Update tests&runner per new BSON Corpus format
Branch: master
https://github.com/mongodb/libbson/commit/f0401ecb8a3907e025450f68284d959524a60363

Comment by David Hatch [ 07/Jun/16 ]

Code review url: https://mongodbcr.appspot.com/69710001/

Comment by Hannes Magnusson [ 02/Jun/16 ]

The updated testrunner is available at https://github.com/bjori/libbson/tree/CDRIVER-1177-Decimal128

To run the tests:

$ make test TEST_ARGS="-l /type/decimal128/decimal128-*"
{
  "host": {
    "sysname": "Linux",
    "release": "4.4.0-22-generic",
    "machine": "x86_64",
    "memory": {
      "pagesize": 4096,
      "npages": 16485503
    }
  },
  "options": {
    "parallel": false,
    "fork": true
  },
  "results": [
FAIL
 
Assert Failure:
"{"d":{"$numberDecimal":"1.0384593717069655257060992658440192E+34"}}" != "{"d":{"$numberDecimal":"0"}}"
    { "status": "FAIL", "test_file": "/type/decimal128/decimal128-1","seed": "515225434", "start": 632334.600066212, "end": 632334.800762342, "elapsed": 0.200696130 }
FAIL
 
Assert Failure:
"{"d":{"$numberDecimal":"-1.234567890123456789012345678901234E+33"}}" != "{"d":{"$numberDecimal":"-1234567890123456789012345678901234"}}"
    { "status": "FAIL", "test_file": "/type/decimal128/decimal128-2", "seed": "780675307", "start": 632334.800833023, "end": 632335.009132819, "elapsed": 0.208299796 }
FAIL
 
Assert Failure:
"{"d":{"$numberDecimal":"0E-6"}}" != "{"d":{"$numberDecimal":"0.000000"}}"
    { "status": "FAIL", "test_file": "/type/decimal128/decimal128-3", "seed": "1826630062", "start": 632335.009201137, "end": 632335.197419726, "elapsed": 0.188218589 }
FAIL
 
Assert Failure:
"{"d":{"$numberDecimal":"-0E-1"}}" != "{"d":{"$numberDecimal":"-0.1"}}"
    { "status": "FAIL", "test_file": "/type/decimal128/decimal128-4", "seed": "1669815875", "start": 632335.197480614, "end": 632335.409603236, "elapsed": 0.212122622 }
FAIL
 
Assert Failure:
"{"d":{"$numberDecimal":"2E-6176"}}" != "{"d":{"$numberDecimal":"1E-6176"}}"
    { "status": "FAIL", "test_file": "/type/decimal128/decimal128-5", "seed": "2712618598", "start": 632335.409671690, "end": 632335.611074761, "elapsed": 0.201403071 }
    { "status": "PASS", "test_file": "/type/decimal128/decimal128-6", "seed": "3839937261", "start": 632335.611149808, "end": 632335.611839584, "elapsed": 0.000689776 }
    { "status": "PASS", "test_file": "/type/decimal128/decimal128-7", "seed": "644936699", "start": 632335.611927435, "end": 632335.612666969, "elapsed": 0.000739534 }
  ]
}
Makefile:2429: recipe for target 'test' failed
make: *** [test] Error 5

Generated at Wed Feb 07 21:11:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.