LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2014, 07:40 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 432

Rep: Reputation: Disabled
How to handle NaN in GFortran?


Hi there. I have Ubuntu VM and I run GFortran in it. And in this particular task my calculations give me quite a few NaN and I want to make sure they are thrown by the wayside. So far nothing I tried worked, e.g. if (res.eq.NaN) then ... does not work, etc. How can it be done?

Thanks, - A.
 
Old 11-24-2014, 08:12 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
You can use "if (res .ne. res)" to test if it's a NaN.
 
1 members found this post helpful.
Old 11-25-2014, 01:14 PM   #3
AlexBB
Member
 
Registered: Mar 2014
Posts: 432

Original Poster
Rep: Reputation: Disabled
Exactly! This is what I did eventually. Found it on the web. Suicidaleggroll, stick around for further problems. :-) Thanks. A.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [awk] division by NaN dhodho Programming 10 10-15-2012 07:38 PM
C++ problem with nan casta2k Programming 3 08-06-2009 03:11 PM
C language: +/-Inf and NaN daihard Programming 10 08-06-2009 02:06 PM
C++ - Division by 0 and 'nan' Nightfox Programming 1 05-03-2006 12:58 PM
why would sin(0). return nan? greenmuzz Programming 2 10-23-2003 07:03 AM


All times are GMT -5. The time now is 06:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration