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 A77A66F3C7; Fri, 26 Mar 2021 18:17:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A77A66F3C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616771873; bh=75Dk71I7zlB47ge7ZHjYcp3iRECDbwdzvpHCHfCQ4us=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=x9PL5lYpMT6Nfid+VgttYXAZsOKA8dX/BGJ4sEsMO0tcKe7OIGZF3VSuuQjsyEYjM RywUi8+P/suJbx4aWBIRQCx5bBWJ0mNA4LtKSR1StEBL7vrFefEwfWpdHSW65rEBNi HTaCGv4lQMPdAKIZvdPaFWC7S5QS+4baXh0lc5Gw= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 C2D716F3C7 for ; Fri, 26 Mar 2021 18:17:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C2D716F3C7 Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1lPoDL-0006jn-W5; Fri, 26 Mar 2021 18:17:32 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) In-Reply-To: <2ffe160c0e47930914ff03996df38af1d9625767.1616743343.git.skaplun@tarantool.org> Date: Fri, 26 Mar 2021 18:16:12 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <21B11A90-937E-459F-951E-7CCD1A5E83ED@tarantool.org> References: <2ffe160c0e47930914ff03996df38af1d9625767.1616743343.git.skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3654.60.0.2.21) X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32941B7C4A78AC10F96A7797F60C25BD4B06182A05F538085040451A2C825E076D6FE8BB58B78E57380EC277F585B2376DFF30C8D4E148E9A863 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76042E2DB3E33BF2BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DA223B75F41C64628638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C5DD32608FC869F5DD3215E8EE77C804CE8C8F77ADAE610DDA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE70F3DDF2BBF19B93A9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3E478A468B35FE767117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF726DA0ACA370FA4DBA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6E67FAAB7D187F8DF76E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249B372FE9A2E580EFC725E5C173C3A84C30584FF81F342DA0735872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D2B0415775C18AE2A355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A5F191541EAAF6D617AAAF7D825014E92B6E512651491D8838D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A783A638E01A3CDEB27E67731A0BEC893BB2773AB6AE5B22CA8E71D714EB9276A03A9340C8F0F6031D7E09C32AA3244C93BB503FE1CE899C34D9F105564BBD7205AB220A9D022EBCFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAhFamrRFKAg9g== X-Mailru-Sender: 455D65AE3A139168626D8C76E86D3AC051DE0727AF2BD18CF9FA3987D6D16DC8DDAC019A3742A8B676D79013C85012CDC77752E0C033A69E4BBE7EBD99111A499D0AB74157175C036C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 18/30] test: replace math.mod to math.fmod for Lua tests 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: Sergey Ostanevich via Tarantool-patches Reply-To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hmmm. Is it better to mokeypatch it as =E2=80=98math.mod =3D math.fmod = or math.mod=E2=80=99? Sergos. > On 26 Mar 2021, at 10:43, Sergey Kaplun wrote: >=20 > In Lua 5.1 math.mod() is renamed to math.fmod() if build Lua 5.1 = without > flag `-DLUA_COMPAT_MOD`. > LuaJIT has math.fmod() instead old-style math.mod() built-in. >=20 > This patch replaces usage of math.mod with new-style math.fmod > in the following files: > * closure.lua > * constructs.lua > * math.lua > * nextvar.lua >=20 > Closes tarantool/tarantool#5711 > Part of tarantool/tarantool#5845 > Part of tarantool/tarantool#4473 > --- > test/PUC-Lua-5.1-tests/closure.lua | 3 ++- > test/PUC-Lua-5.1-tests/constructs.lua | 6 ++++-- > test/PUC-Lua-5.1-tests/math.lua | 3 ++- > test/PUC-Lua-5.1-tests/nextvar.lua | 3 ++- > 4 files changed, 10 insertions(+), 5 deletions(-) >=20 > diff --git a/test/PUC-Lua-5.1-tests/closure.lua = b/test/PUC-Lua-5.1-tests/closure.lua > index 27ca0ad..7f56ab8 100644 > --- a/test/PUC-Lua-5.1-tests/closure.lua > +++ b/test/PUC-Lua-5.1-tests/closure.lua > @@ -254,7 +254,8 @@ function filter (p, g) > while 1 do > local n =3D g() > if n =3D=3D nil then return end > - if math.mod(n, p) ~=3D 0 then coroutine.yield(n) end > + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. > + if math.fmod(n, p) ~=3D 0 then coroutine.yield(n) end > end > end) > end > diff --git a/test/PUC-Lua-5.1-tests/constructs.lua = b/test/PUC-Lua-5.1-tests/constructs.lua > index 5fb3798..18d1789 100644 > --- a/test/PUC-Lua-5.1-tests/constructs.lua > +++ b/test/PUC-Lua-5.1-tests/constructs.lua > @@ -202,7 +202,8 @@ function ID(x) return x end >=20 > function f(t, i) > local b =3D t.n > - local res =3D math.mod(math.floor(i/c), b)+1 > + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. > + local res =3D math.fmod(math.floor(i/c), b)+1 > c =3D c*b > return t[res] > end > @@ -233,7 +234,8 @@ repeat > ]], s1, s, s1, s, s1, s, s1, s, s) > assert(loadstring(s))() > assert(X and not NX and not WX1 =3D=3D K and not WX2 =3D=3D K) > - if math.mod(i,4000) =3D=3D 0 then print('+') end > + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. > + if math.fmod(i,4000) =3D=3D 0 then print('+') end > i =3D i+1 > until i=3D=3Dc >=20 > diff --git a/test/PUC-Lua-5.1-tests/math.lua = b/test/PUC-Lua-5.1-tests/math.lua > index 5076f38..8f0526f 100644 > --- a/test/PUC-Lua-5.1-tests/math.lua > +++ b/test/PUC-Lua-5.1-tests/math.lua > @@ -100,7 +100,8 @@ assert(math.abs(-10) =3D=3D 10) > assert(eq(math.atan2(1,0), math.pi/2)) > assert(math.ceil(4.5) =3D=3D 5.0) > assert(math.floor(4.5) =3D=3D 4.0) > -assert(math.mod(10,3) =3D=3D 1) > +-- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. > +assert(math.fmod(10,3) =3D=3D 1) > assert(eq(math.sqrt(10)^2, 10)) > assert(eq(math.log10(2), math.log(2)/math.log(10))) > assert(eq(math.exp(0), 1)) > diff --git a/test/PUC-Lua-5.1-tests/nextvar.lua = b/test/PUC-Lua-5.1-tests/nextvar.lua > index 7ceaa75..81159dc 100644 > --- a/test/PUC-Lua-5.1-tests/nextvar.lua > +++ b/test/PUC-Lua-5.1-tests/nextvar.lua > @@ -201,7 +201,8 @@ print('+') >=20 > a =3D {} > for i=3D0,10000 do > - if math.mod(i,10) ~=3D 0 then > + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. > + if math.fmod(i,10) ~=3D 0 then > a['x'..i] =3D i > end > end > --=20 > 2.31.0 >=20