$sqrt() doesn't perform any rounding, it takes place because you assign the result to integer variable.
To get the intended result, learn about $floor() and $ceil(). You should also get a basic understanding of numeric types and automatic type conversions in SV to solve similar problems yourself.