From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Serge Petrenko Message-Id: <6563D8FC-55AE-4601-88D5-0A00A6AEC21E@tarantool.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_7C85DAEC-1D27-4025-9396-1A04C0199E52" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [tarantool-patches] [PATCH v4 0/2] Introduce decimal type to tarantool core. Date: Tue, 11 Jun 2019 19:02:32 +0300 In-Reply-To: <6B38CFE8-4F4E-46D0-8380-FD551DAA9EA8@tarantool.org> References: <6B38CFE8-4F4E-46D0-8380-FD551DAA9EA8@tarantool.org> To: Vladimir Davydov Cc: Georgy Kirichenko , Konstantin Osipov , tarantool-patches@freelists.org List-ID: --Apple-Mail=_7C85DAEC-1D27-4025-9396-1A04C0199E52 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 11 =D0=B8=D1=8E=D0=BD=D1=8F 2019 =D0=B3., =D0=B2 19:01, Serge Petrenko = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0= =B0): >=20 > My bad, issue and branch are below. > https://github.com/tarantool/tarantool/issues/692 = > = https://github.com/tarantool/tarantool/tree/sp/gh-692-mp-encode-decimal = Branch: = https://github.com/tarantool/tarantool/tree/sp/gh-692-introduce-decimal = Sorry. >=20 > -- > Serge Petrenko > sergepetrenko@tarantool.org >=20 >=20 >=20 >=20 >> 11 =D0=B8=D1=8E=D0=BD=D1=8F 2019 =D0=B3., =D0=B2 18:56, Serge = Petrenko > =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0= =D0=BB(=D0=B0): >>=20 >> This patchset adds a new type, decimal fixed-point, to tarantool, >> together with methods to pack/unpack decimals, arithmetic operations >> ad math functions. >>=20 >> The first patch adds decNumber library as a submodule. >>=20 >> 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 =3D MAX(digits, -exponent) and scale =3D= -exponent >> If exponent > 0 then precision =3D digits + exponent, and scale =3D 0 >>=20 >> Changes in v4: >> - review fixes as per review >> from @locker. >> - remove patches 3 and 4, >> add decimal_pack/unpack as >> a preparation for patches >> 4 and 4 to patch 2. >>=20 >> Changes in v3: >> - add patches 3 and 4 to >> encode/decode decimals >> as msgpack. >>=20 >> 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. >>=20 >> Serge Petrenko (2): >> third-party: add decNumber library >> lib/core: introduce decimal type to tarantool >>=20 >> .gitmodules | 3 + >> CMakeLists.txt | 7 + >> cmake/BuildDecNumber.cmake | 14 ++ >> src/CMakeLists.txt | 1 + >> src/lib/core/CMakeLists.txt | 3 +- >> src/lib/core/decimal.c | 354 +++++++++++++++++++++++++++++++ >> src/lib/core/decimal.h | 206 ++++++++++++++++++ >> test/unit/CMakeLists.txt | 2 + >> test/unit/decimal.c | 174 ++++++++++++++++ >> test/unit/decimal.result | 406 = ++++++++++++++++++++++++++++++++++++ >> third_party/decNumber | 1 + >> 11 files changed, 1170 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 >>=20 >> --=20 >> 2.20.1 (Apple Git-117) >>=20 >>=20 >=20 --Apple-Mail=_7C85DAEC-1D27-4025-9396-1A04C0199E52 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
11 = =D0=B8=D1=8E=D0=BD=D1=8F 2019 =D0=B3., =D0=B2 19:01, Serge Petrenko = <sergepetrenko@tarantool.org> = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):


Branch: https://github.com/tarantool/tarantool/tree/sp/gh-692-introduce= -decimal
Sorry.





11 =D0=B8=D1=8E=D0=BD=D1=8F 2019 =D0=B3., =D0=B2= 18:56, Serge Petrenko <sergepetrenko@tarantool.org> = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):

This = patchset adds a new type, decimal fixed-point, to tarantool,
together with methods to pack/unpack decimals, arithmetic = operations
ad math functions.

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 =3D MAX(digits, -exponent) and scale =3D -exponent
If exponent > 0 then precision =3D digits + exponent, and = scale =3D 0

Changes in v4:
- = review fixes as per review
  from @locker.
- remove patches 3 and 4,
  add = decimal_pack/unpack as
  a preparation for = patches
  4 and 4 to patch 2.

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

.gitmodules =             &n= bsp;   |   3 +
CMakeLists.txt =             &n= bsp;|   7 +
cmake/BuildDecNumber.cmake  | =  14 ++
src/CMakeLists.txt =          |   1 = +
src/lib/core/CMakeLists.txt |   3 +-
src/lib/core/decimal.c      | 354 = +++++++++++++++++++++++++++++++
src/lib/core/decimal.h =      | 206 ++++++++++++++++++
= test/unit/CMakeLists.txt    |   2 +
test/unit/decimal.c =         | 174 = ++++++++++++++++
test/unit/decimal.result =    | 406 ++++++++++++++++++++++++++++++++++++
third_party/decNumber       | =   1 +
11 files changed, 1170 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)




= --Apple-Mail=_7C85DAEC-1D27-4025-9396-1A04C0199E52--