1*53ee8cc1Swenshuai.xi /* `HUGE_VALF' constant for IEEE 754 machines (where it is infinity). 2*53ee8cc1Swenshuai.xi Used by <stdlib.h> and <math.h> functions for overflow. 3*53ee8cc1Swenshuai.xi Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 4*53ee8cc1Swenshuai.xi Free Software Foundation, Inc. 5*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 6*53ee8cc1Swenshuai.xi 7*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 8*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 9*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 10*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 11*53ee8cc1Swenshuai.xi 12*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 13*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 14*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 16*53ee8cc1Swenshuai.xi 17*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 18*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 19*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 21*53ee8cc1Swenshuai.xi 22*53ee8cc1Swenshuai.xi #ifndef _MATH_H 23*53ee8cc1Swenshuai.xi # error "Never use <bits/huge_valf.h> directly; include <math.h> instead." 24*53ee8cc1Swenshuai.xi #endif 25*53ee8cc1Swenshuai.xi 26*53ee8cc1Swenshuai.xi /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ 27*53ee8cc1Swenshuai.xi 28*53ee8cc1Swenshuai.xi #if __GNUC_PREREQ(3,3) 29*53ee8cc1Swenshuai.xi # define HUGE_VALF (__builtin_huge_valf()) 30*53ee8cc1Swenshuai.xi #elif __GNUC_PREREQ(2,96) 31*53ee8cc1Swenshuai.xi # define HUGE_VALF (__extension__ 0x1.0p255f) 32*53ee8cc1Swenshuai.xi #elif defined __GNUC__ 33*53ee8cc1Swenshuai.xi 34*53ee8cc1Swenshuai.xi # define HUGE_VALF \ 35*53ee8cc1Swenshuai.xi (__extension__ \ 36*53ee8cc1Swenshuai.xi ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ 37*53ee8cc1Swenshuai.xi { __l: 0x7f800000UL }).__d) 38*53ee8cc1Swenshuai.xi 39*53ee8cc1Swenshuai.xi #else /* not GCC */ 40*53ee8cc1Swenshuai.xi 41*53ee8cc1Swenshuai.xi typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; 42*53ee8cc1Swenshuai.xi 43*53ee8cc1Swenshuai.xi # if __BYTE_ORDER == __BIG_ENDIAN 44*53ee8cc1Swenshuai.xi # define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } 45*53ee8cc1Swenshuai.xi # endif 46*53ee8cc1Swenshuai.xi # if __BYTE_ORDER == __LITTLE_ENDIAN 47*53ee8cc1Swenshuai.xi # define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } 48*53ee8cc1Swenshuai.xi # endif 49*53ee8cc1Swenshuai.xi 50*53ee8cc1Swenshuai.xi static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; 51*53ee8cc1Swenshuai.xi # define HUGE_VALF (__huge_valf.__f) 52*53ee8cc1Swenshuai.xi 53*53ee8cc1Swenshuai.xi #endif /* GCC. */ 54