lib/core: introduce decimal type to tarantool
Add fixed-point decimal type to tarantool core. Adapt decNumber floating-point decimal library for the purpose, write a small wrapper and add unit tests. A new decimal type is an alias for decNumber numbers from the decNumber library. Arithmetic operations (+, -, *, /) and some mathematic functions (ln, log10, exp, pow, sqrt) are available together with methods to pack and unpack decimal to and from its packed representation (useful for serialization). We introduce a single context for all the arithmetic operations on decimals, which enforces both number precision and scale to be in range [0, 38]. NaNs and Infinities are restricted. Part of #692
Showing
- .gitmodules 3 additions, 0 deletions.gitmodules
- CMakeLists.txt 7 additions, 0 deletionsCMakeLists.txt
- cmake/BuildDecNumber.cmake 14 additions, 0 deletionscmake/BuildDecNumber.cmake
- src/CMakeLists.txt 1 addition, 0 deletionssrc/CMakeLists.txt
- src/lib/core/CMakeLists.txt 2 additions, 1 deletionsrc/lib/core/CMakeLists.txt
- src/lib/core/decimal.c 345 additions, 0 deletionssrc/lib/core/decimal.c
- src/lib/core/decimal.h 198 additions, 0 deletionssrc/lib/core/decimal.h
- test/unit/CMakeLists.txt 2 additions, 0 deletionstest/unit/CMakeLists.txt
- test/unit/decimal.c 174 additions, 0 deletionstest/unit/decimal.c
- test/unit/decimal.result 406 additions, 0 deletionstest/unit/decimal.result
- third_party/decNumber 1 addition, 0 deletionsthird_party/decNumber
Loading
Please register or sign in to comment