BDE 3.95.0 Release

Schedule

  • The BDE team announces that the BDE 3.95.0 production release was completed on Monday, December 6, 2021.

BDE 3.95.0 Highlights

Change to the output of floating point values in XML and JSON

In this release, the JSON and XML encoders will change their default encoding for floating point values to ensure that when those values are later decoded it results in the original floating point value. This change means that the default textual output of the encoders will change, and any particular encoded floating point value may be rendered with more or fewer digits of precision than it is today. Clients who explicitly configure the output of floating point numbers in their encoding options will not be impacted.

The potential impact, aside from potentially preserving additional precision when the value is later decoded, would be to applications (or more likely tests) that expect an exact textual representation of an encoded floating point value. This will impact tests which hard-code expected encoded text. This could potentially impact 3rd-party tools parsing the encoded documents, though we are not aware of 3rd party tools that would be impacted. [Footnote 1]

Currently, by default, BDE’s JSON and XML encoders use a hard-coded constant, numeric_limits<>::digits10, to determine the maximum number of digits to print when encoding a floating point value. This constant ensures that if the value was originally a base-10 number (e.g., a price, “2.5”) that when it is converted back to base-10, the value is preserved. The planned change will mean the default representation of floating point values will use the shortest possible textual representation that will convert back to the same binary representation of that value. This textual representation is based on (and enabled by) the newly introduced bslalg::NumericFormatterUtil::toChars function, which is implemented across all our supported platforms, and is analogous to the C++17 std::to_chars function. [Footnote 2]

JSON Encoder Details

For the JSON encoder, the current default values for the maxFloatPrecision and maxDoublePrecision options will change from bsl::numeric_limits<>::digits10 to 0, and a value 0 for these options will indicate to use the shortest textual representation that will decode to the same value.

XML Encoder Details

The XML encoder supports two formatting “modes” for floating point numbers, DEFAULT and DECIMAL (DECIMAL formatting mode applies to binary floating point values, and is not related to the bdldfp::Decimal floating point types, which it predates).

  • For the DEFAULT formatting mode, floating point values will now be rendered using the shortest textual representation (significantDoubleDigits option is ignored, and has been for many years).

  • For the DECIMAL formatting mode, unset maxDecimalTotalDigits and maxDecimalFractionalDigits values will be interpreted to render the shortest textual representation.

  • Floating-point values with no fractional digits will now be rendered without a fractional part (e.g., “2” instead of “2.0”). The DEFAULT formatting mode already has this behavior.

Footnote 1

Although we are not aware of impacted 3rd party XML or JSON parsers, this could potentially impact:

  • A (non-conforming) 3rd party parser incapable of handling additional digits of precision

  • A 3rd party XML parser that is supplied documents using the DECIMAL (rather than DEFAULT) formatting mode encoding option, where the parser does not use the document schema and represents values without a fractional part as an integer (i.e., the value “2” might be represented by such a parser as an integer rather than a floating point value).

Footnote 2

bslalg::NumericFormatterUtil::toChars is implemented using the fastest known algorithm, “Ryu”, which is also used by the libstdc++, libc++, and the MSVC standard libraries.

Fixed requests: 3.95.0

Summary

Define transparent comparators for ‘bsl::string’ in STL containers

please correct bslmt_timedsemaphore.t.cpp issue

Change default XML and JSON floating pt encode precision to shortest-round-trip

balxml: change default floating pt encoding to shortest round-trip

Fix baexml tests due to balxml encoder changes

Add Template deduction guides for bsl::list

s_baltst: Refactor for upcoming changes

Add Template deduction guides for bsl::vector

Add Template deduction guides for bsl::deque

Fix for accidentally-quadratic repeated calls to BlobUtil::append()

Add class template deduction guides to bsl::stack

Add class template deduction guides to bsl::queue

linkcoercion use should not have a trailing semicolon

bdlt::Datetime::setHour contract issue

Apply ‘black’ to all BDE python scripts

fix bsls_timedsemaphore nightly build issue with ‘timedWait’ on Windows

Release RYU changes to baljsn and balxml

Release BDE 3.95.0