Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH v3 0/5] decimal: expose decimal module to Lua.
@ 2019-07-02 17:27 Serge Petrenko
  2019-07-02 17:27 ` [PATCH v3 1/5] decimal: fix ln hang on values between ~ 0.9 and 1.1 Serge Petrenko
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Serge Petrenko @ 2019-07-02 17:27 UTC (permalink / raw)
  To: vdavydov.dev; +Cc: tarantool-patches, Serge Petrenko

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

This patchset adds decimal module to lua.

The first three patches address some bugs found in decimal during the review
process.

The first patch fixes ln operation being stuck in an infinite loop for some
input values.

The second patch makes sure infinities and NaNs cannot be constructed neither
result in any operation.

The third patch changes the snprint format specifier used in double to decimal
conversion to the one trimming trailing zeros.

Since FFI CDATA is chosen to store decimals on lua stack, a new helper to
register FFI metatypes is added in the fourth patch.

The fifth patch does the job itself of exposing the decimal module to lua and
adds a minor test. The patch also contains a documentation request in the commit
message.

Changes in v3:
  - add 3 patches fixing bugs found during review.
  - increase test coverage.

Changes in v2:
 - various review fixes requested by @vdavydov
   - clarify commit message and docbot request.
   - remove decimal.add and similar. Only leave
     the '+', ... operators for binary operations.
   - add more tests.
   - minor code cleanup.

Serge Petrenko (5):
  decimal: fix ln hang on values between ~ 0.9 and 1.1
  decimal: diallow infinity and NaN entirely.
  decimal: fix string formatting on construction from double
  lua/utils: add a function to register FFI metatypes.
  decimal: expose decimal type to lua.

 src/CMakeLists.txt        |   1 +
 src/lib/core/decimal.c    | 102 ++++-----
 src/lua/decimal.c         | 351 +++++++++++++++++++++++++++++
 src/lua/decimal.h         |  47 ++++
 src/lua/init.c            |   2 +
 src/lua/utils.c           |  28 +++
 src/lua/utils.h           |  13 ++
 test/app/decimal.result   | 452 ++++++++++++++++++++++++++++++++++++++
 test/app/decimal.test.lua | 128 +++++++++++
 test/unit/decimal.c       |  24 +-
 test/unit/decimal.result  |  71 +++---
 11 files changed, 1137 insertions(+), 82 deletions(-)
 create mode 100644 src/lua/decimal.c
 create mode 100644 src/lua/decimal.h
 create mode 100644 test/app/decimal.result
 create mode 100644 test/app/decimal.test.lua

-- 
2.20.1 (Apple Git-117)

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

end of thread, other threads:[~2019-07-08 14:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 17:27 [PATCH v3 0/5] decimal: expose decimal module to Lua Serge Petrenko
2019-07-02 17:27 ` [PATCH v3 1/5] decimal: fix ln hang on values between ~ 0.9 and 1.1 Serge Petrenko
2019-07-02 17:27 ` [PATCH v3 2/5] decimal: diallow infinity and NaN entirely Serge Petrenko
2019-07-02 17:27 ` [PATCH v3 3/5] decimal: fix string formatting on construction from double Serge Petrenko
2019-07-02 17:27 ` [PATCH v3 4/5] lua/utils: add a function to register FFI metatypes Serge Petrenko
2019-07-02 17:27 ` [PATCH v3 5/5] decimal: expose decimal type to lua Serge Petrenko
2019-07-03  6:50   ` [tarantool-patches] " Serge Petrenko
2019-07-08 14:25 ` [PATCH v3 0/5] decimal: expose decimal module to Lua Vladimir Davydov

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