From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 5003C2F52C for ; Wed, 29 May 2019 05:14:05 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JTz5zv1AJTFJ for ; Wed, 29 May 2019 05:14:05 -0400 (EDT) Received: from smtp57.i.mail.ru (smtp57.i.mail.ru [217.69.128.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 0DFDC2F52B for ; Wed, 29 May 2019 05:14:05 -0400 (EDT) Date: Wed, 29 May 2019 12:14:00 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 3/3] sql: fix passing FP values to integer iterator Message-ID: <20190529091400.GA29529@atlas> References: <789091b7acd99c908d26689f27c55f8b6dba3d16.1558700151.git.korablev@tarantool.org> <20190525055140.GA14501@atlas> <1fea92f3-20cc-d539-4010-0ef00b1b6c9a@tarantool.org> <20190528071951.GA31215@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: "n.pettik" Cc: tarantool-patches@freelists.org, Vladislav Shpilevoy * n.pettik [19/05/28 16:01]: > Ok, consider searching condition ‘a == FP’, where a is > integer field and FP is floating point value. Since both > sides of comparison operator have different numeric > types, one of them is promoted to another according to > precedence list (I use DB2 terminology: > https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_promotionofdatatypes.html > I suppose it is not significantly different from ANSI but > way much easier to understand). In our case, integer is > promoted to float type. Hence, searching condition > is transformed to this one: ‘implicit_cast(a to float) == FP’. > In our particular case: ‘1.0 == 1.1’ and ‘1.0 == 1.0’. > First one is obviously false, second one it true. Oh, I missed that implicit casts between integer and float are allowed and promotion rules apply. I thought it's strings and numbers only, not the different numbers between each other. It is my mistake. -- Konstantin Osipov, Moscow, Russia