[Tarantool-patches] [PATCH 2/5] box/sql: func -- fix compilation warning

Cyrill Gorcunov gorcunov at gmail.com
Mon May 18 14:32:09 MSK 2020


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.


More information about the Tarantool-patches mailing list