*BSD News Article 63026


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!uunet!in2.uu.net!newsfeed.internetmci.com!tank.news.pipex.net!pipex!sunsite.doc.ic.ac.uk!sunews!news
From: Mark Blackman <markb>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Floating Point Exceptions
Date: 26 Feb 1996 00:35:45 GMT
Organization: University of Reading, U.K.
Lines: 26
Message-ID: <4gqv91$r88@susscsc1.rdg.ac.uk>
NNTP-Posting-Host: swpc30.reading.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.12 (X11; I; FreeBSD 2.1.0-RELEASE i386)
X-URL: news:comp.unix.bsd.freebsd.misc

hello netland,

ummm... what's the recommended way for getting a NaN value into
a variable **without** causing a floating point exception?

I want to use the NaN value as a marker for bad data and i thought
a simple 0.0/0.0 would give me what i wanted, but alas a floating 
point exception was in the works.  Is this a function of gcc,
the kernel, the math coprocessor? and where do i tackle it?

code was
---
float var1, var2, nanvar;

var1 = 0.0;
var2 = 0.0;
nanvar = var1/var2;
----

i'm running 2.1.0 on pentium-60Mhz, pci bus. gcc 2.6.3. '-g' switch only.

any thoughts on the matter will be appreciated.

cheers
mark