0

What does means (-nan) in C programming languange? And why this happens?

Im using a loop to calculate the distance between particles, in the first loop, everything is fine, but in the second step, the programming os returning (-nan). https://code.sololearn.com/cwytl4cfpzpg/?ref=app https://code.sololearn.com/cwytl4cfpzpg/?ref=app

18th Mar 2019, 1:33 PM
Isaac Muniz
Isaac Muniz - avatar
5 Réponses
+ 1
Your variables loops and natom haven’t been declared. They need to be set to some value before running.
18th Mar 2019, 3:36 PM
Mike
Mike - avatar
+ 1
The nan means not a number so that must mean your natom variable isn’t a number. You will have to check the code where it is generated.
18th Mar 2019, 6:40 PM
Mike
Mike - avatar
0
But they are
18th Mar 2019, 3:55 PM
Isaac Muniz
Isaac Muniz - avatar
0
I dont writed the all code, but in the top they are
18th Mar 2019, 3:55 PM
Isaac Muniz
Isaac Muniz - avatar
0
In bottom of the code natom is # define natom = 100
18th Mar 2019, 8:04 PM
Isaac Muniz
Isaac Muniz - avatar