Bill Allombert on Sun, 10 Sep 2023 23:07:18 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Power (^) function speed depending on argument types
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Power (^) function speed depending on argument types
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sun, 10 Sep 2023 23:02:15 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1694379727; c=relaxed/relaxed; bh=v8zSIK5CCstfJgVR9Jjjgnk1k0Aei1gdb/Nf2QI+1iU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; b=lEPmR/cicQy9CF1A958wXEuXvjkSAaPtzSWONwz3x+b1OFQAQ4MXf54rGtjsaj8lrDDj7h57/mKni1hPp8rCq1WvOVPwtZnzuVt1OGL4EKlrd761zeJA/CFnUNxpeQeH/UFv1i6MVUs3n7cTjVrQ0dDFvFho0arl2Rds6YJVttjlaqHLAwxQMVTqSRmv8G3iInPF0TM9U6pwiJhtL2m1JM3bETwCp67tglBl2h+zqjt0wrvUO4gmzI9/IgpoKBNmWXEcyKDypv+knxkx3/HdqxCOOPLybMhIMj+rSIA9XNvZLq0eOLf8IT+Q5XTiDhJX6DwcX5nZSwFvRpM7a+LaqIuw+A9QFMVDds2vUXnfUEpQ0CNVssdmBUbACagBJbdTSlaZmevoSVcxQ7IEWmpoY+dfcKzohGwMhec/rFJrYWO0jLc/6r4TN0zOCBRYGxE/GPTkvT3gxDQe+uRgbampcN0AP+o8Ni85Pih1MlmKuOn2nAFw2XHWfLGuhXIRhBPTRt9CH1OWGYyxnlkTuIWtCHtgDZjVW07H4Faxj5g/XHaBIx66tBnqv96+MERDchaJf6kmwin9yBmPDdzRD3pCcls7oGiyNDNnF7WgTgN/TK25SDknYI2OLiDfYdnaxAeIaV2BSDH5t8aWCkGYvkPY8NJW2YmhF7YXuxPbsmLEoUc=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1694379727; cv=none; b=zbsuaMkxl6IEa+PUd15xo59Bd2ZkYOd/J8KsWZYOfJpARvCkJ4NSXi1vJ47eB32Me2MWPaQ1sWpIU7p4KCpYiJaom+k0JR7DQxHRIWHkRijed4xYSGF5FgPBDQbRTlQnZrxEjQYqkJq03F1QfQPj7afZahdh/JrCP+k+9sefbtEboeXPCXcCq8ew1ubYCax1GFOJdyIAq2IbTz0R1WbuHsLkWCugeFsIXsIHg5cFbP4swlYc8tzKySAdb5KyTsgu2EBNM7UwZVwu17YKmoK09G8Feu0PgB3nFuLrNVvhBUTi8KR/DLlv/RT0xjlQD8kInOxMT6X903V3gOSNxZty0aPna+xsKysJO+Ks3qAcUfnmD/b8ni2Ns4eJgCzvUprIeq5or7+ovYe8elg4Pnt1xgueYVht6QS+KBYvPrHUSAs4yQeT19iH2Rbld7G76NrwlYiCIlRxY1zVaaM4ydPe+qhJkV/ec8HNxteOgEewreHNLuP/GptSV67pIjV/7ODEuTx6Xb6xjwO1GozZ+qj+8k+iRyW5UELSy9GKqWM4ryazkKcBqXxj5I+xOWv4TdA4XalRQMoEI5iluWrkhOw4CBO4EZZwxnLtVetaEP5zSmbNx4UA7/+gDsLvu67r3FJooZMJAvm/lxAuvmP9yQ5JOfQBAXuuj2OiRbBgFP9oEzk=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Sun, 10 Sep 2023 23:07:18 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1694379727; bh=v8zSIK5CCstfJgVR9Jjjgnk1k0Aei1gdb/Nf2QI+1iU=; h=Date:From:To:Subject:References:In-Reply-To:From; b=UaMUIj5uCL4jUHBYoEo8p4sUuojpXrxFinGwxAx/2A1UN5qsDV7s/N29B4ljB+Xfg k9lEnF9KMlJVR0CvgdFjEeuAojuZQHhepmKWiX8VseWyMHK75nsN7abnMTBC/DMJMn qk1az+Jz8jid1bPx68/UGwr6fNMAa8P4T33CzhqusYm53B0NMWQLwlexKf+TPqqr2v WgEV+ntNJBPreLdjbeoZzdUCaxKJVAvUfkxVpTDGDP+tlNYlOfpZWBmO8vWjrHW46V 2SPH9GoX4LrAxTOFfc9uGZMLDBgKqXYgDwj+faSc4Wu+2WBrZIrE6RBmcnIcK0HTAR R8a4poGNNpbbcBsNG91zIvwzMgAOqri/Dspatd/olgDD1btcJ+EDJIXNbtPHKZR1rg 8gk5sWaGKkQrjbJE5AWNe1joXkZUs9g1DSqJ0RfKLHOCNUsqHexTZmgvCJJ8zXckeR tnZLYh6o0MdNwkUgpDp2dHoMkrwjp0p4w/IlhDNZKFuL/umSNW3MQZ7x+NcNhJF/7I 2anfdt1vE6/tShDyol7zmYzFxnRhxPXEgtdXUPIZc7mPvnAmUUpzWJ0/Bu2ssvZuS9 kTI+kb6O2IeQJhKMBkwa+OzpbmhToTjz7VGwQyK55C0O1Z+zmLYdQWqrhe8EaVUlqA vggP7OSRVAyZhXhoMR2Sxoyo=
- In-reply-to: <CAEn4z=7cVuuh-mxX9juiexKpty=9_-prUnF9-q2NYO5yxdbY7A@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAEn4z=7cVuuh-mxX9juiexKpty=9_-prUnF9-q2NYO5yxdbY7A@mail.gmail.com>
On Sun, Sep 10, 2023 at 11:40:22PM +0300, Дмитрий Рыбас wrote:
> Hi All,
>
> I observe the following
>
> ? s=0.0;n=2000;for(i=1,n,s=(s+i)^(1/5));
> *cpu time = 4,148 ms,* real time = 4,148 ms.
> ? s=0.0;n=2000;for(i=1,n,s=(s+i+0.0)^(1/5));
> *cpu time = 51 ms,* real time = 51 ms.
> ? s=0.0;n=2000;for(i=1,n,s=(s+i)^(0.2));
> *cpu time = 70 ms,* real time = 73 ms.
> ? s=0.0;n=2000;for(i=1.0,n,s=(s+i)^(1/5));
> *cpu time = 50 ms,* real time = 49 ms.
> ?
>
> Please advise why the difference in computation time is so drastic?
You are not computing s with the same accuracy!
? s=0.0;n=2000;for(i=1,n,s=(s+i)^(1/5));precision(s)
%10 = 38281
? s=0.0;n=2000;for(i=1,n,s=(s+i+0.0)^(1/5));precision(s)
%11 = 57
Cheers,
Bill.