?
Solved

Generate NaN double value in c code running on windows

Posted on 2009-03-29
1
Medium Priority
?
946 Views
Last Modified: 2012-05-06
I'd like to generate a NaN value for a given double variable in c code running on windows.
I tried to do the following:
double d = sqrt(-1);
This code generates "-1.#IND00" instead of NaN when running on windows.
In Linux the same code generates NaN.


double d = sqrt(-1);
output => d => "-1.#IND00"

Open in new window

0
Comment
Question by:optimaltest
1 Comment
 
LVL 9

Accepted Solution

by:
masheik earned 2000 total points
ID: 24016515
Windows displays a NaN as -1.#IND  here, "IND" for "indeterminate"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question