cplxerr man page on OpenIndiana

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

CPLXERR(3CC4)							 CPLXERR(3CC4)

NAME
       cplxerr	complex	 error	-  error-handling functions in the C++ complex
       number math library

SYNOPSIS
       #include <complex.h>
       class complex { ... };
       static const complex complex_zero(0.0, 0.0);
       const int SING	   = ...;
       const int OVERFLOW  = ...;
       const int UNDERFLOW = ...;
       class c_exception
       {
       public:
	    c_exception(char *n, const complex& a1, const complex& a2=complex_zero);
	    c_exception(unsigned char *n, const complex& a1, const complex& a2=complex_zero);
	    friend int complex_error(c_exception&); // user may override
       private:
	    int type;
	    char *name;
	    complex arg1, arg2;
	    complex retval;
       };

DESCRIPTION
       Functions exp(), log(), log10(), sinh(),	 and  cosh()  invoke  function
       complex_error()	under  the  conditions	described in cplxexp(3CC4) and
       cplxtrig(3CC4).	If complex_error() returns zero, the return values and
       setting	of errno will take place as described.	In addition, a message
       describing the kind of error, the function which detected it,  and  the
       value  causing the error will be written to cerr (see iostream documen‐
       tation).	 If complex_error returns non-zero, errno is not  set  and  no
       message is written.

       The default version of complex_error() just returns zero.  The program‐
       mer may supply a replacement version of the function to take any action
       deemed  appropriate.  The function takes one parameter of type ``refer‐
       ence to c_exception'', of which the function is a friend.

   class c_exception
       The class consists of the following fields:

       int type
	      An integer describing the type of value, which has  one  of  the
	      values below, declared in the header as constants:
	      SING	argument singularity, such as divide by zero
	      OVERFLOW	overflow range error
	      UNDERFLOW underflow range error

       char* name
	      Points  to  a  null-terminated string containing the name of the
	      function where the error was detected.

       complex arg1, arg2
	      The arguments with which the function detecting  the  error  was
	      invoked.	 (Those functions which invoke complex_err() have only
	      one argument, so arg2 will be irrelevant.)

       complex retval
	      The default return value	for  the  invoking  function  if  com‐
	      plex_err() does not set some other value.

       A  replacement  version	of complex_err() should return zero if setting
       errno and writing to cerr are desired, or  return  non-zero  otherwise.
       The  replacement	 could also change the retval field of its c_exception
       parameter if the default return value is not desired.

EXAMPLE
       Suppose we want errno to be set, but we do not want to  write  anything
       to  cerr (or anywhere else).  Our replacement complex_err() will return
       non-zero, which will prevent a message from  being  written,  but  will
       also prevent errno from being set.  Our function will have to set errno
       itself.
	    #include <complex.h>
	    int c_exception(c_exception& x)
	    {
		 switch( x.type ) {
		 case UNDERFLOW:
		 case OVERFLOW:
		      errno = ERANGE;
		      break;
		 case SING:
		      errno = EDOM;
		      break;
		 }
		 return 1;
	    }

SEE ALSO
       cplx.intro(3CC4), cartpol(3CC4), cplxexp(3CC4), cplxops(3CC4), cplx‐
       trig(3CC4), intro(2), ios.intro(3CC4), C++ Library Reference, Chapter
       2, "The Complex Arithmetic Library."

				07 August 1997			 CPLXERR(3CC4)
[top]

List of man pages available for OpenIndiana

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]
Tweet
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