From: Konstantin Osipov <kostja@tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>
Cc: vdavydov.dev@gmail.com, tarantool-patches@freelists.org
Subject: Re: [PATCH v2 7/8] decimal: add conversions to (u)int64_t
Date: Tue, 13 Aug 2019 00:39:14 +0300 [thread overview]
Message-ID: <20190812213914.GJ32337@atlas> (raw)
In-Reply-To: <cc5664f36b3d27c2a990d589686dac1b465c7b7e.1565263272.git.sergepetrenko@tarantool.org>
* Serge Petrenko <sergepetrenko@tarantool.org> [19/08/08 15:01]:
> Update decNumber library, add methods to convert decimals to uint64_t
> and int64_t, add unit tests.
> Also replace decimal_round() function with decimal_round_with_mode() to
> allow setting rounding mode.
> We need to round with mode DEC_ROUND_DOWN in to_int64 conversions in
> order to be consistent with double to int conversions.
> It will be needed to compute hints for decimal fields.
>
> Prerequisite #4333
> ---
> src/lib/core/decimal.c | 57 +++++++++++++++++++++++++++++--
> src/lib/core/decimal.h | 19 +++++++++++
> test/unit/decimal.c | 66 ++++++++++++++++++++++++++++++++++-
> test/unit/decimal.result | 74 ++++++++++++++++++++++++++++++++++++++--
> third_party/decNumber | 2 +-
> 5 files changed, 210 insertions(+), 8 deletions(-)
>
> diff --git a/src/lib/core/decimal.c b/src/lib/core/decimal.c
> index 840aa5dfe..19b5096ed 100644
> --- a/src/lib/core/decimal.c
> +++ b/src/lib/core/decimal.c
> @@ -157,6 +157,45 @@ decimal_to_string(const decimal_t *dec)
> return buf;
> }
>
> +static decimal_t *
> +decimal_to_integer(decimal_t *dec)
Why do you think it's the best hint option? Why not keep 2-5 decimal
digits in a hint, as most currencies use? Would it slow down the
hing making process? You call decimalRescale anyway, it seems.
Is decimalRescale optimized to be a no-op if there is no need to
rescale?
--
Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-08-12 21:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 11:55 [PATCH v2 0/8] Decimal indices Serge Petrenko
2019-08-08 11:55 ` [PATCH v2 1/8] lua: fix decimal comparison with nil Serge Petrenko
2019-08-12 21:16 ` Konstantin Osipov
2019-08-14 11:00 ` Vladimir Davydov
2019-08-14 22:17 ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 2/8] decimal: fix encoding numbers with positive exponent Serge Petrenko
2019-08-12 21:18 ` Konstantin Osipov
2019-08-13 9:00 ` [tarantool-patches] " Serge Petrenko
2019-08-14 22:21 ` Konstantin Osipov
2019-08-14 11:56 ` Vladimir Davydov
2019-08-08 11:55 ` [PATCH v2 3/8] lua/pickle: fix a typo Serge Petrenko
2019-08-12 21:18 ` Konstantin Osipov
2019-08-14 11:12 ` Vladimir Davydov
2019-08-14 11:15 ` Serge Petrenko
2019-08-08 11:55 ` [PATCH v2 4/8] lua: rework luaL_field types to support msgpack extensions Serge Petrenko
2019-08-12 21:23 ` Konstantin Osipov
2019-08-13 13:15 ` [tarantool-patches] " Serge Petrenko
2019-08-14 22:23 ` Konstantin Osipov
2019-08-15 8:27 ` Serge Petrenko
2019-08-16 8:06 ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 5/8] box: rework field_def and tuple_compare to work with mp_field_type instead of mp_type Serge Petrenko
2019-08-12 21:28 ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 6/8] decimal: allow to encode/decode decimals as MsgPack Serge Petrenko
2019-08-12 21:29 ` Konstantin Osipov
2019-08-12 21:34 ` Konstantin Osipov
2019-08-13 14:01 ` Serge Petrenko
2019-08-14 22:25 ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 7/8] decimal: add conversions to (u)int64_t Serge Petrenko
2019-08-12 21:39 ` Konstantin Osipov [this message]
2019-08-13 14:18 ` Serge Petrenko
2019-08-14 22:26 ` Konstantin Osipov
2019-08-14 22:29 ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 8/8] decimal: allow to index decimals Serge Petrenko
2019-08-08 13:42 ` Serge Petrenko
2019-08-12 21:41 ` Konstantin Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190812213914.GJ32337@atlas \
--to=kostja@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH v2 7/8] decimal: add conversions to (u)int64_t' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox