Skip to main content
5 events
when toggle format what by license comment
Jan 7, 2017 at 9:28 comment added Jasen yeah, log doesn't work, pow probably won't either.
Jan 6, 2017 at 22:33 comment added Steadybox @nmjcman101 Thanks, but pow() produces some incorrect results because of floating point inaccuracy. (When cast to int, 2.9999 will be 2, not 3). Adding a variable r sounds like a good idea, but it actually results in a 2 bytes longer code.
Jan 6, 2017 at 18:54 comment added nmjcman101 I think you save bytes by using pow(3,i) instead of defining your own. Gcc complains about the missing #include <math.h> but compiles it anyway. I did have to cast to int. You also may be able to gain some by adding an r variable, initializing to -1, and then if(n==k-1)r=i;}return r;}
Jan 6, 2017 at 18:24 review Low quality posts
Jan 6, 2017 at 18:25
Jan 6, 2017 at 18:06 history answered Steadybox CC BY-SA 3.0