Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v2 0/2] Introduce decimal type to tarantool core.
@ 2019-05-21 13:12 Serge Petrenko
  2019-05-21 13:12 ` [tarantool-patches] [PATCH v2 1/2] third-party: add decNumber library Serge Petrenko
  2019-05-21 13:12 ` [tarantool-patches] [PATCH v2 2/2] lib/core: introduce decimal type to tarantool Serge Petrenko
  0 siblings, 2 replies; 9+ messages in thread
From: Serge Petrenko @ 2019-05-21 13:12 UTC (permalink / raw)
  To: tarantool-patches; +Cc: georgy, kostja, Serge Petrenko

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

This patchset adds a new type, decimal fixed-point, to tarantool.

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

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 (2):
  third-party: add decNumber library
  lib/core: introduce decimal type to tarantool

 .gitmodules                 |   3 +
 CMakeLists.txt              |   7 +
 cmake/BuildDecNumber.cmake  |  13 ++
 src/CMakeLists.txt          |   1 +
 src/lib/core/CMakeLists.txt |   3 +-
 src/lib/core/decimal.c      | 293 ++++++++++++++++++++++++++++++++++++
 src/lib/core/decimal.h      | 159 +++++++++++++++++++
 test/unit/CMakeLists.txt    |   2 +
 test/unit/decimal.c         | 168 +++++++++++++++++++++
 test/unit/decimal.result    |  51 +++++++
 third_party/decNumber       |   1 +
 11 files changed, 700 insertions(+), 1 deletion(-)
 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 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] 9+ messages in thread

end of thread, other threads:[~2019-05-23 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 13:12 [tarantool-patches] [PATCH v2 0/2] Introduce decimal type to tarantool core Serge Petrenko
2019-05-21 13:12 ` [tarantool-patches] [PATCH v2 1/2] third-party: add decNumber library Serge Petrenko
2019-05-21 13:12 ` [tarantool-patches] [PATCH v2 2/2] lib/core: introduce decimal type to tarantool Serge Petrenko
2019-05-21 14:17   ` [tarantool-patches] " Konstantin Osipov
2019-05-21 14:52     ` Serge Petrenko
2019-05-21 14:59       ` Konstantin Osipov
2019-05-23  7:15         ` Георгий Кириченко
2019-05-23 11:44           ` Konstantin Osipov
2019-05-23 14:45             ` Serge Petrenko

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