Logic to check 10bit binary number is perfect square or not

In reply to mamathamanu:

can any explain a logic to check whether the 10 bit binary input is perfect square or not.

I can think of something like this :


    int a,b; // b is the input
    a=$sqrt(b);
    if($pow(a,2)==b)
      $display(" b is perfect square, a=%d,b=%d",a,b);

but $sqrt only takes integer or real type as input.