From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DE2CC46970E for ; Fri, 20 Dec 2019 17:37:31 +0300 (MSK) Date: Fri, 20 Dec 2019 17:35:20 +0300 From: Igor Munkin Message-ID: <20191220143520.GB31304@tarantool.org> References: <20191219134338.GA22834@tarantool.org> <20191219141614.GB26708@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191219141614.GB26708@atlas> Subject: Re: [Tarantool-discussions] Addition of NUMBER field type List-Id: Tarantool development process List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konstantin Osipov Cc: tarantool-discussions@dev.tarantool.org On 19.12.19, Konstantin Osipov wrote: > * Mergen Imeev [19/12/19 16:44]: > > Hi all, > > I would like to discuss once again the problem of adding a DOUBLE > > field type. > > > > Suppose we have added a DOUBLE field type to which we can insert > > data of type MP_DOUBLE in the format MsgPack. The problem is that > > inserting an integer from Lua, we get an error. This is not so bad > > for integer cdata, but it is bad for integers od Lua type NUMBER. > > Currently, we have 5 ways to solve the problem: > > > > > > 4) Give to user a function to convert a number to DOUBLE in Lua > > before inserting into space. > > > > In this case, the user must convert the number to DOUBLE before > > inserting. We do not add any implicit cast. Very easy to > > understand and implement. Although the user may be a little > > confused that he cannot insert INTEGER/UNSIGNED into a DOUBLE > > field, but this can be solved by writing about this in the > > documentation. > > > > In addition, if we convert to LuaJIT DOUBLE cdata, then we can use > > these cdata as the operand of an arithmetic operation. However, > > arithmetic operations for this type do not work correctly. And it > > will not be fixed, most likely. It should also be written in the > > documentation, I think. > > > > I like it #4 too - it's cheap & efficient. Despite the broken arithmetics and assuming no one need this type in Lua -- yes, this is a good one. > > -- > Konstantin Osipov, Moscow, Russia -- Best regards, IM