This is a funtion that detects when two circles colide, for that I calculate the distance between the centers of both circles and then compare it with the sum of the radius of both circles. I have no problem with that.
The PROBLEM is that sqrt seems to have a limit range and so if d is bigger than that range when you run the program it ends and says"sqrtOMAIN error,floating point errorOMAIN". So I have to make d smaller, I tried dividing by 1000 but then the formula loses its utility because the other member of the formula hasnt changed.
What can I do to make d smaller whithout altering the formula integrity??
Are there any other solution to my problem?
Code:void colision(void) { double d=(x-x_c)*(x-x_c)+(y-y_c)*(y-y_c); d=sqrt(d); if(d<=RADIO_O+RADIO_J){ borrar_j(); x=X_I; y=Y_I; hecho=1; vidas-=1; } }