From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7E5D16EC118; Thu, 23 Nov 2023 09:37:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7E5D16EC118 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1700721467; bh=zz+QCe+nly7qqrHnphuWrFcRLQgFhOa09gKklsWLgcw=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Yu33lV6THGGf+BzfIBpJ1UOQ0igyameqCsPRI1aKIPqPrRV2zbr+3u+eeJ8+rxR1Z aAPLYGt2K8Mr28IgcFbx+NnurHSQYhc65i4JfYKOLd/A5mEj6rjvhSYfDoIurOXU2G oV/8Tsi3iR2gWBs4KEtLKOPsEd7HFHNgQBbarI7E= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [95.163.41.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B9F996EC105 for ; Thu, 23 Nov 2023 09:35:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B9F996EC105 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1r63JU-00EcYH-0f; Thu, 23 Nov 2023 09:35:48 +0300 Date: Thu, 23 Nov 2023 06:31:24 +0000 To: Sergey Kaplun Message-ID: References: <20231102123616.10527-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231102123616.10527-1-skaplun@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92D71B79D2A671AE6841DCBDEF8A46A2F41DDB7EA50E3A76C182A05F5380850403CDE5E034A7E22321BB5B2B691A11F7971C13677711BD2DE98CF071AD03FCBC2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE731D82F3F177D3BCDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375FE8AD9F0D2764EB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8BCFD15FA9777264C2878C58F619FDED6117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC47272755C61AA17BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CABB3490C75E892806E0066C2D8992A164AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3512896EAB91D0E49BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF27ED053E960B195E1DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C361DD96311B40C2D435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5601AED1DC924664CAC2E91BF296A0241F53627F27C6F9E9FF87CCE6106E1FC07E67D4AC08A07B9B0B355ED1E20F5346ACB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34AB80C45F81B80D63AF0655AF77D7169EB879AA8AC180A4C6BCDAE87A965A3758EBED84426FBA027F1D7E09C32AA3244C13B94F6FBFE6F9033432632DCAFD406E1DD47778AE04E04DBAD658CF5C8AB4025DA084F8E80FEBD376A4ED3E9341DC2FCD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojOz05VK5QHNqsAuPq9RcNxQ== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D5311A0CF5E08F56F5DAB2FEC30FD1496B690AAE1B72BB4108BC2326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] x86/x64: Fix math.ceil(-0.9) result sign. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, I've checked the patchset into all long-term branches in tarantool/luajit and bumped a new version in master, release/2.11 and release/2.10. On 02.11.23, Sergey Kaplun via Tarantool-patches wrote: > From: Mike Pall > > Reported by minoki. > > (cherry-picked from commit 674afcd4e21d0cf64de3219d347557a0aed8ecc7) > > The `ceil` (`floor`) math function implementation calculates (|x| + > 2^52) - 2^52 for its argument to determine the fractional part of x , so > it will be rounded to the nearest integer and its sign is restored. > After that, if the original value is < (>) than the result, the -1 (1) > is subtracted from it. Take a look at the `ceil()` case. The result of > the operation `-1 - (-1)` is +0 for FP arithmetic, against -0 expected > as a result. > > This patch changes the `- (-1)` operation to `+ 1` and restores sign > after it again. > > NB: Since in DUALNUM mode on x86/x64 all results are tried to be > converted to integers the sign of 0 is neglected. > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#9145 > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-859-math-ceil-sign > Tarantool PR: https://github.com/tarantool/tarantool/pull/9326 > Related issues: > * https://github.com/LuaJIT/LuaJIT/issues/859 > * https://github.com/tarantool/tarantool/issues/9145 > > src/vm_x64.dasc | 13 ++++++------ > src/vm_x86.dasc | 13 ++++++------ > .../lj-859-math-ceil-sign.test.lua | 20 +++++++++++++++++++ > 3 files changed, 32 insertions(+), 14 deletions(-) > create mode 100644 test/tarantool-tests/lj-859-math-ceil-sign.test.lua > > -- > 2.42.0 > -- Best regards, IM