Page 1 of 1

Function pow (x,y)

Posted: Wed Jul 08, 2020 12:27 pm
by Alan_37
Just found a bug in the pow Function

result = pow (x,y)

pow (2,0) = 1 (ok )
pow (2,1) = 2 ( ok )
pow (2,2) = 3 ( ? )
pow (2,3) = 7 ( ? )

if y is greater than 1 the result is wrong by -1

I resolved this by doing if ( y > 1) {result = result +1 } but i think it is still u bug .

Re: Function pow (x,y)

Posted: Wed Jul 08, 2020 12:30 pm
by Benj
Hi Alan,

Thanks for sharing, which chip pack are you finding this on? Is it also a problem in the simulation?

Re: Function pow (x,y)

Posted: Wed Jul 08, 2020 12:36 pm
by Alan_37
Hi Benj ,

chip is Atmega2560, in the simulation work fine.