LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 06:40 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

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, 07:12 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

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

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



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 06:38 PM
C++ problem with nan casta2k Programming 3 08-06-2009 02:11 PM
C language: +/-Inf and NaN daihard Programming 10 08-06-2009 01:06 PM
C++ - Division by 0 and 'nan' Nightfox Programming 1 05-03-2006 11:58 AM
why would sin(0). return nan? greenmuzz Programming 2 10-23-2003 06:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:18 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
Open Source Consulting | Domain Registration