473,411 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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

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
2 2047
Banfa
9,065 Expert Mod 8TB
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
gibran
2
Thank you!

i found my mistake.
Sep 15 '10 #3

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

Similar topics

10
by: Boštjan Jerko | last post by:
Hello ! I need to know if the result of math formula is nan (Not a number). How can I do that? Thanks, B.
6
by: asmirnov1234567890 | last post by:
Hi my python 2.3.4 for windows refuse to execute line float("NaN"). It says: >>> float("NaN") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for...
4
by: Rich | last post by:
I am close than I was before and I thank y'all for your Great Help!! I wrote the following script with help. So far it does what I want, it will prompt user for Input, then Display the User's...
3
by: nan | last post by:
Hi All, I am trying to connect the Database which is installed in AS400 using DB2 Client Version 8 in Windows box. First i created the Catalog, then when i selected the connection type...
5
by: Fabian Vilers | last post by:
Hi again... I'm wondering what could be better in terms of performance between: var my_array = new Array(); // populate array for (index in my_array) { // do something with my_array
1
by: Peter Knörrich | last post by:
Hello, I've found another inconsistency, and looking through the list archives I can find mentions of funky stuff like print float('inf') giving Infanity
5
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
15
by: daniel | last post by:
I'm so confused by the keyword "is" and "==" equal sign, it seems they could be exchanged in some contexts, but not in others, what's the difference between them in terms of comparation? ...
7
by: andrewfsears | last post by:
I have a question: I was wondering if it is possible to simulate the multiple constructors, like in Java (yes, I know that the languages are completely different)? Let's say that I have a class...
11
by: maminx | last post by:
hello all, i have an error value / "NaN" value that's i;m not expecting of.. this is i how i check the for the value that's become "NaN" new...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.