Re: probable bug of "ispower" function in GP

[email protected]
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <20230112124033.Horde.mWKXaZTB8ONFTC1sTO3no5i@webmail.math.cnrs.fr>
Hi Vincent, Bill,


Apologies!

I misunderstood the definition of "ispower"!


I wanted a function that identify directly if some integer is a power of 2


cordially,


luis
***


Vincent Lefevre <[email protected]> a écrit :

> Hi,
>
> On 2023-01-12 12:13:05 +0100, [email protected] wrote:
>> (01:00) gp > ispower(8,2)
>> %1 = 0
>> (01:00) gp > ispower(16,2)
>> %2 = 1
>> (01:00) gp > ispower(9,3)
>> %3 = 0
>> (01:00) gp > ispower(27,3)
>> %4 = 1
>> (01:01) gp > ispower(4,2)
>> %5 = 1
>> (01:01) gp >
>
> These answers look fine. Where is the bug?
>
> --
> Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.