Solved

Generate NaN double value in c code running on windows

Posted on 2009-03-29
1
920 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 500 total points
ID: 24016515
Windows displays a NaN as -1.#IND  here, "IND" for "indeterminate"
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now