From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3A092469710 for ; Mon, 18 May 2020 14:32:12 +0300 (MSK) Received: by mail-lf1-f65.google.com with SMTP id v5so7687814lfp.13 for ; Mon, 18 May 2020 04:32:12 -0700 (PDT) Date: Mon, 18 May 2020 14:32:09 +0300 From: Cyrill Gorcunov Message-ID: <20200518113209.GA2194@grain> References: <20200518101502.117121-1-gorcunov@gmail.com> <20200518101502.117121-3-gorcunov@gmail.com> <20200518111306.GA12861@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200518111306.GA12861@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 2/5] box/sql: func -- fix compilation warning List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mergen Imeev Cc: tml , Alexander Turenko On Mon, May 18, 2020 at 02:13:07PM +0300, Mergen Imeev wrote: > > @@ -845,9 +845,9 @@ roundFunc(sql_context * context, int argc, sql_value ** argv) > > * handle the rounding directly, > > * otherwise use printf. > > */ > > - if (n == 0 && r >= 0 && r < LARGEST_INT64 - 1) { > > + if (n == 0 && r >= 0 && r < (double)(LARGEST_INT64 - 1)) { > > r = (double)((sql_int64) (r + 0.5)); > I am not sure that this change worth to do since > LARGEST_INT64 = 2^63 -1 and > (double)(LARGEST_INT64 - 1) == 2^63, if I am not wrong. > I also not sure that this worked right before. > I think it makes sense to compare with someting like 2^53, > because if absolute value of r is greater that 2^53 than > we do not have to round it anymore. Mergen, I've no clue which limits we have in sql, thus it is up to you. Either fix it on top either provide a patch instead please.