By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

why do i get a "Nan" as an out put when trying to calculate something?

P: 2
I assigned the variable 'grosspay' as a float, when calculating it which is adding up the 'regularpay' plus 'overtimepay' (both of these variables were assinged as floats too)
I get 'Nan'

any help would be greatly appreciated
Sep 14 '10 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916
The calculation you have done has resulted in an error in the floating point processor.

NaN mean Not a Number

The floating processor has put in some trap value (a combination of bits in the variable that does/can not represent an actual value) that the library recognises and it outputs NaN because there is no numerical representation.

Check your maths, then check the way you have implement the maths in the code.
Sep 14 '10 #2

P: 2
Thank you!

i found my mistake.
Sep 15 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.