• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Mac OSX Impossible error message: Could this be a bug

D

Daniel Francis-Lyon

Guest
upload_2019-5-22_20-41-4.png

the square of 2 numbers must be positive. So the square of a number + the square of a number must be positive. So how can I get the message "Cannot apply sqrt to negative number" it should not be possible for that number to be negative. Am I missing something? could this be a bug?
 

chance

predictably random
Forum Staff
Moderator
Remove the sqrt action and run again. You may find an undefined variable in your definition of speedcloser. If that error occurs before the sqr is applied, the entire expression may be returning -1 (or something undefined) -- hence the error message.

Just a guess. But as @Vishnya said, it should be easy to track down the error source.
 
D

Daniel Francis-Lyon

Guest
I found the problem but I don't know why this caused a problem. The following code caused me to get multiple strange error messages on other places. I changed this code and all the strange error messages went away and my game stopped crashing. My code used to say.
physics_apply_force(x, y, N2*3000/speedbullet *chasenem2.phy_linear_velocity_y, N*3000/speedbullet *chasenem2.phy_linear_velocity_x);
But I found out that when I divide by speed bullet or divide by chasenem2.phy_speed or pay_liner_velocity I would get the strange error messages other places in my code. I had even been getting error messages saying that the position of some of my objects was undefined. And I had first checked to make sure they existed. So they existed but had no position. I was getting so many strange error messages that went away after I stopped deciding by phy_speed I'm my code. I don't know why that was a problem but I fixed it and now my game no longer crashes.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I had even been getting error messages saying that the position of some of my objects was undefined
You are most likely dividing by zero somewhere, causing values to be +inf, -inf, or NaN, the later of which would be not considered a non-negative number either.
 
Top