OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [m68k/] [bits/] [huge_val.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* `HUGE_VAL' constants for m68k (where it is infinity).
2
   Used by <stdlib.h> and <math.h> functions for overflow.
3
   Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 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, write to the Free
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
   02111-1307 USA.  */
20
 
21
#ifndef _MATH_H
22
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
23
#endif
24
 
25
 
26
#include <features.h>
27
#include <sys/cdefs.h>
28
 
29
/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
30
 
31
#ifdef  __GNUC__
32
 
33
# if __GNUC_PREREQ(2,96)
34
 
35
#  define HUGE_VAL (__extension__ 0x1.0p2047)
36
 
37
# else
38
 
39
#  define HUGE_VAL                                      \
40
  (__extension__                                        \
41
   ((union { unsigned long long __l; double __d; })     \
42
    { __l: 0x7ff0000000000000ULL }).__d)
43
 
44
# endif
45
 
46
#else /* not GCC */
47
 
48
static union { unsigned char __c[8]; double __d; } __huge_val =
49
  { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
50
# define HUGE_VAL       (__huge_val.__d)
51
 
52
#endif  /* GCC.  */
53
 
54
 
55
/* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL.  */
56
 
57
#ifdef __USE_ISOC99
58
 
59
# if __GNUC_PREREQ(2,96)
60
 
61
#  define HUGE_VALF (__extension__ 0x1.0p255f)
62
#  define HUGE_VALL (__extension__ 0x1.0p32767L)
63
 
64
# else
65
 
66
#  ifdef __GNUC__
67
 
68
#   define HUGE_VALF                                    \
69
  (__extension__                                        \
70
   ((union { unsigned long __l; float __f; })           \
71
    { __l: 0x7f800000UL }).__f)
72
 
73
#   define HUGE_VALL                                    \
74
  (__extension__                                        \
75
   ((union { unsigned long __l[3]; long double __ld; }) \
76
    { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
77
 
78
#  else /* not GCC */
79
 
80
static union { unsigned char __c[4]; float __f; } __huge_valf =
81
  { { 0x7f, 0x80, 0, 0 } };
82
#   define HUGE_VALF    (__huge_valf.__f)
83
 
84
static union { unsigned char __c[12]; long double __ld; } __huge_vall =
85
  { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
86
#   define HUGE_VALL    (__huge_vall.__ld)
87
 
88
#  endif /* GCC.  */
89
 
90
# endif /* GCC 2.95.  */
91
 
92
#endif  /* __USE_ISOC99.  */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.