summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-12 23:41:36 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-12 23:41:36 +0000
commit6355131153fd618d50286f0f24ac49b405d03ee5 (patch)
tree4927449e56ae721b2ddb0d42efcce211b6068004 /sysdeps/i386
parentc131718ccc1db101df54fb04f34f5611c3678450 (diff)
downloadglibc-6355131153fd618d50286f0f24ac49b405d03ee5.tar.gz
glibc-6355131153fd618d50286f0f24ac49b405d03ee5.tar.xz
glibc-6355131153fd618d50286f0f24ac49b405d03ee5.zip
Update.
1997-04-13 01:06  Ulrich Drepper  <drepper@cygnus.com>

	* isomac.c: Improve messages.

	* math/Makefile (libm-calls): Add s_nearbyint, s_catan, s_casin,
	s_ccos, s_csin, s_ctan, s_ctanh, s_cacos, s_casinh, s_cacosh,
	s_catanh, s_csqrt, and s_cpow.
	* math/libm-test.c: New functions ccos_test, cacos_test, cacosh_test,
	casin_test, casinh_test, catan_test, catanh_test, ctanh_test,
	csqrt_test, cpow_test, rint_test.
	* math/math.h: Include new header mathbits.h which defines some
	more (system dependent) types and some macros.
	(isfinite): Use __finite instead of fpclassify.
	* sysdeps/generic/mathbits.h: New file.
	* sysdeps/i386/fpu/mathbits.h: New file.
	* sysdeps/i386/huge_val.h: Don't define INFINITY.
	* sysdeps/ieee754/huge_val.h: Likewise.
	* sysdeps/m68k/huge_val.h: Likewise.

	* sysdeps/i386/fpu/fenvbits.h: Define FE_NOMASK_ENV.
	* sysdeps/i386/fpu/fesetenv.c: Handle FE_NOMASK_ENV.

	* math/complex.h (_Imaginary_I): Define correctly.  I misread the
	standard first.

	* sysdeps/libm-i387/s_finite.S: Optimized rewrite.
	* sysdeps/libm-i387/s_finitef.S: Likewise.
	* sysdeps/libm-i387/s_finitel.S: Likewise.
	Provided by Joe Keane <jgk@jgk.org>.

	* sysdeps/libm-i387/s_nearbyint.S: New file.
	* sysdeps/libm-i387/s_nearbyintf.S: New file.
	* sysdeps/libm-i387/s_nearbyintl.S: New file.
	* sysdeps/libm-ieee754/s_nearbyint.S: New file.
	* sysdeps/libm-ieee754/s_nearbyintf.S: New file.
	* sysdeps/libm-ieee754/s_nearbyintl.S: New file.

	* sysdeps/libm-ieee754/s_cacos.c: New file.
	* sysdeps/libm-ieee754/s_cacosf.c: New file.
	* sysdeps/libm-ieee754/s_cacosl.c: New file.
	* sysdeps/libm-ieee754/s_cacosh.c: New file.
	* sysdeps/libm-ieee754/s_cacoshf.c: New file.
	* sysdeps/libm-ieee754/s_cacoshl.c: New file.
	* sysdeps/libm-ieee754/s_casin.c: New file.
	* sysdeps/libm-ieee754/s_casinf.c: New file.
	* sysdeps/libm-ieee754/s_casinl.c: New file.
	* sysdeps/libm-ieee754/s_casinh.c: New file.
	* sysdeps/libm-ieee754/s_casinhf.c: New file.
	* sysdeps/libm-ieee754/s_casinhl.c: New file.
	* sysdeps/libm-ieee754/s_catan.c: New file.
	* sysdeps/libm-ieee754/s_catanf.c: New file.
	* sysdeps/libm-ieee754/s_catanl.c: New file.
	* sysdeps/libm-ieee754/s_catanh.c: New file.
	* sysdeps/libm-ieee754/s_catanhf.c: New file.
	* sysdeps/libm-ieee754/s_catanhl.c: New file.
	* sysdeps/libm-ieee754/s_ccos.c: New file.
	* sysdeps/libm-ieee754/s_ccosf.c: New file.
	* sysdeps/libm-ieee754/s_ccosl.c: New file.
	* sysdeps/libm-ieee754/s_cpow.c: New file.
	* sysdeps/libm-ieee754/s_cpowf.c: New file.
	* sysdeps/libm-ieee754/s_cpowl.c: New file.
	* sysdeps/libm-ieee754/s_csin.c: New file.
	* sysdeps/libm-ieee754/s_csinf.c: New file.
	* sysdeps/libm-ieee754/s_csinl.c: New file.
	* sysdeps/libm-ieee754/s_csqrt.c: New file.
	* sysdeps/libm-ieee754/s_csqrtf.c: New file.
	* sysdeps/libm-ieee754/s_csqrtl.c: New file.
	* sysdeps/libm-ieee754/s_ctan.c: New file.
	* sysdeps/libm-ieee754/s_ctanf.c: New file.
	* sysdeps/libm-ieee754/s_ctanl.c: New file.
	* sysdeps/libm-ieee754/s_ctanh.c: New file.
	* sysdeps/libm-ieee754/s_ctanhf.c: New file.
	* sysdeps/libm-ieee754/s_ctanhl.c: New file.

	* time/strftime.c (memset_space): Increment pointer.
	* time/strptime.c: Interpret year number 00-59 as 2000--2059.
	Patches by Karl Heuer <kwzh@gnu.ai.mit.edu>.

1997-04-11 11:57  Miguel de Icaza <miguel@nuclecu.unam.mx>

	* sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove fork,
	pipe, syscall.

1997-04-05 00:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
	probably still wrong.
	* sysdeps/libm-ieee754/s_remquof.c: Likewise.
	* sysdeps/libm-ieee754/s_remquol.c: Likewise.

	* math/libm-test.c (remquo_test): Corrected.

1997-04-11 00:01  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/fpu/__math.h (__rinttol, rinttol): New inline.
	* sysdeps/m68k/fpu/s_rinttol.c: New file.
	* sysdeps/m68k/fpu/s_rinttoll.c: New file.

	* math/libm-test.c (remquo_test): Use check_long to test the
	quotient.
	(cbrt_test): Add epsilons for long double.

1997-04-10 18:48  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/localeinfo.h: Update declaration of _nl_current.

1997-04-11 11:27  Ulrich Drepper  <drepper@cygnus.com>

	* rellnsh-sh: Use explicitely /bin/pwd to find the external program.

	* math/Makefile (headers): Add fenv.h and fenvbits.h.
	(libm-support): Add s_rountol, s_roundtoll, fclrexcpt, fgetexcptflg,
	fraiseexcpt, fsetexcptflg, ftestexcept, fegetround, fesetround,
	fegetenv, feholdexcpt, fesetenv, feupdateenv.
	(libm-calls): Add s_round.
	* math/fenv.h: New file.
	* math/libm-test.c: Correct tests for s_rinttol and s_rinttoll.
	Add roundtol_check and roundtoll_check.
	* math/math.h: Pretty printing.
	* sysdeps/i386/fpu/fclrexcpt.c: New file.
	* sysdeps/i386/fpu/fegetenv.c: New file.
	* sysdeps/i386/fpu/fegetround.c: New file.
	* sysdeps/i386/fpu/feholdexcpt.c: New file.
	* sysdeps/i386/fpu/fenvbits.h: New file.
	* sysdeps/i386/fpu/fesetenv.c: New file.
	* sysdeps/i386/fpu/fesetround.c: New file.
	* sysdeps/i386/fpu/fgetexcptflg.c: New file.
	* sysdeps/i386/fpu/fraiseexcpt.c: New file.
	* sysdeps/i386/fpu/fsetexcptflg.c: New file.
	* sysdeps/i386/fpu/ftestexcept.c: New file.
	* sysdeps/stub/fclrexcpt.c: New file.
	* sysdeps/stub/fegetenv.c: New file.
	* sysdeps/stub/fegetround.c: New file.
	* sysdeps/stub/feholdexcpt.c: New file.
	* sysdeps/stub/fenvbits.h: New file.
	* sysdeps/stub/fesetenv.c: New file.
	* sysdeps/stub/fesetround.c: New file.
	* sysdeps/stub/fgetexcptflg.c: New file.
	* sysdeps/stub/fraiseexcpt.c: New file.
	* sysdeps/stub/fsetexcptflg.c: New file.
	* sysdeps/stub/ftestexcept.c: New file.

	* sysdeps/libm-i387/s_trunc.S: New file.
	* sysdeps/libm-i387/s_truncf.S: New file.
	* sysdeps/libm-i387/s_truncl.S: New file.

	* sysdeps/libm-ieee754/s_round.c: New file.
	* sysdeps/libm-ieee754/s_roundf.c: New file.
	* sysdeps/libm-ieee754/s_roundl.c: New file.

	* sysdeps/libm-ieee754/s_ccosh.c: Rewritten to use fpclassify.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
	* sysdeps/libm-ieee754/s_cexp.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
	* sysdeps/libm-ieee754/s_clog.c: Likewise.
	* sysdeps/libm-ieee754/s_clogf.c: Likewise.
	* sysdeps/libm-ieee754/s_clogl.c: Likewise.
	* sysdeps/libm-ieee754/s_csinh.c. Likewise.
	* sysdeps/libm-ieee754/s_csinhf.c. Likewise.
	* sysdeps/libm-ieee754/s_csinhl.c. Likewise.

	* sysdeps/libm-ieee754/s_ceill.c: Corrected.  The mantissa has only
	63 bits.
	* sysdeps/libm-ieee754/s_floorl.c: Likewise.

	* po/pl.po: Updated.

	* string/swab.c: Correctly handle array of odd length.

	* sysdeps/generic/memmem.c: Update copyright.

1997-04-10 20:22  Ulrich Drepper  <drepper@cygnus.com>

	* hurd/Makefile (sunrpc-headers): Add clnt.h.
	Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>.

1997-04-09 14:21  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* sysdeps/sparc/dl-machine.h: Bug fix: I was not loading
	the proper value from the GOT.  Pass argument block to
	init function.

	* sysdeps/sparc/elf/start.c: Call atexit (_fini) after calling
	_init ().

	* sysdeps/sparc/fpu_control.h: Fix the FPU constants.  I got them
	wrong the first time.

	* sysdeps/sparc/setjmp.S: PIC code was clobbering a callee saved
	register.

	* sysdeps/sparc/udiv_qrnnd.S: Add type @function.

	* sysdeps/unix/sysv/linux/sparc/init-first.h: Linux/SPARC specific
	SYSDEP_CALL_INIT.

	* sysdeps/unix/sysv/linux/sparc/signum.h: Remove definition for
	NSIG and duplicated SIGIOT.

1997-04-05 00:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
	probably still wrong.
	* sysdeps/libm-ieee754/s_remquof.c: Likewise.
	* sysdeps/libm-ieee754/s_remquol.c: Likewise.

	* math/libm-test.c (remquo_test): Corrected.

1997-04-03 18:35  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile (parent-tests): New target to run the tests to that
	they are executed even if some subdir tests have failed.
	(tests): Depend on parent-tests instead of running the tests
	directly.

1997-04-03 12:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	Clean up name space pollution in libnss_*.so:
	* nis/nss_compat/compat-pwd.c, resolv/mapv4v6addr.h,
	resolv/nss_dns/dns-host.c: Replace bzero by memset, bcopy by
	memcpy and bcmp by memcmp to clean up namespace.
	* nss/nss_db/db-XXX.c (internal_setent): Use __dbopen instead of
	dbopen.
	* nss/nss_db/db-alias.c (internal_setent): Likewise.
	* nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Likewise.
	* db/db/db.c [_LIBC]: Define __dbopen instead of dbopen and make
	the latter a weak alias.
	* db/db.h: Declare __dbopen.
	* db/btree/btree.h [_LIBC]: Prepend __ to all mpool functions.
	* db/mpool/mpool.c [_LIBC]: Define all external functions with __
	prefix and make the old names weak aliases.
	* db/mpool.h: Declare the new internal names.

1997-04-04 23:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio-common/vfscanf.c: Fix scanning of hexadecimal fp number.
	* stdio-common/tstscanf.c: Add test case for this.

1997-04-04 17:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/libm-test.c: Fix more typos.

1997-04-03 17:15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/libm-test.c (csinh_test): Fix test names.
	(ccosh_test): Likewise.

	* sysdeps/libm-ieee754/s_csinh.c: Use sinh function instead of
	computing it directly.
	* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
	* sysdeps/libm-ieee754/s_csinhl.c: Likewise.

	* sysdeps/libm-ieee754/s_ccosh.c:  Use cosh function instead of
	computing it directly.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.

	* sysdeps/libm-ieee754/s_cexp.c: Use internal exp function instead
	of wrapper.
	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
	* sysdeps/m68k/fpu/s_cexp.c: Likewise.  Correct handling of
	special values.  Avoid use of fsincos if all that is needed is the
	quadrant.

	* sysdeps/m68k/fpu/s_ccosh.c: New file.
	* sysdeps/m68k/fpu/s_ccoshf.c: New file.
	* sysdeps/m68k/fpu/s_ccoshl.c: New file.
	* sysdeps/m68k/fpu/s_csinh.c: New file.
	* sysdeps/m68k/fpu/s_csinhl.c: New file.
	* sysdeps/m68k/fpu/s_csinhf.c: New file.

1997-04-03 10:18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* manual/Makefile (dir-add.texi): Simplify.

	* libio/genops.c (_IO_flush_all_linebuffered): Don't flush on
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/fclrexcpt.c40
-rw-r--r--sysdeps/i386/fpu/fegetenv.c27
-rw-r--r--sysdeps/i386/fpu/fegetround.c31
-rw-r--r--sysdeps/i386/fpu/feholdexcpt.c36
-rw-r--r--sysdeps/i386/fpu/fenvbits.h91
-rw-r--r--sysdeps/i386/fpu/fesetenv.c76
-rw-r--r--sysdeps/i386/fpu/fesetround.c38
-rw-r--r--sysdeps/i386/fpu/feupdateenv.c39
-rw-r--r--sysdeps/i386/fpu/fgetexcptflg.c32
-rw-r--r--sysdeps/i386/fpu/fraiseexcpt.c75
-rw-r--r--sysdeps/i386/fpu/fsetexcptflg.c40
-rw-r--r--sysdeps/i386/fpu/ftestexcept.c32
-rw-r--r--sysdeps/i386/fpu/mathbits.h36
-rw-r--r--sysdeps/i386/huge_val.h6
14 files changed, 593 insertions, 6 deletions
diff --git a/sysdeps/i386/fpu/fclrexcpt.c b/sysdeps/i386/fpu/fclrexcpt.c
new file mode 100644
index 0000000000..0b43776f54
--- /dev/null
+++ b/sysdeps/i386/fpu/fclrexcpt.c
@@ -0,0 +1,40 @@
+/* Clear given exceptions in current floating-point environment.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+void
+feclearexcept (int excepts)
+{
+  fenv_t temp;
+
+  /* Mask out unsupported bits/exceptions.  */
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Bah, we have to clear selected exceptions.  Since there is no
+     `fldsw' instruction we have to do it the hard way.  */
+  __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+  /* Clear the relevant bits.  */
+  temp.status_word &= excepts ^ FE_ALL_EXCEPT;
+
+  /* Put the new data in effect.  */
+  __asm__ ("fldenv %0" : : "m" (*&temp));
+}
diff --git a/sysdeps/i386/fpu/fegetenv.c b/sysdeps/i386/fpu/fegetenv.c
new file mode 100644
index 0000000000..452449d044
--- /dev/null
+++ b/sysdeps/i386/fpu/fegetenv.c
@@ -0,0 +1,27 @@
+/* Store current floating-point environment.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+void
+fegetenv (fenv_t *envp)
+{
+  __asm__ ("fnstenv %0" : "=m" (*envp));
+}
diff --git a/sysdeps/i386/fpu/fegetround.c b/sysdeps/i386/fpu/fegetround.c
new file mode 100644
index 0000000000..4dfa32d0b5
--- /dev/null
+++ b/sysdeps/i386/fpu/fegetround.c
@@ -0,0 +1,31 @@
+/* Return current rounding direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+  int cw;
+
+  __asm__ ("fnstcw %0" : "=m" (*&cw));
+
+  return cw & 0xc00;
+}
diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c
new file mode 100644
index 0000000000..c9a0f73489
--- /dev/null
+++ b/sysdeps/i386/fpu/feholdexcpt.c
@@ -0,0 +1,36 @@
+/* Store current floating-point environment and clear exceptions.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+  unsigned short int work;
+
+  /* Store the environment.  */
+  __asm__ ("fnstenv %0" : "=m" (*envp));
+
+  /* Now set all exceptions to non-stop.  */
+  work = envp->control_word | 0x3f;
+  __asm__ ("fldcw %0" : : "m" (*&work));
+
+  return 1;
+}
diff --git a/sysdeps/i386/fpu/fenvbits.h b/sysdeps/i386/fpu/fenvbits.h
new file mode 100644
index 0000000000..bea89a15b1
--- /dev/null
+++ b/sysdeps/i386/fpu/fenvbits.h
@@ -0,0 +1,91 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This file should never be included directly.  */
+
+#ifndef _FENVBITS_H
+#define _FENVBITS_H	1
+
+/* Define bits representing the exception.  We use the bit positions
+   of the appropriate bits in the FPU control word.  */
+enum
+  {
+    FE_INVALID = 0x01,
+#define FE_INVALID	FE_INVALID
+    __FE_DENORM = 0x02,
+    FE_DIVBYZERO = 0x04,
+#define FE_DIVBYZERO	FE_DIVBYZERO
+    FE_OVERFLOW = 0x08,
+#define FE_OVERFLOW	FE_OVERFLOW
+    FE_UNDERFLOW = 0x10,
+#define FE_UNDERFLOW	FE_UNDERFLOW
+    FE_INEXACT = 0x20
+#define FE_INEXACT	FE_INEXACT
+  };
+
+#define FE_ALL_EXCEPT \
+	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The ix87 FPU supports all of the four defined rounding modes.  We
+   use again the bit positions in the FPU control word as the values
+   for the appropriate macros.  */
+enum
+  {
+    FE_TONEAREST = 0,
+#define FE_TONEAREST	FE_TONEAREST
+    FE_DOWNWARD = 0x400,
+#define FE_DOWNWARD	FE_DOWNWARD
+    FE_UPWARD = 0x800,
+#define FE_UPWARD	FE_UPWARD
+    FE_TOWARDSZERO = 0xc00
+#define FE_TOWARDSZERO	FE_TOWARDSZERO
+  };
+
+
+/* Type representing exception flags.  */
+typedef unsigned short int fexcept_t;
+
+
+/* Type representing floating-point environment.  This function corresponds to the layout of the block written by the `fstenv'.  */
+typedef struct
+  {
+    unsigned short int control_word;
+    unsigned short int __unused1;
+    unsigned short int status_word;
+    unsigned short int __unused2;
+    unsigned short int tags;
+    unsigned short int __unused3;
+    unsigned int eip;
+    unsigned short int cs_selector;
+    unsigned int opcode:11;
+    unsigned int __unused4:5;
+    unsigned int data_offset;
+    unsigned short int data_selector;
+    unsigned short int __unused5;
+  }
+fenv_t;
+
+/* If the default argument is used we use this value.  */
+#define FE_DFL_ENV	((fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exception is masked.  */
+# define FE_NOMASK_ENV	((fenv_t *) -2)
+#endif
+
+#endif /* fenvbits.h */
diff --git a/sysdeps/i386/fpu/fesetenv.c b/sysdeps/i386/fpu/fesetenv.c
new file mode 100644
index 0000000000..e7300ea1e6
--- /dev/null
+++ b/sysdeps/i386/fpu/fesetenv.c
@@ -0,0 +1,76 @@
+/* Install given floating-point environment.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+#include <assert.h>
+
+
+void
+fesetenv (const fenv_t *envp)
+{
+  fenv_t temp;
+
+  /* The memory block used by fstenv/fldenv has a size of 28 bytes.  */
+  assert (sizeof (fenv_t) == 28);
+
+  /* Install the environment specified by ENVP.  But there are a few
+     values which we do not want to come from the saved environment.
+     Therefore, we get the current environment and replace the values
+     we want to use from the environment specified by the parameter.  */
+  __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+  if (envp == FE_DFL_ENV)
+    {
+      temp.control_word |= FE_ALL_EXCEPT;
+      temp.control_word &= ~FE_TOWARDSZERO;
+      temp.status_word &= ~FE_ALL_EXCEPT;
+      temp.eip = 0;
+      temp.cs_selector = 0;
+      temp.opcode = 0;
+      temp.data_offset = 0;
+      temp.data_selector = 0;
+    }
+  else if (envp == FE_NOMASK_ENV)
+    {
+      temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO);
+      temp.status_word &= ~FE_ALL_EXCEPT;
+      temp.eip = 0;
+      temp.cs_selector = 0;
+      temp.opcode = 0;
+      temp.data_offset = 0;
+      temp.data_selector = 0;
+    }
+  else
+    {
+      temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO);
+      temp.control_word |= (envp->control_word
+			    & (FE_ALL_EXCEPT | FE_TOWARDSZERO));
+      temp.status_word &= ~FE_ALL_EXCEPT;
+      temp.status_word |= envp->status_word & FE_ALL_EXCEPT;
+      temp.eip = envp->eip;
+      temp.cs_selector = envp->cs_selector;
+      temp.opcode = envp->opcode;
+      temp.data_offset = envp->data_offset;
+      temp.data_selector = envp->data_selector;
+    }
+
+  __asm__ ("fldenv %0" : : "m" (temp));
+}
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c
new file mode 100644
index 0000000000..844c58663e
--- /dev/null
+++ b/sysdeps/i386/fpu/fesetround.c
@@ -0,0 +1,38 @@
+/* Set current rounding direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+int
+fesetround (int round)
+{
+  unsigned short int cw;
+
+  if ((round & ~0xc00) != 0)
+    /* ROUND is no valid rounding mode.  */
+    return 0;
+
+  __asm__ ("fnstcw %0" : "=m" (*&cw));
+  cw &= ~0xc00;
+  cw |= round;
+  __asm__ ("fldcw %0" : : "m" (*&cw));
+
+  return 1;
+}
diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c
new file mode 100644
index 0000000000..0f7abc2344
--- /dev/null
+++ b/sysdeps/i386/fpu/feupdateenv.c
@@ -0,0 +1,39 @@
+/* Install given floating-point environment and raise exceptions.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+void
+feupdateenv (const fenv_t *envp)
+{
+  fexcept_t temp;
+
+  /* Save current exceptions.  */
+  __asm__ ("fnstsw %0" : "=m" (*&temp));
+  temp &= FE_ALL_EXCEPT;
+
+  /* Install new environment.  */
+  fesetenv (envp);
+
+  /* Raise the safed exception.  Incidently for us the implementation
+     defined format of the values in objects of type fexcept_t is the
+     same as the ones specified using the FE_* constants.  */
+  feraiseexcept ((int) temp);
+}
diff --git a/sysdeps/i386/fpu/fgetexcptflg.c b/sysdeps/i386/fpu/fgetexcptflg.c
new file mode 100644
index 0000000000..1db3953eae
--- /dev/null
+++ b/sysdeps/i386/fpu/fgetexcptflg.c
@@ -0,0 +1,32 @@
+/* Store current representation for exceptions.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+void
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+  fexcept_t temp;
+
+  /* Get the current exceptions.  */
+  __asm__ ("fnstsw %0" : "=m" (*&temp));
+
+  *flagp = temp & excepts & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/i386/fpu/fraiseexcpt.c b/sysdeps/i386/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..90e992aaec
--- /dev/null
+++ b/sysdeps/i386/fpu/fraiseexcpt.c
@@ -0,0 +1,75 @@
+/* Raise given exceptions.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+#include <math.h>
+
+void
+feraiseexcept (int excepts)
+{
+  /* Raise exceptions represented by EXPECTS.  But we must raise only
+     one signal at a time.  It is important the if the overflow/underflow
+     exception and the inexact exception are given at the same time,
+     the overflow/underflow exception follows the inexact exception.  */
+
+  /* First: invalid exception.  */
+  if ((FE_INVALID & excepts) != 0)
+    {
+      /* One example of a invalid operation is 0 * Infinity.  */
+      double d = 0.0 * HUGE_VAL;
+      (void) &d;
+      /* Now force the exception.  */
+      __asm__ ("fwait");
+    }
+
+  /* Next: division by zero.  */
+  if ((FE_DIVBYZERO & excepts) != 0)
+    {
+      double d;
+      __asm__ ("fld1; fldz; fdivp %%st, %%st(1); fwait" : "=t" (d));
+      (void) &d;
+    }
+
+  /* Next: overflow.  */
+  if ((FE_OVERFLOW & excepts) != 0)
+    {
+      long double d = LDBL_MAX * LDBL_MAX;
+      (void) &d;
+      /* Now force the exception.  */
+      __asm__ ("fwait");
+    }
+
+  /* Next: underflow.  */
+  if ((FE_UNDERFLOW & excepts) != 0)
+    {
+      long double d = LDBL_MIN / 16.0;
+      (void) &d;
+      /* Now force the exception.  */
+      __asm__ ("fwait");
+    }
+
+  /* Last: inexact.  */
+  if ((FE_INEXACT & excepts) != 0)
+    {
+      long double d;
+      __asm__ ("fld1; fldpi; fdivp %%st, %%st(1); fwait" : "=t" (d));
+      (void) &d;
+    }
+}
diff --git a/sysdeps/i386/fpu/fsetexcptflg.c b/sysdeps/i386/fpu/fsetexcptflg.c
new file mode 100644
index 0000000000..598b8d2233
--- /dev/null
+++ b/sysdeps/i386/fpu/fsetexcptflg.c
@@ -0,0 +1,40 @@
+/* Set floating-point environment exception handling.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+#include <math.h>
+
+void
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+  fenv_t temp;
+
+  /* Get the current environment.  We have to do this since we cannot
+     separately set the status word.  */
+  __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+  temp.status_word &= ~(excepts & FE_ALL_EXCEPT);
+  temp.status_word |= *flagp & excepts & FE_ALL_EXCEPT;
+
+  /* Store the new status word (along with the rest of the environment.
+     Possibly new exceptions are set but they won't get executed unless
+     the next floating-point instruction.  */
+  __asm__ ("fldenv %0" : : "m" (*&temp));
+}
diff --git a/sysdeps/i386/fpu/ftestexcept.c b/sysdeps/i386/fpu/ftestexcept.c
new file mode 100644
index 0000000000..c69170fb2c
--- /dev/null
+++ b/sysdeps/i386/fpu/ftestexcept.c
@@ -0,0 +1,32 @@
+/* Test exception in current environment.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fenv.h>
+
+int
+fetestexcept (int excepts)
+{
+  int temp;
+
+  /* Get current exceptions.  */
+  __asm__ ("fnstsw %0" : "=a" (temp));
+
+  return temp & excepts & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/i386/fpu/mathbits.h b/sysdeps/i386/fpu/mathbits.h
new file mode 100644
index 0000000000..7885afeec0
--- /dev/null
+++ b/sysdeps/i386/fpu/mathbits.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _MATHBITS_H
+#define _MATHBITS_H	1
+
+/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
+   which is also available for the user as `long double'.  Therefore
+   we define:  */
+typedef long double float_t;	/* `float' expressions are evaluated as
+				   `long double'.  */
+typedef long double double_t;	/* `double' expressions are evaluated as
+				   `long double'.  */
+
+/* Signal that both types are `long double'.  */
+#define FLT_EVAL_METHOD	2
+
+/* Define `INFINITY' as value of type `float_t'.  */
+#define INFINITY	HUGE_VALL
+
+#endif /* mathbits.h */
diff --git a/sysdeps/i386/huge_val.h b/sysdeps/i386/huge_val.h
index 0aad84902c..fa071452fb 100644
--- a/sysdeps/i386/huge_val.h
+++ b/sysdeps/i386/huge_val.h
@@ -65,12 +65,6 @@ static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
 #define	HUGE_VALL	(__huge_vall.__ld)
 #endif	/* GCC.  */
 
-
-/* Expression representing positive infinity.  Here it is the same as
-   HUGE_VALF.  */
-#define INFINITY	HUGE_VALF
-
 #endif	/* __USE_ISOC9X.  */
 
-
 #endif	   /* huge_val.h */