From: Chris Sosnin <k.sosnin@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 2/2] Add IsWhole method for checking the fractional part of a number Date: Thu, 11 Jun 2020 23:30:55 +0300 [thread overview] Message-ID: <5E6B336C-D827-4334-8633-D0FF654A029D@tarantool.org> (raw) In-Reply-To: <b9973a24-3cfe-6dfb-0373-dd34771c15c3@tarantool.org> Thank you for the review! > On 11 Jun 2020, at 20:06, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote: > > I guess you rather need name IsInt. 'Whole' has a different > meaning. You can say “whole number” — a number without decimal part. But IsInt sounds better, I agree. > > Why do you need it, btw? Why decNumberToInt64() and decNumberToUInt64() > are not enough? The only usecase for this new function I can > imagine is an attempt to shrink a decimal value into a normal integer. > Which are either int64_t or uint64_t. In case of doubles sqlVdbeIntValue returns 0 if an argument has no decimal part (and doesn’t overflow) and not 0 otherwise, but it always modifies a pointer to an integer, because some functions may still use the result of conversion. So I tried to make the behavior the same. decimal_to_* functions always trim the value and don’t perform the check cause of decimal_to_integer call, decNumber ones require context (these also don’t really check for zero-decimal part — instead comparing exponent with 0, making 1.000 a bad argument), so we need new wrappers which will do almost the same thing but with an extra check.
prev parent reply other threads:[~2020-06-11 20:30 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-05 15:41 [Tarantool-patches] [PATCH 0/2] update decNumber for SQL Chris Sosnin 2020-06-05 15:41 ` [Tarantool-patches] [PATCH 1/2] Allow leading and trailing whitespaces in FromString Chris Sosnin 2020-06-06 13:48 ` Serge Petrenko 2020-06-07 12:38 ` Chris Sosnin 2020-06-11 17:06 ` Vladislav Shpilevoy 2020-06-11 20:14 ` Chris Sosnin 2020-06-05 15:41 ` [Tarantool-patches] [PATCH 2/2] Add IsWhole method for checking the fractional part of a number Chris Sosnin 2020-06-06 14:17 ` Serge Petrenko 2020-06-07 12:40 ` Chris Sosnin 2020-06-08 8:59 ` Serge Petrenko 2020-06-11 17:06 ` Vladislav Shpilevoy 2020-06-11 20:30 ` Chris Sosnin [this message]
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=5E6B336C-D827-4334-8633-D0FF654A029D@tarantool.org \ --to=k.sosnin@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/2] Add IsWhole method for checking the fractional part of a number' \ /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