From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 15 Aug 2019 01:29:06 +0300 From: Konstantin Osipov Subject: Re: [PATCH v2 7/8] decimal: add conversions to (u)int64_t Message-ID: <20190814222906.GI28533@atlas> References: <20190812213914.GJ32337@atlas> <999C425D-CF87-4D4D-B31D-F350C99EE8A6@tarantool.org> <20190814222639.GH28533@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190814222639.GH28533@atlas> To: Serge Petrenko Cc: Vladimir Davydov , tarantool-patches@freelists.org List-ID: * Konstantin Osipov [19/08/15 01:26]: > > > 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. > > > > It wouldn’t slow down hint calculation (timing difference is tiny). > > It will slow down decimal comparison with doubles and integers, though. > > > > We will get faster comparison for decimals that differ in first 2-5 fractional > > digits at the cost of having to cast every double and int to decimal for comparison > > with decimals. > > Is this worth it? > > Please ask yourself this. How often do you think you will compare > a decimal with another decimal, compared to a decimal with a > float? On the other hand, how often do you actually have distinct fractional parts in a decimal... Decimal is mostly used to store money/currency and most of the time fractional part is zero nowadays, no matter what the currency is. So I guess your approach is OK. -- Konstantin Osipov, Moscow, Russia