Print this page
remove support for non-ANSI compilation


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*      Copyright (c) 1988 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*


  27  * Copyright (c) 1996, by Sun Microsystems, Inc.
  28  * All Rights Reserved
  29  */
  30 
  31 #ifndef _NAN_H
  32 #define _NAN_H
  33 
  34 #pragma ident   "%Z%%M% %I%     %E% SMI"
  35 
  36 /*
  37  * Handling of Not_a_Number's (only in IEEE floating-point standard)
  38  */
  39 
  40 #include <sys/isa_defs.h>
  41 #include <values.h>
  42 
  43 #ifdef  __cplusplus
  44 extern "C" {
  45 #endif
  46 
  47 #if defined(_IEEE_754)
  48 /*
  49  * Structure order is endian dependent.  Only the common variants of
  50  * big and little endian are supported.
  51  */
  52 
  53 #if defined(_BIG_ENDIAN)
  54 
  55 typedef union


 103 
 104 /*
 105  * IsINF must be used after IsNANorINF has checked the exponent
 106  */
 107 #define IsINF(X)        (((dnan *)&(X))->inf_parts.bits == 0 && \
 108                             ((dnan *)&(X))->inf_parts.fraction_low == 0)
 109 
 110 /*
 111  * IsPosNAN and IsNegNAN can be used to check the sign of infinities too
 112  */
 113 #define IsPosNAN(X)     (((dnan *)&(X))->nan_parts.sign == 0)
 114 
 115 #define IsNegNAN(X)     (((dnan *)&(X))->nan_parts.sign == 1)
 116 
 117 /*
 118  * GETNaNPC gets the leftmost 32 bits of the fraction part
 119  */
 120 #define GETNaNPC(dval)  (((dnan *)&(dval))->inf_parts.bits << 12 | \
 121                             ((dnan *)&(dval))->nan_parts.fraction_low >> 20)
 122 
 123 #if defined(__STDC__)
 124 #define KILLFPE()       (void) _kill(_getpid(), 8)
 125 #else
 126 #define KILLFPE()       (void) kill(getpid(), 8)
 127 #endif
 128 #define NaN(X)          (((dnan *)&(X))->nan_parts.exponent == 0x7ff)
 129 #define KILLNaN(X)      if (NaN(X)) KILLFPE()
 130 
 131 #else   /* defined(_IEEE_754) */
 132 /* #error is strictly ansi-C, but works as well as anything for K&R systems. */
 133 #error ISA not supported
 134 #endif  /* defined(_IEEE_754) */
 135 
 136 #ifdef  __cplusplus
 137 }
 138 #endif
 139 
 140 #endif  /* _NAN_H */


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*      Copyright (c) 1988 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*
  27  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  28  *
  29  * Copyright (c) 1996, by Sun Microsystems, Inc.
  30  * All Rights Reserved
  31  */
  32 
  33 #ifndef _NAN_H
  34 #define _NAN_H
  35 


  36 /*
  37  * Handling of Not_a_Number's (only in IEEE floating-point standard)
  38  */
  39 
  40 #include <sys/isa_defs.h>
  41 #include <values.h>
  42 
  43 #ifdef  __cplusplus
  44 extern "C" {
  45 #endif
  46 
  47 #if defined(_IEEE_754)
  48 /*
  49  * Structure order is endian dependent.  Only the common variants of
  50  * big and little endian are supported.
  51  */
  52 
  53 #if defined(_BIG_ENDIAN)
  54 
  55 typedef union


 103 
 104 /*
 105  * IsINF must be used after IsNANorINF has checked the exponent
 106  */
 107 #define IsINF(X)        (((dnan *)&(X))->inf_parts.bits == 0 && \
 108                             ((dnan *)&(X))->inf_parts.fraction_low == 0)
 109 
 110 /*
 111  * IsPosNAN and IsNegNAN can be used to check the sign of infinities too
 112  */
 113 #define IsPosNAN(X)     (((dnan *)&(X))->nan_parts.sign == 0)
 114 
 115 #define IsNegNAN(X)     (((dnan *)&(X))->nan_parts.sign == 1)
 116 
 117 /*
 118  * GETNaNPC gets the leftmost 32 bits of the fraction part
 119  */
 120 #define GETNaNPC(dval)  (((dnan *)&(dval))->inf_parts.bits << 12 | \
 121                             ((dnan *)&(dval))->nan_parts.fraction_low >> 20)
 122 

 123 #define KILLFPE()       (void) _kill(_getpid(), 8)



 124 #define NaN(X)          (((dnan *)&(X))->nan_parts.exponent == 0x7ff)
 125 #define KILLNaN(X)      if (NaN(X)) KILLFPE()
 126 
 127 #else   /* defined(_IEEE_754) */
 128 /* #error is strictly ansi-C, but works as well as anything for K&R systems. */
 129 #error ISA not supported
 130 #endif  /* defined(_IEEE_754) */
 131 
 132 #ifdef  __cplusplus
 133 }
 134 #endif
 135 
 136 #endif  /* _NAN_H */