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