Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Introduce decimal type to tarantool core.
@ 2019-06-04 16:04 Serge Petrenko
  2019-06-04 16:04 ` [PATCH v3 1/4] third-party: add decNumber library Serge Petrenko
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Serge Petrenko @ 2019-06-04 16:04 UTC (permalink / raw)
  To: georgy; +Cc: vdavydov.dev, tarantool-patches, kostja, Serge Petrenko

https://github.com/tarantool/tarantool/issues/692
https://github.com/tarantool/tarantool/tree/sp/gh-692-mp-encode-decimal

This patchset adds a new type, decimal fixed-point, to tarantool and allows to
encode/decode decimals in msgpack.

The first patch adds decNumber library as a submodule.

The second patch adds a small wrapper to the library to make it work
with fixed-point decimal values, and adds a unit test.
To evaluate number precision and scale from exponent and the amount of
significant digits the following formulas are applied:
 If exponent < 0 then precision = MAX(digits, -exponent) and scale = -exponent
 If exponent > 0 then precision = digits + exponent, and scale = 0

The third patch updates msgpuck library to add extension types, which are used
to encode decimals.

The fourth patch adds methods to encode/decode decimals, adds the first
messagepack ext type, MP_DECIMAL, and tests for encoding/decoding decimals.

Changes in v3:
  - add patches 3 and 4 to
    encode/decode decimals
    as msgpack.

Changes in v2:
 - get rid of explicit precision and scale,
   evaluate them from decNumber digits and exponent.
 - decimal is now an alias for decNumber
 - ln, log10, exp, sqrt, pow now accept precision to
   which the result should be rounded.

Serge Petrenko (4):
  third-party: add decNumber library
  lib/core: introduce decimal type to tarantool
  lib: update msgpuck library
  decimal: add MessagePack encoding/decoding support

 .gitmodules                  |   3 +
 CMakeLists.txt               |   7 +
 cmake/BuildDecNumber.cmake   |  14 +
 src/CMakeLists.txt           |   1 +
 src/lib/core/CMakeLists.txt  |   3 +-
 src/lib/core/decimal.c       | 357 ++++++++++++++++++++++++++
 src/lib/core/decimal.h       | 197 ++++++++++++++
 src/lib/core/mp_user_types.h |  38 +++
 src/lib/msgpuck              |   2 +-
 test/unit/CMakeLists.txt     |   2 +
 test/unit/decimal.c          | 239 +++++++++++++++++
 test/unit/decimal.result     | 253 ++++++++++++++++++
 test/unit/msgpack.result     | 480 ++++++++++++++++++++++++++++++++++-
 third_party/decNumber        |   1 +
 14 files changed, 1582 insertions(+), 15 deletions(-)
 create mode 100644 cmake/BuildDecNumber.cmake
 create mode 100644 src/lib/core/decimal.c
 create mode 100644 src/lib/core/decimal.h
 create mode 100644 src/lib/core/mp_user_types.h
 create mode 100644 test/unit/decimal.c
 create mode 100644 test/unit/decimal.result
 create mode 160000 third_party/decNumber

-- 
2.20.1 (Apple Git-117)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-06-11 16:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 16:04 [PATCH v3 0/4] Introduce decimal type to tarantool core Serge Petrenko
2019-06-04 16:04 ` [PATCH v3 1/4] third-party: add decNumber library Serge Petrenko
2019-06-05  8:04   ` Георгий Кириченко
2019-06-04 16:04 ` [PATCH v3 2/4] lib/core: introduce decimal type to tarantool Serge Petrenko
2019-06-05  8:11   ` Георгий Кириченко
2019-06-05 10:03     ` Serge Petrenko
2019-06-05 12:19   ` Vladimir Davydov
2019-06-11 16:14     ` [tarantool-patches] " Serge Petrenko
2019-06-04 16:04 ` [PATCH v3 3/4] lib: update msgpuck library Serge Petrenko
2019-06-04 16:04 ` [PATCH v3 4/4] decimal: add MessagePack encoding/decoding support Serge Petrenko
2019-06-05  8:20   ` Георгий Кириченко
2019-06-05 12:40   ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox