In the example, while calculating adjusted R2 I am getting the "float division by zero" error
The error you're getting is because you're dividing a number by 0 which will result in the output to be infinite, which is not possible for a computer to process. Also, the adjusted R squared can have a negative value. But please read this article to fully understand the concept of Adjusted R-squared.