int - php sqrt function that returns an integer? -
i'm creating simple php program action if (and if) 3 random numbers compute integer. random numbers integers, created rand() function. without going specific details of computation, important thing (in terms of problem) includes taking of square root. not being experienced php coder, square root function know sqrt(). problem is, sqrt() returns float, when input integer , output exact. briefly thought converting output integer (using intval(), won't work because convert all outputs integers, making test useless! ideas on how this? thanks,
if want determine if perfect square, determine if
intval(result) * intval(result) == originalvalue
i don't know php version of functions, perhaps do? :)
Comments
Post a Comment