Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: hobbs@steven.zko.dec.com (Steven Hobbs)
Subject: Re: NaN in C/C++ on OSF1
Date: 1995/12/07	[thread overview]
Message-ID: <4a7lji$3j5@nntpd.lkg.dec.com> (raw)
In-Reply-To: 49mnlh$5a3@ratatosk.uio.no


In article <49mnlh$5a3@ratatosk.uio.no>, janchr@holt.nr.no
(Jan Christian Kerlefsen) writes:
>
>Hi!
>I'm porting an application developed on SunOS 4.1.3, to a Dec Alpha with OSF1
>v3.2.
>The application is implemented in C++ and compiled with gcc 2.6.3.
>It is essencial for the application that double and float variables can be NaN
>(not a number).

The Alpha architecture gives the programmer a choice on whether to generate NaNs,
infinities and denormals or to signal an error whan floating point exceptions
occur.  Code that produces signals on exceptions is faster than code that
handles the non-finite IEEE values.  By default Digital Alpha compilers generate
code that signals but you can get portable IEEE floating point behavior by using
the -ieee_with_no_inexact switch with the cc command.  The current Digital cxx
command does not include this switch but the next Digital C++ release (currently
in field test) will.  I do not know the details of IEEE support in the Alpha
version of gcc.  You should check the appropriate man page for this information.

Therefore, if you use cc with -ieee_with_no_inexact then sqrt(-1.0) will return
a quietNaN and arithmetic on quietNaNs will *not* generate a signal (unless you
enable signaling--see the ieee(3) man page).  For historical reasons, sqrt(-1.0)
produces 0.0 when -ieee_with_no_inexact is not enabled.

[I usually use 0.0/0.0 to produce a NaN, rather than sqrt(-1.0)]



  reply	other threads:[~1995-12-07  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-01  5:00 NaN in C/C++ on OSF1 Jan Christian Kerlefsen
1995-12-07  5:00 ` Steven Hobbs [this message]
1995-12-08  5:00   ` Tanmoy Bhattacharya
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox