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

Subversion Repositories or1k

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

Go to most recent revision | 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 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 Library General Public License as
8
   published by the Free Software Foundation; either version 2 of the
9
   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
   Library General Public License for more details.
15
 
16
   You should have received a copy of the GNU Library General Public
17
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
18
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 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
# define HUGE_VAL                                       \
34
  (__extension__                                        \
35
   ((union { unsigned long long __l; double __d; })     \
36
    { __l: 0x7ff0000000000000ULL }).__d)
37
 
38
#else /* not GCC */
39
 
40
static union { unsigned char __c[8]; double __d; } __huge_val =
41
  { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
42
# define HUGE_VAL       (__huge_val.__d)
43
 
44
#endif  /* GCC.  */
45
 
46
 
47
/* ISO C 9X extensions: (float) HUGE_VALF and (long double) HUGE_VALL.  */
48
 
49
#ifdef __USE_ISOC9X
50
 
51
# ifdef __GNUC__
52
 
53
#  define HUGE_VALF                                     \
54
  (__extension__                                        \
55
   ((union { unsigned long __l; float __f; })           \
56
    { __l: 0x7f800000UL }).__f)
57
 
58
#  define HUGE_VALL                                     \
59
  (__extension__                                        \
60
   ((union { unsigned long __l[3]; long double __ld; }) \
61
    { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
62
 
63
# else /* not GCC */
64
 
65
static union { unsigned char __c[4]; float __f; } __huge_valf =
66
  { { 0x7f, 0x80, 0, 0 } };
67
#  define HUGE_VALF     (__huge_valf.__f)
68
 
69
static union { unsigned char __c[12]; long double __ld; } __huge_vall =
70
  { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
71
#  define HUGE_VALL     (__huge_vall.__ld)
72
 
73
# endif /* GCC.  */
74
 
75
#endif  /* __USE_ISOC9X.  */

powered by: WebSVN 2.1.0

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