infnan man page on 4.4BSD

Man page or keyword search:  
man Server   1065 pages
apropos Keyword Search (all sections)
Output format
4.4BSD logo
[printable version]

INFNAN(3)		 BSD Library Functions Manual		     INFNAN(3)

     infnan — signals invalid floating-point operations on a VAX (temporary)

     #include <math.h>

     infnan(int iarg);

     At some time in the future, some of the useful properties of the Infini‐
     ties and NaNs in the IEEE standard 754 for Binary Floating-Point Arith‐
     metic will be simulated in UNIX on the DEC VAX by using its Reserved Op‐
     erands.  Meanwhile, the Invalid, Overflow and Divide-by-Zero exceptions
     of the IEEE standard are being approximated on a VAX by calls to a proce‐
     dure infnan() in appropriate places in libm(3).  When better excep‐
     tion-handling is implemented in UNIX, only infnan() among the codes in
     libm will have to be changed.  And users of libm can design their own
     infnan() now to insulate themselves from future changes.

     Whenever an elementary function code in libm has to simulate one of the
     aforementioned IEEE exceptions, it calls infnan(iarg) with an appropriate
     value of iarg.  Then a reserved operand fault stops computation.  But
     infnan() could be replaced by a function with the same name that returns
     some plausible value, assigns an apt value to the global variable errno,
     and allows computation to resume.	Alternatively, the Reserved Operand
     Fault Handler could be changed to respond by returning that plausible
     value, etc.  instead of aborting.

     In the table below, the first two columns show various exceptions sig‐
     naled by the IEEE standard, and the default result it prescribes.	The
     third column shows what value is given to iarg by functions in libm when
     they invoke infnan(iarg) under analogous circumstances on a VAX.  Cur‐
     rently infnan() stops computation under all those circumstances.  The
     last two columns offer an alternative; they suggest a setting for errno
     and a value for a revised infnan() to return.  And a C program to imple‐
     ment that suggestion follows.

	   IEEE							Signal	  IEEE
									  Default    iarg	 errno		     infnan()
	   Invalid	  NaN		  EDOM	      EDOM		  0
	   Overflow	  ±∞		  ERANGE      ERANGE		  HUGE
	   Div-by-0	  ±Infinity	  ±ERANGE     ERANGE		    or
									  EDOM	    ±HUGE
			  (HUGE = 1.7e38 ... nearly  2.0**127)

     ALTERNATIVE infnan():

	   #include	   <math.h>
	   #include	   <errno.h>
	   extern int	   errno ;
	   double  infnan(iarg)
	   int	   iarg ;
		   switch(iarg) {
		   case	    ERANGE:	   errno = ERANGE; return(HUGE);
		   case	   -ERANGE:	   errno = EDOM;   return(-HUGE);
		   default:		   errno = EDOM;   return(0);

     math(3), intro(2), signal(3).

     ERANGE and EDOM are defined in ⟨errno.h⟩.	(See intro(2) for explanation
     of EDOM and ERANGE.)

     The infnan() function appeared in 4.3BSD.

4.3 Berkeley Distribution	 June 4, 1993	     4.3 Berkeley Distribution

List of man pages available for 4.4BSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net