🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2108

Re: Test for infinity?

#2108
From: Gerald Feldman
Date: Thu, 29 Feb 1996 00:55
37 lines
2115 bytes
John J. Har wrote:
> 
> Is there any ANSI function or code snippet that would test a double for
> (positive) infinity? For that matter, how about for denormals and NaN's?
> 
> Please send responses (or copies of posts) to me by email, since I don't
> check these newsgroups frequently.
John,
As I mentioned in a previous email, I would send something to you.
NaNs, Infinities, and denormals are not included as part of the C
standard. They are covered by other standards, such as IEEE and XPG4
(Unix). IEEE only requires certain properties, such as NaN, Infinity,
and denormals. XPG4 defines the isnan() function, which reports non-zero
when its argument is a NaN. IEEE 754-1985 does recommend function
class(). Digital Unix implements that as fp_class. This function returns 
  Constant          Class
  _____________________________________________________
  FP_SNAN           Signaling NaN (Not-a-Number)
  FP_QNAN           Quiet NaN (Not-a-Number)
  FP_POS_INF        +infinity
  FP_NEG_INF        -infinity
  FP_POS_NORM       Positive normalized
  FP_NEG_NORM       Negative normalized
  FP_POS_DENORM     Positive denormalized
  FP_NEG_DENORM     Negative denormalized
  FP_POS_ZERO       +0.0 (positive zero)
  FP_NEG_ZERO       -0.0 (negative zero)

There is also an IEEE finite() function. 

Those systems supporting IEEE functionality should have all of these
functions available, though posssibly in some different forms. 
  
-- 
Jerry Feldman              Digital Unix Development Environment
Digital Equipment Corp.    Nashua, NH 03062-9987      
gaf@zk3.dec.com, gaf@bcs.org
Technical Details
Message-ID: <4h2ti2$1jc@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4gfci8$2jd@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: Gerald Feldman <gaf@zk3.dec.com>
Newsgroups: comp.lang.c.moderated,comp.lang.c
Subject: Re: Test for infinity?
Date: 28 Feb 1996 18:55:30 -0600
Organization: Digital Unix Development Environment
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4h2ti2$1jc@solutions.solon.com>
References: <4gfci8$2jd@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Mailer: Mozilla 2.0 (X11; I; OSF1 T4.0 alpha)