luis . gallardo on Thu, 12 Jan 2023 12:41:42 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: probable bug of "ispower" function in GP


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 <vincent@vinc17.net> a écrit :

Hi,

On 2023-01-12 12:13:05 +0100, luis.gallardo@math.cnrs.fr 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 <vincent@vinc17.net> - 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)