Update.
[glibc.git] / sysdeps / s390 / bits / huge_val.h
blob0c8264c90f3426e3d1a0a16683e63bfa67240d8c
1 /* `HUGE_VAL' constants for s390 (where it is infinity).
2 Used by <stdlib.h> and <math.h> functions for overflow.
3 Copyright (C) 2000 Free Software Foundation, Inc.
4 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef _MATH_H
23 # error "Never use <bits/huge_val.h> directly; include <math.h> instead."
24 #endif
26 #include <features.h>
28 /* IEEE positive infinity (-HUGE_VAL is negative infinity). */
30 #if __GNUC_PREREQ(2,96)
31 # define HUGE_VAL (__extension__ 0x1.0p2047)
32 #else
33 #define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
35 #define __huge_val_t union { unsigned char __c[8]; double __d; }
36 #ifdef __GNUC__
37 # define HUGE_VAL (__extension__ \
38 ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
39 #else /* Not GCC. */
40 static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
41 # define HUGE_VAL (__huge_val.__d)
42 #endif /* GCC. */
43 #endif /* GCC 2.95 */
46 /* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
48 #ifdef __USE_ISOC99
50 # if __GNUC_PREREQ(2,96)
52 # define HUGE_VALF (__extension__ 0x1.0p255f)
53 # define HUGE_VALL (__extension__ 0x1.0p255f)
55 # else
57 # define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 }
59 # define __huge_valf_t union { unsigned char __c[4]; float __f; }
60 # ifdef __GNUC__
61 # define HUGE_VALF (__extension__ \
62 ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
63 # else /* Not GCC. */
64 static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
65 # define HUGE_VALF (__huge_valf.__f)
66 # endif /* GCC. */
68 /* On 390 there is no 'long double' format. Make it the same as 'double' */
69 # define HUGE_VALL HUGE_VAL
71 # endif /* GCC 2.95 */
73 #endif /* __USE_ISOC99. */