user3243314
user3243314

Reputation: 1

I keep getting a NaN when calculating numbers

Whenever I put the following into a program it always comes back with NaN. Does anybody know why? Is there a way I can fix this?

double test = -1.17425 * (pow(10, 3)) / (5.75 * (pow(10, 6)));
System.out.print(test);

Upvotes: 0

Views: 93

Answers (1)

George
George

Reputation: 416

Works just fine on my computer. I get: -2.0421739130434784E-4

Which math library are you using? Try this: double test = -1.17425*(Math.pow(10,3))/(5.75*(Math.pow(10,6)));

Upvotes: 1

Related Questions