Annotation of OpenXM_contrib/gmp/mpfr/mpfr-math.h, Revision 1.1
1.1 ! ohara 1: /* Macros MPFR_DBL_NAN, MPFR_DBL_INFP and MPFR_DBL_INFM
! 2:
! 3: Copyright 2002 Free Software Foundation, Inc.
! 4:
! 5: This file is part of the MPFR Library.
! 6:
! 7: The MPFR Library is free software; you can redistribute it and/or modify
! 8: it under the terms of the GNU Lesser General Public License as published by
! 9: the Free Software Foundation; either version 2.1 of the License, or (at your
! 10: option) any later version.
! 11:
! 12: The MPFR Library is distributed in the hope that it will be useful, but
! 13: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 14: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
! 15: License for more details.
! 16:
! 17: You should have received a copy of the GNU Lesser General Public License
! 18: along with the MPFR Library; see the file COPYING.LIB. If not, write to
! 19: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! 20: MA 02111-1307, USA. */
! 21:
! 22: #if (defined (__arm__) && (defined (__ARMWEL__) || defined (__linux__)))
! 23: /* little endian ARM */
! 24: #define _MPFR_NAN_BYTES { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }
! 25: #define _MPFR_INFP_BYTES { 0, 0, 0x80, 0x7f }
! 26: #define _MPFR_INFM_BYTES { 0, 0, 0x80, 0xff }
! 27:
! 28: #else
! 29: #if defined (_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) \
! 30: || defined (__alpha) \
! 31: || (defined (__arm__) && (defined (__ARMWEL__) || defined (__linux__)))\
! 32: || defined (__clipper__) \
! 33: || defined (__cris) \
! 34: || defined (__i386__) \
! 35: || defined (__i860__) \
! 36: || defined (__i960__) \
! 37: || defined (__ia64) \
! 38: || defined (MIPSEL) || defined (_MIPSEL) \
! 39: || defined (__ns32000__) \
! 40: || defined (__WINNT) || defined (_WIN32)
! 41: #define _MPFR_NAN_BYTES { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
! 42: #define _MPFR_INFP_BYTES { 0, 0, 0x80, 0x7f }
! 43: #define _MPFR_INFM_BYTES { 0, 0, 0x80, 0xff }
! 44:
! 45: #else
! 46: #if defined (_BIG_ENDIAN) || defined (__BIG_ENDIAN__) \
! 47: || defined (__mc68000__) || defined (__mc68020__) || defined (__m68k__)\
! 48: || defined (mc68020) \
! 49: || defined (__a29k__) || defined (_AM29K) \
! 50: || defined (__arm__) \
! 51: || (defined (__convex__) && defined (_IEEE_FLOAT_)) \
! 52: || defined (_CRAYMPP) || defined (_CRAYIEEE) \
! 53: || defined (__i370__) || defined (__mvs__) \
! 54: || defined (__m88000__) \
! 55: || defined (MIPSEB) || defined (_MIPSEB) \
! 56: || defined (__hppa) || defined (__hppa__) \
! 57: || defined (__pyr__) \
! 58: || defined (__ibm032__) \
! 59: || defined (_IBMR2) || defined (_ARCH_PPC) \
! 60: || defined (__sh__) \
! 61: || defined (__sparc) || defined (sparc) || defined (__sparc__) \
! 62: || defined (__we32k__)
! 63: #define _MPFR_NAN_BYTES { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
! 64: #define _MPFR_INFP_BYTES { 0x7f, 0x80, 0, 0 }
! 65: #define _MPFR_INFM_BYTES { 0xff, 0x80, 0, 0 }
! 66: #endif
! 67: #endif
! 68: #endif
! 69:
! 70: #ifdef NAN
! 71: #define MPFR_DBL_NAN ((double) NAN)
! 72: #else
! 73: #ifdef _MPFR_NAN_BYTES
! 74: static union { unsigned char c[8]; double d; } __mpfr_nan
! 75: = { _MPFR_NAN_BYTES };
! 76: #define MPFR_DBL_NAN ((double) __mpfr_nan.d)
! 77: #else
! 78: #define MPFR_DBL_NAN (0./0.)
! 79: #endif
! 80: #endif
! 81:
! 82: #ifdef HUGE_VAL
! 83: #define MPFR_DBL_INFP HUGE_VAL
! 84: #define MPFR_DBL_INFM (-HUGE_VAL)
! 85: #else
! 86: #ifdef _MPFR_INFP_BYTES
! 87: static union { unsigned char c[4]; float d; } __mpfr_infp
! 88: = { _MPFR_INFP_BYTES };
! 89: static union { unsigned char c[4]; float d; } __mpfr_infm
! 90: = { _MPFR_INFM_BYTES };
! 91: #define MPFR_DBL_INFP ((double) __mpfr_infp.d)
! 92: #define MPFR_DBL_INFM ((double) __mpfr_infm.d)
! 93: #else
! 94: #define MPFR_DBL_INFP (1/0.)
! 95: #define MPFR_DBL_INFM (-1/0.)
! 96: #endif
! 97: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>