2013-01-02 19:01:50 +00:00
|
|
|
/* Copyright (C) 1992-2013 Free Software Foundation, Inc.
|
1996-12-20 01:39:50 +00:00
|
|
|
This file is part of the GNU C Library.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1997-01-01 15:28:18 +00:00
|
|
|
#ifndef _IEEE754_H
|
|
|
|
|
|
|
|
#define _IEEE754_H 1
|
|
|
|
#include <features.h>
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
#include <endian.h>
|
|
|
|
|
1997-01-01 15:28:18 +00:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
union ieee754_float
|
|
|
|
{
|
|
|
|
float f;
|
1996-01-17 22:33:48 +00:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
/* This is the IEEE 754 single-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int mantissa:23;
|
|
|
|
#endif /* Big endian. */
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
unsigned int mantissa:23;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int negative:1;
|
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee;
|
|
|
|
|
|
|
|
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int mantissa:22;
|
|
|
|
#endif /* Big endian. */
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
unsigned int mantissa:22;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int negative:1;
|
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
|
|
|
|
|
|
|
|
|
|
|
|
union ieee754_double
|
|
|
|
{
|
|
|
|
double d;
|
1996-01-17 22:33:48 +00:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
/* This is the IEEE 754 double-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif /* Big endian. */
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
2008-03-10 06:21:21 +00:00
|
|
|
# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
1999-08-09 05:35:13 +00:00
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
1995-02-18 01:27:10 +00:00
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
1999-08-09 05:35:13 +00:00
|
|
|
# endif
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee;
|
|
|
|
|
|
|
|
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int quiet_nan:1;
|
1996-12-20 01:39:50 +00:00
|
|
|
/* Together these comprise the mantissa. */
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#else
|
2008-03-10 06:21:21 +00:00
|
|
|
# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
1999-08-09 05:35:13 +00:00
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
1996-12-20 01:39:50 +00:00
|
|
|
/* Together these comprise the mantissa. */
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
1999-08-09 05:35:13 +00:00
|
|
|
# endif
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
|
|
|
|
|
|
|
|
|
|
|
|
union ieee854_long_double
|
|
|
|
{
|
|
|
|
long double d;
|
1996-01-17 22:33:48 +00:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
/* This is the IEEE 854 double-extended-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
2008-03-10 06:21:21 +00:00
|
|
|
# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
1999-08-09 05:35:13 +00:00
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
1999-08-09 05:35:13 +00:00
|
|
|
# endif
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif
|
|
|
|
} ieee;
|
1996-01-17 22:33:48 +00:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
/* This is for NaNs in the IEEE 854 double-extended-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int empty:16;
|
* misc/efgcvt_r.c (ecvt_r): Handle negative values.
* stdlib/stdlib.h: Replace __CONSTVALUE by attribute.
* stdlib/abs.c, stdlib/div.c, stdlib/labs.c, stdlib/ldiv.c,
sysdeps/generic/hypot.c: Remove obsolete __CONSTVALUE.
* stdio-common/printf_fp.c (__printf_fp): Fix parameter
declaration.
* sysdeps/generic/putenv.c (putenv): Fix second argument of
setenv.
* sysdeps/ieee754/hypot.c: New file, extracted out of cabs.c.
* sysdeps/ieee754/cabs.c: Don't define hypot here.
* sysdeps/ieee754/ieee754.h (union ieee854_long_double): Fix
definition of ieee_nan alternative.
* sysdeps/m68k/__longjmp.c, sysdeps/m68k/setjmp.c: Add register
prefix spec.
* sysdeps/m68k/ffs.c (ffs): Fix register constraint.
* sysdeps/m68k/fpu/__math.h: Include <errno.h>. Replace obsolete
__CONSTVALUE by attribute.
(floor): Round to negative infinity.
(rint, expm1) [__NO_MATH_INLINES]: Don't define, to avoid type
clash when compiling source.
(pow): Handle x == 0 and x < 0.
(ceil, __isinf, __isnan): Fix register constraints.
(__isinfl, __isnanl): Added.
* sysdeps/m68k/fpu/acos.c, sysdeps/m68k/fpu/atan2.c,
sysdeps/m68k/fpu/fmod.c, sysdeps/m68k/fpu/ldexp.c,
sysdeps/m68k/fpu/pow.c: Remove obsolete __CONSTVALUE.
* sysdeps/m68k/bsd-_setjmp.S, sysdeps/m68k/bsd-setjmp.S: Fix
assembler syntax.
* sysdeps/unix/bsd/bsd4.4/fchdir.S (fchdir): Take only one
argument.
* sysdeps/unix/bsd/clock.c (timeval_to_clock_t): Fix timeval to
clock_t conversion.
(clock): Don't multiply by CLOCKS_PER_SEC.
* sysdeps/unix/bsd/poll.c (poll): Fix msec to timeval conversion.
* sysdeps/unix/bsd/sun/m68k/brk.S (brk): Compare with address of
__end.
* sysdeps/unix/bsd/sun/m68k/vfork.S: Fix assembler syntax.
* sysdeps/unix/bsd/ualarm.c (ualarm): Fix timeval calculation.
* sysdeps/unix/bsd/vax/vfork.S: Remove duplicate label.
1996-01-17 02:03:00 +00:00
|
|
|
unsigned int one:1;
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int quiet_nan:1;
|
* misc/efgcvt_r.c (ecvt_r): Handle negative values.
* stdlib/stdlib.h: Replace __CONSTVALUE by attribute.
* stdlib/abs.c, stdlib/div.c, stdlib/labs.c, stdlib/ldiv.c,
sysdeps/generic/hypot.c: Remove obsolete __CONSTVALUE.
* stdio-common/printf_fp.c (__printf_fp): Fix parameter
declaration.
* sysdeps/generic/putenv.c (putenv): Fix second argument of
setenv.
* sysdeps/ieee754/hypot.c: New file, extracted out of cabs.c.
* sysdeps/ieee754/cabs.c: Don't define hypot here.
* sysdeps/ieee754/ieee754.h (union ieee854_long_double): Fix
definition of ieee_nan alternative.
* sysdeps/m68k/__longjmp.c, sysdeps/m68k/setjmp.c: Add register
prefix spec.
* sysdeps/m68k/ffs.c (ffs): Fix register constraint.
* sysdeps/m68k/fpu/__math.h: Include <errno.h>. Replace obsolete
__CONSTVALUE by attribute.
(floor): Round to negative infinity.
(rint, expm1) [__NO_MATH_INLINES]: Don't define, to avoid type
clash when compiling source.
(pow): Handle x == 0 and x < 0.
(ceil, __isinf, __isnan): Fix register constraints.
(__isinfl, __isnanl): Added.
* sysdeps/m68k/fpu/acos.c, sysdeps/m68k/fpu/atan2.c,
sysdeps/m68k/fpu/fmod.c, sysdeps/m68k/fpu/ldexp.c,
sysdeps/m68k/fpu/pow.c: Remove obsolete __CONSTVALUE.
* sysdeps/m68k/bsd-_setjmp.S, sysdeps/m68k/bsd-setjmp.S: Fix
assembler syntax.
* sysdeps/unix/bsd/bsd4.4/fchdir.S (fchdir): Take only one
argument.
* sysdeps/unix/bsd/clock.c (timeval_to_clock_t): Fix timeval to
clock_t conversion.
(clock): Don't multiply by CLOCKS_PER_SEC.
* sysdeps/unix/bsd/poll.c (poll): Fix msec to timeval conversion.
* sysdeps/unix/bsd/sun/m68k/brk.S (brk): Compare with address of
__end.
* sysdeps/unix/bsd/sun/m68k/vfork.S: Fix assembler syntax.
* sysdeps/unix/bsd/ualarm.c (ualarm): Fix timeval calculation.
* sysdeps/unix/bsd/vax/vfork.S: Remove duplicate label.
1996-01-17 02:03:00 +00:00
|
|
|
unsigned int mantissa0:30;
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
2008-03-10 06:21:21 +00:00
|
|
|
# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
1999-08-09 05:35:13 +00:00
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:30;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int one:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int mantissa1:32;
|
* misc/efgcvt_r.c (ecvt_r): Handle negative values.
* stdlib/stdlib.h: Replace __CONSTVALUE by attribute.
* stdlib/abs.c, stdlib/div.c, stdlib/labs.c, stdlib/ldiv.c,
sysdeps/generic/hypot.c: Remove obsolete __CONSTVALUE.
* stdio-common/printf_fp.c (__printf_fp): Fix parameter
declaration.
* sysdeps/generic/putenv.c (putenv): Fix second argument of
setenv.
* sysdeps/ieee754/hypot.c: New file, extracted out of cabs.c.
* sysdeps/ieee754/cabs.c: Don't define hypot here.
* sysdeps/ieee754/ieee754.h (union ieee854_long_double): Fix
definition of ieee_nan alternative.
* sysdeps/m68k/__longjmp.c, sysdeps/m68k/setjmp.c: Add register
prefix spec.
* sysdeps/m68k/ffs.c (ffs): Fix register constraint.
* sysdeps/m68k/fpu/__math.h: Include <errno.h>. Replace obsolete
__CONSTVALUE by attribute.
(floor): Round to negative infinity.
(rint, expm1) [__NO_MATH_INLINES]: Don't define, to avoid type
clash when compiling source.
(pow): Handle x == 0 and x < 0.
(ceil, __isinf, __isnan): Fix register constraints.
(__isinfl, __isnanl): Added.
* sysdeps/m68k/fpu/acos.c, sysdeps/m68k/fpu/atan2.c,
sysdeps/m68k/fpu/fmod.c, sysdeps/m68k/fpu/ldexp.c,
sysdeps/m68k/fpu/pow.c: Remove obsolete __CONSTVALUE.
* sysdeps/m68k/bsd-_setjmp.S, sysdeps/m68k/bsd-setjmp.S: Fix
assembler syntax.
* sysdeps/unix/bsd/bsd4.4/fchdir.S (fchdir): Take only one
argument.
* sysdeps/unix/bsd/clock.c (timeval_to_clock_t): Fix timeval to
clock_t conversion.
(clock): Don't multiply by CLOCKS_PER_SEC.
* sysdeps/unix/bsd/poll.c (poll): Fix msec to timeval conversion.
* sysdeps/unix/bsd/sun/m68k/brk.S (brk): Compare with address of
__end.
* sysdeps/unix/bsd/sun/m68k/vfork.S: Fix assembler syntax.
* sysdeps/unix/bsd/ualarm.c (ualarm): Fix timeval calculation.
* sysdeps/unix/bsd/vax/vfork.S: Remove duplicate label.
1996-01-17 02:03:00 +00:00
|
|
|
unsigned int mantissa0:30;
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int quiet_nan:1;
|
1996-01-17 22:33:48 +00:00
|
|
|
unsigned int one:1;
|
1995-02-18 01:27:10 +00:00
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
1999-08-09 05:35:13 +00:00
|
|
|
# endif
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
|
1997-01-01 15:28:18 +00:00
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* ieee754.h */
|