Index: trunk/src/emx/src/lib/lgpl/math/cabsl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/math/cabsl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/math/cabsl.c	(revision 2147)
@@ -0,0 +1,29 @@
+/* Return the complex absolute value of long double complex value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+long double
+__cabsl (long double _Complex z)
+{
+  return __hypotl (__real__ z, __imag__ z);
+}
+weak_alias (__cabsl, cabsl)
Index: trunk/src/emx/src/lib/lgpl/math/carg.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/math/carg.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/math/carg.c	(revision 2147)
@@ -0,0 +1,33 @@
+/* Compute argument of complex double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+double
+__carg (__complex__ double x)
+{
+  return __atan2 (__imag__ x, __real__ x);
+}
+weak_alias (__carg, carg)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__carg, __cargl)
+weak_alias (__carg, cargl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/math/cargl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/math/cargl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/math/cargl.c	(revision 2147)
@@ -0,0 +1,29 @@
+/* Compute argument of complex long double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+long double
+__cargl (__complex__ long double x)
+{
+  return __atan2l (__imag__ x, __real__ x);
+}
+weak_alias (__cargl, cargl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/cargf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/cargf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/cargf.c	(revision 2147)
@@ -0,0 +1,29 @@
+/* Compute argument of complex float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+float
+__cargf (__complex__ float x)
+{
+  return __atan2f (__imag__ x, __real__ x);
+}
+weak_alias (__cargf, cargf)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/fpu_control.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/fpu_control.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/fpu_control.c	(revision 2147)
@@ -0,0 +1,25 @@
+/* Default FPU control word initialization.
+   Copyright (C) 1996, 1997, 1999 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fpu_control.h>
+
+/* This module defines `__fpu_control' with the default value.  */
+
+fpu_control_t __fpu_control = _FPU_DEFAULT;
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacos.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacos.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacos.c	(revision 2147)
@@ -0,0 +1,41 @@
+/* Return cosine of complex double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ double
+__cacos (__complex__ double x)
+{
+  __complex__ double y;
+  __complex__ double res;
+
+  y = __casin (x);
+
+  __real__ res = (double) M_PI_2 - __real__ y;
+  __imag__ res = -__imag__ y;
+
+  return res;
+}
+weak_alias (__cacos, cacos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacos, __cacosl)
+weak_alias (__cacos, cacosl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosf.c	(revision 2147)
@@ -0,0 +1,39 @@
+/* Return cosine of complex float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ float
+__cacosf (__complex__ float x)
+{
+  __complex__ float y;
+  __complex__ float res;
+
+  y = __casinf (x);
+
+  __real__ res = (float) M_PI_2 - __real__ y;
+  __imag__ res = -__imag__ y;
+
+  return res;
+}
+#ifndef __cacosf
+weak_alias (__cacosf, cacosf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosh.c	(revision 2147)
@@ -0,0 +1,88 @@
+/* Return arc hyperbole cosine for double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cacosh (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VAL;
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nan ("");
+	  else
+	    __imag__ res = __copysign ((rcls == FP_INFINITE
+					? (__real__ x < 0.0
+					   ? M_PI - M_PI_4 : M_PI_4)
+					: M_PI_2), __imag__ x);
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VAL;
+
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0,
+				       __imag__ x);
+	  else
+	    __imag__ res = __nan ("");
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      __real__ res = 0.0;
+      __imag__ res = __copysign (M_PI_2, __imag__ x);
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrt (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clog (y);
+    }
+
+  return res;
+}
+weak_alias (__cacosh, cacosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacosh, __cacoshl)
+weak_alias (__cacosh, cacoshl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshf.c	(revision 2147)
@@ -0,0 +1,101 @@
+/* Return arc hyperbole cosine for float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+__complex__ float
+__cacoshf (__complex__ float x)
+{
+  __complex__ float res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALF;
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nanf ("");
+	  else
+	    __imag__ res = __copysignf ((rcls == FP_INFINITE
+					 ? (__real__ x < 0.0
+					    ? M_PI - M_PI_4 : M_PI_4)
+					 : M_PI_2), __imag__ x);
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALF;
+
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0,
+					__imag__ x);
+	  else
+	    __imag__ res = __nanf ("");
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      __real__ res = 0.0;
+      __imag__ res = __copysignf (M_PI_2, __imag__ x);
+    }
+  else
+    {
+#if 1
+      __complex__ float y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrtf (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clogf (y);
+#else
+      float re2 = __real__ x * __real__ x;
+      float im2 = __imag__ x * __imag__ x;
+      float sq = re2 - im2 - 1.0;
+      float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
+      float a = __ieee754_sqrtf ((sq + ro) / 2.0);
+      float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
+
+      __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
+					   + im2 + __imag__ x * 2 * b
+					   + ro);
+      __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
+#endif
+    }
+
+  return res;
+}
+#ifndef __cacoshf
+weak_alias (__cacoshf, cacoshf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacoshl.c	(revision 2147)
@@ -0,0 +1,84 @@
+/* Return arc hyperbole cosine for long double value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cacoshl (__complex__ long double x)
+{
+  __complex__ long double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALL;
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nanl ("");
+	  else
+	    __imag__ res = __copysignl ((rcls == FP_INFINITE
+					 ? (__real__ x < 0.0
+					    ? M_PIl - M_PI_4l : M_PI_4l)
+					 : M_PI_2l), __imag__ x);
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALL;
+
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0,
+					__imag__ x);
+	  else
+	    __imag__ res = __nanl ("");
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      __real__ res = 0.0;
+      __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+    }
+  else
+    {
+      __complex__ long double y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrtl (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clogl (y);
+    }
+
+  return res;
+}
+weak_alias (__cacoshl, cacoshl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cacosl.c	(revision 2147)
@@ -0,0 +1,37 @@
+/* Return cosine of complex long double value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ long double
+__cacosl (__complex__ long double x)
+{
+  __complex__ long double y;
+  __complex__ long double res;
+
+  y = __casinl (x);
+
+  __real__ res = M_PI_2l - __real__ y;
+  __imag__ res = -__imag__ y;
+
+  return res;
+}
+weak_alias (__cacosl, cacosl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casin.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casin.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casin.c	(revision 2147)
@@ -0,0 +1,66 @@
+/* Return arc sine of complex double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casin (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (isnan (__real__ x) || isnan (__imag__ x))
+    {
+      if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else if (__isinf (__real__ x) || __isinf (__imag__ x))
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      y = __casinh (y);
+
+      __real__ res = __imag__ y;
+      __imag__ res = -__real__ y;
+    }
+
+  return res;
+}
+weak_alias (__casin, casin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casin, __casinl)
+weak_alias (__casin, casinl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinf.c	(revision 2147)
@@ -0,0 +1,64 @@
+/* Return arc sine of complex float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (isnan (__real__ x) || isnan (__imag__ x))
+    {
+      if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else if (__isinff (__real__ x) || __isinff (__imag__ x))
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else
+    {
+      __complex__ float y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      y = __casinhf (y);
+
+      __real__ res = __imag__ y;
+      __imag__ res = -__real__ y;
+    }
+
+  return res;
+}
+#ifndef __casinf
+weak_alias (__casinf, casinf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinh.c	(revision 2147)
@@ -0,0 +1,84 @@
+/* Return arc hyperbole sine for double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casinh (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (HUGE_VAL, __real__ x);
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nan ("");
+	  else
+	    __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+				       __imag__ x);
+	}
+      else if (rcls <= FP_INFINITE)
+	{
+	  __real__ res = __real__ x;
+	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+	      || (rcls == FP_NAN && icls == FP_ZERO))
+	    __imag__ res = __copysign (0.0, __imag__ x);
+	  else
+	    __imag__ res = __nan ("");
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrt (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clog (y);
+    }
+
+  return res;
+}
+weak_alias (__casinh, casinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casinh, __casinhl)
+weak_alias (__casinh, casinhl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhf.c	(revision 2147)
@@ -0,0 +1,82 @@
+/* Return arc hyperbole sine for float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinhf (__complex__ float x)
+{
+  __complex__ float res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysignf (HUGE_VALF, __real__ x);
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nanf ("");
+	  else
+	    __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+					__imag__ x);
+	}
+      else if (rcls <= FP_INFINITE)
+	{
+	  __real__ res = __real__ x;
+	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+	      || (rcls == FP_NAN && icls == FP_ZERO))
+	    __imag__ res = __copysignf (0.0, __imag__ x);
+	  else
+	    __imag__ res = __nanf ("");
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __complex__ float y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrtf (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clogf (y);
+    }
+
+  return res;
+}
+#ifndef __casinhf
+weak_alias (__casinhf, casinhf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinhl.c	(revision 2147)
@@ -0,0 +1,80 @@
+/* Return arc hyperbole sine for long double value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinhl (__complex__ long double x)
+{
+  __complex__ long double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysignl (HUGE_VALL, __real__ x);
+
+	  if (rcls == FP_NAN)
+	    __imag__ res = __nanl ("");
+	  else
+	    __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
+					__imag__ x);
+	}
+      else if (rcls <= FP_INFINITE)
+	{
+	  __real__ res = __real__ x;
+	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+	      || (rcls == FP_NAN && icls == FP_ZERO))
+	    __imag__ res = __copysignl (0.0, __imag__ x);
+	  else
+	    __imag__ res = __nanl ("");
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      __complex__ long double y;
+
+      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+      __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+      y = __csqrtl (y);
+
+      __real__ y += __real__ x;
+      __imag__ y += __imag__ x;
+
+      res = __clogl (y);
+    }
+
+  return res;
+}
+weak_alias (__casinhl, casinhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_casinl.c	(revision 2147)
@@ -0,0 +1,62 @@
+/* Return arc sine of complex long double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (isnan (__real__ x) || isnan (__imag__ x))
+    {
+      if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else
+    {
+      __complex__ long double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      y = __casinhl (y);
+
+      __real__ res = __imag__ y;
+      __imag__ res = -__real__ y;
+    }
+
+  return res;
+}
+weak_alias (__casinl, casinl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catan.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catan.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catan.c	(revision 2147)
@@ -0,0 +1,89 @@
+/* Return arc tangent of complex double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catan (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (rcls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (M_PI_2, __real__ x);
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (icls == FP_INFINITE)
+	{
+	  if (rcls >= FP_ZERO)
+	    __real__ res = __copysign (M_PI_2, __real__ x);
+	  else
+	    __real__ res = __nan ("");
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (icls == FP_ZERO || icls == FP_INFINITE)
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      double r2, num, den;
+
+      r2 = __real__ x * __real__ x;
+
+      den = 1 - r2 - __imag__ x * __imag__ x;
+
+      __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
+
+      num = __imag__ x + 1.0;
+      num = r2 + num * num;
+
+      den = __imag__ x - 1.0;
+      den = r2 + den * den;
+
+      __imag__ res = 0.25 * __ieee754_log (num / den);
+    }
+
+  return res;
+}
+weak_alias (__catan, catan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catan, __catanl)
+weak_alias (__catan, catanl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanf.c	(revision 2147)
@@ -0,0 +1,87 @@
+/* Return arc tangent of complex float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanf (__complex__ float x)
+{
+  __complex__ float res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (rcls == FP_INFINITE)
+	{
+	  __real__ res = __copysignf (M_PI_2, __real__ x);
+	  __imag__ res = __copysignf (0.0, __imag__ x);
+	}
+      else if (icls == FP_INFINITE)
+	{
+	  if (rcls >= FP_ZERO)
+	    __real__ res = __copysignf (M_PI_2, __real__ x);
+	  else
+	    __real__ res = __nanf ("");
+	  __imag__ res = __copysignf (0.0, __imag__ x);
+	}
+      else if (icls == FP_ZERO || icls == FP_INFINITE)
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __copysignf (0.0, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      float r2, num, den;
+
+      r2 = __real__ x * __real__ x;
+
+      den = 1 - r2 - __imag__ x * __imag__ x;
+
+      __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
+
+      num = __imag__ x + 1.0;
+      num = r2 + num * num;
+
+      den = __imag__ x - 1.0;
+      den = r2 + den * den;
+
+      __imag__ res = 0.25 * __ieee754_logf (num / den);
+    }
+
+  return res;
+}
+#ifndef __catanf
+weak_alias (__catanf, catanf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanh.c	(revision 2147)
@@ -0,0 +1,84 @@
+/* Return arc hyperbole tangent for double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catanh (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysign (0.0, __real__ x);
+	  __imag__ res = __copysign (M_PI_2, __imag__ x);
+	}
+      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+	{
+	  __real__ res = __copysign (0.0, __real__ x);
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysign (M_PI_2, __imag__ x);
+	  else
+	    __imag__ res = __nan ("");
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      double i2, num, den;
+
+      i2 = __imag__ x * __imag__ x;
+
+      num = 1.0 + __real__ x;
+      num = i2 + num * num;
+
+      den = 1.0 - __real__ x;
+      den = i2 + den * den;
+
+      __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
+
+      den = 1 - __real__ x * __real__ x - i2;
+
+      __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
+    }
+
+  return res;
+}
+weak_alias (__catanh, catanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catanh, __catanhl)
+weak_alias (__catanh, catanhl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhf.c	(revision 2147)
@@ -0,0 +1,82 @@
+/* Return arc hyperbole tangent for float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanhf (__complex__ float x)
+{
+  __complex__ float res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysignf (0.0, __real__ x);
+	  __imag__ res = __copysignf (M_PI_2, __imag__ x);
+	}
+      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+	{
+	  __real__ res = __copysignf (0.0, __real__ x);
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysignf (M_PI_2, __imag__ x);
+	  else
+	    __imag__ res = __nanf ("");
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      float i2, num, den;
+
+      i2 = __imag__ x * __imag__ x;
+
+      num = 1.0 + __real__ x;
+      num = i2 + num * num;
+
+      den = 1.0 - __real__ x;
+      den = i2 + den * den;
+
+      __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
+
+      den = 1 - __real__ x * __real__ x - i2;
+
+      __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
+    }
+
+  return res;
+}
+#ifndef __catanhf
+weak_alias (__catanhf, catanhf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanhl.c	(revision 2147)
@@ -0,0 +1,80 @@
+/* Return arc hyperbole tangent for long double value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanhl (__complex__ long double x)
+{
+  __complex__ long double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = __copysignl (0.0, __real__ x);
+	  __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+	}
+      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+	{
+	  __real__ res = __copysignl (0.0, __real__ x);
+	  if (icls >= FP_ZERO)
+	    __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+	  else
+	    __imag__ res = __nanl ("");
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      long double i2, num, den;
+
+      i2 = __imag__ x * __imag__ x;
+
+      num = 1.0 + __real__ x;
+      num = i2 + num * num;
+
+      den = 1.0 - __real__ x;
+      den = i2 + den * den;
+
+      __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
+
+      den = 1 - __real__ x * __real__ x - i2;
+
+      __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
+    }
+
+  return res;
+}
+weak_alias (__catanhl, catanhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_catanl.c	(revision 2147)
@@ -0,0 +1,85 @@
+/* Return arc tangent of complex long double value.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanl (__complex__ long double x)
+{
+  __complex__ long double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (rcls == FP_INFINITE)
+	{
+	  __real__ res = __copysignl (M_PI_2l, __real__ x);
+	  __imag__ res = __copysignl (0.0, __imag__ x);
+	}
+      else if (icls == FP_INFINITE)
+	{
+	  if (rcls >= FP_ZERO)
+	    __real__ res = __copysignl (M_PI_2l, __real__ x);
+	  else
+	    __real__ res = __nanl ("");
+	  __imag__ res = __copysignl (0.0, __imag__ x);
+	}
+      else if (icls == FP_ZERO || icls == FP_INFINITE)
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __copysignl (0.0, __imag__ x);
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      res = x;
+    }
+  else
+    {
+      long double r2, num, den;
+
+      r2 = __real__ x * __real__ x;
+
+      den = 1 - r2 - __imag__ x * __imag__ x;
+
+      __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
+
+      num = __imag__ x + 1.0;
+      num = r2 + num * num;
+
+      den = __imag__ x - 1.0;
+      den = r2 + den * den;
+
+      __imag__ res = 0.25 * __ieee754_logl (num / den);
+    }
+
+  return res;
+}
+weak_alias (__catanl, catanl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccos.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccos.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccos.c	(revision 2147)
@@ -0,0 +1,80 @@
+/* Return cosine of complex double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ double
+__ccos (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!isfinite (__real__ x) || __isnan (__imag__ x))
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+	  if (__isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else if (__isinf (__imag__ x))
+	{
+	  __real__ res = HUGE_VAL;
+	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (__isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (isfinite (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = __ccosh (y);
+    }
+
+  return res;
+}
+weak_alias (__ccos, ccos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccos, __ccosl)
+weak_alias (__ccos, ccosl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosf.c	(revision 2147)
@@ -0,0 +1,78 @@
+/* Return cosine of complex float value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ float
+__ccosf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!isfinite (__real__ x) || __isnanf (__imag__ x))
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+	  if (__isinff (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else if (__isinff (__imag__ x))
+	{
+	  __real__ res = HUGE_VALF;
+	  __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (__isinff (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (isfinite (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __complex__ float y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = __ccoshf (y);
+    }
+
+  return res;
+}
+#ifndef __ccosf
+weak_alias (__ccosf, ccosf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosh.c	(revision 2147)
@@ -0,0 +1,105 @@
+/* Complex cosine hyperbole function for double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ccosh (__complex__ double x)
+{
+  __complex__ double retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  double sinh_val = __ieee754_sinh (__real__ x);
+	  double cosh_val = __ieee754_cosh (__real__ x);
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
+	}
+      else
+	{
+	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
+	  __real__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = HUGE_VAL;
+	  __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysign (HUGE_VAL, cosix);
+	  __imag__ retval = (__copysign (HUGE_VAL, sinix)
+			     * __copysign (1.0, __real__ x));
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VAL;
+	  __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nan ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+    }
+
+  return retval;
+}
+weak_alias (__ccosh, ccosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccosh, __ccoshl)
+weak_alias (__ccosh, ccoshl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshf.c	(revision 2147)
@@ -0,0 +1,103 @@
+/* Complex cosine hyperbole function for float.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ccoshf (__complex__ float x)
+{
+  __complex__ float retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float sinh_val = __ieee754_sinhf (__real__ x);
+	  float cosh_val = __ieee754_coshf (__real__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
+	}
+      else
+	{
+	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
+	  __real__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = HUGE_VALF;
+	  __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignf (HUGE_VALF, cosix);
+	  __imag__ retval = (__copysignf (HUGE_VALF, sinix)
+			     * __copysignf (1.0, __real__ x));
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VALF;
+	  __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nanf ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+    }
+
+  return retval;
+}
+#ifndef __ccoshf
+weak_alias (__ccoshf, ccoshf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccoshl.c	(revision 2147)
@@ -0,0 +1,101 @@
+/* Complex cosine hyperbole function for long double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ccoshl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double sinh_val = __ieee754_sinhl (__real__ x);
+	  long double cosh_val = __ieee754_coshl (__real__ x);
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
+	}
+      else
+	{
+	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
+	  __real__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = HUGE_VALL;
+	  __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignl (HUGE_VALL, cosix);
+	  __imag__ retval = (__copysignl (HUGE_VALL, sinix)
+			     * __copysignl (1.0, __real__ x));
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VALL;
+	  __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nanl ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+    }
+
+  return retval;
+}
+weak_alias (__ccoshl, ccoshl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ccosl.c	(revision 2147)
@@ -0,0 +1,76 @@
+/* Return cosine of complex long double value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ long double
+__ccosl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!isfinite (__real__ x) || __isnanl (__imag__ x))
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+	  if (__isinfl (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else if (__isinfl (__imag__ x))
+	{
+	  __real__ res = HUGE_VALL;
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (__isinfl (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (isfinite (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __complex__ long double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = __ccoshl (y);
+    }
+
+  return res;
+}
+weak_alias (__ccosl, ccosl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpf.c	(revision 2147)
@@ -0,0 +1,125 @@
+/* Return value of complex exponential function for float complex value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__cexpf (__complex__ float x)
+{
+  __complex__ float retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float exp_val = __ieee754_expf (__real__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  if (isfinite (exp_val))
+	    {
+	      __real__ retval = exp_val * cosix;
+	      __imag__ retval = exp_val * sinix;
+	    }
+	  else
+	    {
+	      __real__ retval = __copysignf (exp_val, cosix);
+	      __imag__ retval = __copysignf (exp_val, sinix);
+	    }
+	}
+      else
+	{
+	  /* If the imaginary part is +-inf or NaN and the real part
+	     is not +-inf the result is NaN + iNaN.  */
+	  __real__ retval = __nanf ("");
+	  __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	  feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
+
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = value;
+	      __imag__ retval = __imag__ x;
+	    }
+	  else
+	    {
+	      float sinix, cosix;
+
+	      __sincosf (__imag__ x, &sinix, &cosix);
+
+	      __real__ retval = __copysignf (value, cosix);
+	      __imag__ retval = __copysignf (value, sinix);
+	    }
+	}
+      else if (signbit (__real__ x) == 0)
+	{
+	  __real__ retval = HUGE_VALF;
+	  __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else
+	{
+	  __real__ retval = 0.0;
+	  __imag__ retval = __copysignf (0.0, __imag__ x);
+	}
+    }
+  else
+    {
+      /* If the real part is NaN the result is NaN + iNaN.  */
+      __real__ retval = __nanf ("");
+      __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+      if (rcls != FP_NAN || icls != FP_NAN)
+	feraiseexcept (FE_INVALID);
+#endif
+    }
+
+  return retval;
+}
+#ifndef __cexpf
+weak_alias (__cexpf, cexpf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cexpl.c	(revision 2147)
@@ -0,0 +1,123 @@
+/* Return value of complex exponential function for long double complex value.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__cexpl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double exp_val = __ieee754_expl (__real__ x);
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  if (isfinite (exp_val))
+	    {
+	      __real__ retval = exp_val * cosix;
+	      __imag__ retval = exp_val * sinix;
+	    }
+	  else
+	    {
+	      __real__ retval = __copysignl (exp_val, cosix);
+	      __imag__ retval = __copysignl (exp_val, sinix);
+	    }
+	}
+      else
+	{
+	  /* If the imaginary part is +-inf or NaN and the real part
+	     is not +-inf the result is NaN + iNaN.  */
+	  __real__ retval = __nanl ("");
+	  __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+	  feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
+
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = value;
+	      __imag__ retval = __imag__ x;
+	    }
+	  else
+	    {
+	      long double sinix, cosix;
+
+	      __sincosl (__imag__ x, &sinix, &cosix);
+
+	      __real__ retval = __copysignl (value, cosix);
+	      __imag__ retval = __copysignl (value, sinix);
+	    }
+	}
+      else if (signbit (__real__ x) == 0)
+	{
+	  __real__ retval = HUGE_VALL;
+	  __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+      else
+	{
+	  __real__ retval = 0.0;
+	  __imag__ retval = __copysignl (0.0, __imag__ x);
+	}
+    }
+  else
+    {
+      /* If the real part is NaN the result is NaN + iNaN.  */
+      __real__ retval = __nanl ("");
+      __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+      if (rcls != FP_NAN || icls != FP_NAN)
+	feraiseexcept (FE_INVALID);
+#endif
+    }
+
+  return retval;
+}
+weak_alias (__cexpl, cexpl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog.c	(revision 2147)
@@ -0,0 +1,65 @@
+/* Compute complex natural logarithm.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog (__complex__ double x)
+{
+  __complex__ double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysign (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabs (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
+							__imag__ x));
+      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nan ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VAL;
+      else
+	__real__ result = __nan ("");
+    }
+
+  return result;
+}
+weak_alias (__clog, clog)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog, __clogl)
+weak_alias (__clog, clogl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10.c	(revision 2147)
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog10 (__complex__ double x)
+{
+  __complex__ double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysign (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabs (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
+							  __imag__ x));
+      __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nan ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VAL;
+      else
+	__real__ result = __nan ("");
+    }
+
+  return result;
+}
+weak_alias (__clog10, clog10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog10, __clog10l)
+weak_alias (__clog10, clog10l)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10f.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10f.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10f.c	(revision 2147)
@@ -0,0 +1,63 @@
+/* Compute complex base 10 logarithm.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clog10f (__complex__ float x)
+{
+  __complex__ float result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysignf (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsf (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
+							    __imag__ x));
+      __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanf ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALF;
+      else
+	__real__ result = __nanf ("");
+    }
+
+  return result;
+}
+#ifndef __clog10f
+weak_alias (__clog10f, clog10f)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10l.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10l.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clog10l.c	(revision 2147)
@@ -0,0 +1,61 @@
+/* Compute complex base 10 logarithm.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clog10l (__complex__ long double x)
+{
+  __complex__ long double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+      __imag__ result = __copysignl (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsl (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
+							    __imag__ x));
+      __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanl ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALL;
+      else
+	__real__ result = __nanl ("");
+    }
+
+  return result;
+}
+weak_alias (__clog10l, clog10l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogf.c	(revision 2147)
@@ -0,0 +1,63 @@
+/* Compute complex natural logarithm.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clogf (__complex__ float x)
+{
+  __complex__ float result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysignf (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsf (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
+							  __imag__ x));
+      __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanf ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALF;
+      else
+	__real__ result = __nanf ("");
+    }
+
+  return result;
+}
+#ifndef __clogf
+weak_alias (__clogf, clogf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_clogl.c	(revision 2147)
@@ -0,0 +1,61 @@
+/* Compute complex natural logarithm.
+   Copyright (C) 1997, 1998 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clogl (__complex__ long double x)
+{
+  __complex__ long double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+      __imag__ result = __copysignl (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsl (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
+							  __imag__ x));
+      __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanl ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALL;
+      else
+	__real__ result = __nanl ("");
+    }
+
+  return result;
+}
+weak_alias (__clogl, clogl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpow.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpow.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpow.c	(revision 2147)
@@ -0,0 +1,34 @@
+/* Complex power of double values.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cpow (__complex__ double x, __complex__ double c)
+{
+  return __cexp (c * __clog (x));
+}
+weak_alias (__cpow, cpow)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cpow, __cpowl)
+weak_alias (__cpow, cpowl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowf.c	(revision 2147)
@@ -0,0 +1,32 @@
+/* Complex power of float values.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cpowf (__complex__ float x, __complex__ float c)
+{
+  return __cexpf (c * __clogf (x));
+}
+#ifndef __cpowf
+weak_alias (__cpowf, cpowf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cpowl.c	(revision 2147)
@@ -0,0 +1,30 @@
+/* Complex power of long double values.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cpowl (__complex__ long double x, __complex__ long double c)
+{
+  return __cexpl (c * __clogl (x));
+}
+weak_alias (__cpowl, cpowl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cproj.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cproj.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cproj.c	(revision 2147)
@@ -0,0 +1,51 @@
+/* Compute projection of complex double value to Riemann sphere.
+   Copyright (C) 1997, 1999 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cproj (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (isnan (__real__ x) && isnan (__imag__ x))
+    return x;
+  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysign (0.0, __imag__ x);
+    }
+  else
+    {
+      double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__cproj, cproj)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cproj, __cprojl)
+weak_alias (__cproj, cprojl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojf.c	(revision 2147)
@@ -0,0 +1,49 @@
+/* Compute projection of complex float value to Riemann sphere.
+   Copyright (C) 1997, 1999 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cprojf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (isnan (__real__ x) && isnan (__imag__ x))
+    return x;
+  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysignf (0.0, __imag__ x);
+    }
+  else
+    {
+      float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+#ifndef __cprojf
+weak_alias (__cprojf, cprojf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_cprojl.c	(revision 2147)
@@ -0,0 +1,48 @@
+/* Compute projection of complex long double value to Riemann sphere.
+   Copyright (C) 1997, 1999 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (isnan (__real__ x) && isnan (__imag__ x))
+    return x;
+  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysignl (0.0, __imag__ x);
+    }
+  else
+    {
+      long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
+			 + 1.0);
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__cprojl, cprojl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csin.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csin.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csin.c	(revision 2147)
@@ -0,0 +1,131 @@
+/* Complex sine function for double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csin (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (icls >= FP_ZERO)
+    {
+      /* Imaginary part is finite.  */
+      if (rcls >= FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  double sinh_val = __ieee754_sinh (__imag__ x);
+	  double cosh_val = __ieee754_cosh (__imag__ x);
+	  double sinix, cosix;
+
+	  __sincos (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * sinix;
+	  __imag__ retval = sinh_val * cosix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+	      if (rcls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (icls == FP_INFINITE)
+    {
+      /* Imaginary part is infinite.  */
+      if (rcls == FP_ZERO)
+	{
+	  /* Real part is 0.0.  */
+	  __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	  __imag__ retval = __imag__ x;
+	}
+      else if (rcls > FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  double sinix, cosix;
+
+	  __sincos (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysign (HUGE_VAL, sinix);
+	  __imag__ retval = __copysign (HUGE_VAL, cosix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	  if (signbit (__imag__ x))
+	    __imag__ retval = -__imag__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = __nan ("");
+	  __imag__ retval = HUGE_VAL;
+
+#ifdef FE_INVALID
+	  if (rcls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      if (rcls == FP_ZERO)
+	__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+      else
+	__real__ retval = __nan ("");
+      __imag__ retval = __nan ("");
+    }
+
+  return retval;
+}
+weak_alias (__csin, csin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csin, __csinl)
+weak_alias (__csin, csinl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinf.c	(revision 2147)
@@ -0,0 +1,129 @@
+/* Complex sine function for float.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinf (__complex__ float x)
+{
+  __complex__ float retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabsf (__real__ x);
+
+  if (icls >= FP_ZERO)
+    {
+      /* Imaginary part is finite.  */
+      if (rcls >= FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  float sinh_val = __ieee754_sinhf (__imag__ x);
+	  float cosh_val = __ieee754_coshf (__imag__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * sinix;
+	  __imag__ retval = sinh_val * cosix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = __nanf ("");
+	      __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+	      if (rcls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nanf ("");
+	      __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (icls == FP_INFINITE)
+    {
+      /* Imaginary part is infinite.  */
+      if (rcls == FP_ZERO)
+	{
+	  /* Real part is 0.0.  */
+	  __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+	  __imag__ retval = __imag__ x;
+	}
+      else if (rcls > FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  float sinix, cosix;
+
+	  __sincosf (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignf (HUGE_VALF, sinix);
+	  __imag__ retval = __copysignf (HUGE_VALF, cosix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	  if (signbit (__imag__ x))
+	    __imag__ retval = -__imag__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = __nanf ("");
+	  __imag__ retval = HUGE_VALF;
+
+#ifdef FE_INVALID
+	  if (rcls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      if (rcls == FP_ZERO)
+	__real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+      else
+	__real__ retval = __nanf ("");
+      __imag__ retval = __nanf ("");
+    }
+
+  return retval;
+}
+#ifndef __csinf
+weak_alias (__csinf, csinf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinh.c	(revision 2147)
@@ -0,0 +1,126 @@
+/* Complex sine hyperbole function for double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csinh (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  double sinh_val = __ieee754_sinh (__real__ x);
+	  double cosh_val = __ieee754_cosh (__real__ x);
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (rcls == FP_ZERO)
+	    {
+	      /* Real part is 0.0.  */
+	      __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+	      __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+	      if (icls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nan ("");
+	      __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+	  __imag__ retval = __imag__ x;
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysign (HUGE_VAL, cosix);
+	  __imag__ retval = __copysign (HUGE_VAL, sinix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VAL;
+	  __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nan ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+    }
+
+  return retval;
+}
+weak_alias (__csinh, csinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csinh, __csinhl)
+weak_alias (__csinh, csinhl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhf.c	(revision 2147)
@@ -0,0 +1,124 @@
+/* Complex sine hyperbole function for float.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinhf (__complex__ float x)
+{
+  __complex__ float retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabsf (__real__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float sinh_val = __ieee754_sinhf (__real__ x);
+	  float cosh_val = __ieee754_coshf (__real__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (rcls == FP_ZERO)
+	    {
+	      /* Real part is 0.0.  */
+	      __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+	      __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+	      if (icls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nanf ("");
+	      __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
+	  __imag__ retval = __imag__ x;
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignf (HUGE_VALF, cosix);
+	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VALF;
+	  __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nanf ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+    }
+
+  return retval;
+}
+#ifndef __csinhf
+weak_alias (__csinhf, csinhf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinhl.c	(revision 2147)
@@ -0,0 +1,122 @@
+/* Complex sine hyperbole function for long double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinhl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabsl (__real__ x);
+
+  if (rcls >= FP_ZERO)
+    {
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double sinh_val = __ieee754_sinhl (__real__ x);
+	  long double cosh_val = __ieee754_coshl (__real__ x);
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (rcls == FP_ZERO)
+	    {
+	      /* Real part is 0.0.  */
+	      __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+	      __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	      if (icls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nanl ("");
+	      __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (rcls == FP_INFINITE)
+    {
+      /* Real part is infinite.  */
+      if (icls == FP_ZERO)
+	{
+	  /* Imaginary part is 0.0.  */
+	  __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
+	  __imag__ retval = __imag__ x;
+	}
+      else if (icls > FP_ZERO)
+	{
+	  /* Imaginary part is finite.  */
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignl (HUGE_VALL, cosix);
+	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = HUGE_VALL;
+	  __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      __real__ retval = __nanl ("");
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+    }
+
+  return retval;
+}
+weak_alias (__csinhl, csinhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csinl.c	(revision 2147)
@@ -0,0 +1,127 @@
+/* Complex sine function for long double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int negate = signbit (__real__ x);
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  __real__ x = fabsl (__real__ x);
+
+  if (icls >= FP_ZERO)
+    {
+      /* Imaginary part is finite.  */
+      if (rcls >= FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  long double sinh_val = __ieee754_sinhl (__imag__ x);
+	  long double cosh_val = __ieee754_coshl (__imag__ x);
+	  long double sinix, cosix;
+
+	  __sincosl (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * sinix;
+	  __imag__ retval = sinh_val * cosix;
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	}
+      else
+	{
+	  if (icls == FP_ZERO)
+	    {
+	      /* Imaginary part is 0.0.  */
+	      __real__ retval = __nanl ("");
+	      __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+	      if (rcls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
+	  else
+	    {
+	      __real__ retval = __nanl ("");
+	      __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
+	    }
+	}
+    }
+  else if (icls == FP_INFINITE)
+    {
+      /* Imaginary part is infinite.  */
+      if (rcls == FP_ZERO)
+	{
+	  /* Real part is 0.0.  */
+	  __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+	  __imag__ retval = __imag__ x;
+	}
+      else if (rcls > FP_ZERO)
+	{
+	  /* Real part is finite.  */
+	  long double sinix, cosix;
+
+	  __sincosl (__real__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignl (HUGE_VALL, sinix);
+	  __imag__ retval = __copysignl (HUGE_VALL, cosix);
+
+	  if (negate)
+	    __real__ retval = -__real__ retval;
+	  if (signbit (__imag__ x))
+	    __imag__ retval = -__imag__ retval;
+	}
+      else
+	{
+	  /* The addition raises the invalid exception.  */
+	  __real__ retval = __nanl ("");
+	  __imag__ retval = HUGE_VALL;
+
+#ifdef FE_INVALID
+	  if (rcls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      if (rcls == FP_ZERO)
+	__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+      else
+	__real__ retval = __nanl ("");
+      __imag__ retval = __nanl ("");
+    }
+
+  return retval;
+}
+weak_alias (__csinl, csinl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrt.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrt.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrt.c	(revision 2147)
@@ -0,0 +1,114 @@
+/* Complex square root of double value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csqrt (__complex__ double x)
+{
+  __complex__ double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VAL;
+	  __imag__ res = __imag__ x;
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = icls == FP_NAN ? __nan ("") : 0;
+	      __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = __real__ x;
+	      __imag__ res = (icls == FP_NAN
+			      ? __nan ("") : __copysign (0.0, __imag__ x));
+	    }
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+	}
+    }
+  else
+    {
+      if (icls == FP_ZERO)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = 0.0;
+	      __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
+					 __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = fabs (__ieee754_sqrt (__real__ x));
+	      __imag__ res = __copysign (0.0, __imag__ x);
+	    }
+	}
+      else if (rcls == FP_ZERO)
+	{
+	  double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
+
+	  __real__ res = __copysign (r, __imag__ x);
+	  __imag__ res = r;
+	}
+      else
+	{
+	  double d, r, s;
+
+	  d = __ieee754_hypot (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x);
+	      s = (0.5 * __imag__ x) / r;
+	    }
+	  else
+	    {
+	      s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
+	      r = fabs ((0.5 * __imag__ x) / s);
+	    }
+
+	  __real__ res = r;
+	  __imag__ res = __copysign (s, __imag__ x);
+	}
+    }
+
+  return res;
+}
+weak_alias (__csqrt, csqrt)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csqrt, __csqrtl)
+weak_alias (__csqrt, csqrtl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtf.c	(revision 2147)
@@ -0,0 +1,112 @@
+/* Complex square root of float value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csqrtf (__complex__ float x)
+{
+  __complex__ float res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALF;
+	  __imag__ res = __imag__ x;
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = icls == FP_NAN ? __nanf ("") : 0;
+	      __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = __real__ x;
+	      __imag__ res = (icls == FP_NAN
+			      ? __nanf ("") : __copysignf (0.0, __imag__ x));
+	    }
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+	}
+    }
+  else
+    {
+      if (icls == FP_ZERO)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = 0.0;
+	      __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
+					  __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
+	      __imag__ res = __copysignf (0.0, __imag__ x);
+	    }
+	}
+      else if (rcls == FP_ZERO)
+	{
+	  float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
+
+	  __real__ res = __copysignf (r, __imag__ x);
+	  __imag__ res = r;
+	}
+      else
+	{
+	  float d, r, s;
+
+	  d = __ieee754_hypotf (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x);
+	      s = (0.5f * __imag__ x) / r;
+	    }
+	  else
+	    {
+	      s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
+	      r = fabsf ((0.5f * __imag__ x) / s);
+	    }
+
+	  __real__ res = r;
+	  __imag__ res = __copysignf (s, __imag__ x);
+	}
+    }
+
+  return res;
+}
+#ifndef __csqrtf
+weak_alias (__csqrtf, csqrtf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_csqrtl.c	(revision 2147)
@@ -0,0 +1,110 @@
+/* Complex square root of long double value.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csqrtl (__complex__ long double x)
+{
+  __complex__ long double res;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+    {
+      if (icls == FP_INFINITE)
+	{
+	  __real__ res = HUGE_VALL;
+	  __imag__ res = __imag__ x;
+	}
+      else if (rcls == FP_INFINITE)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = icls == FP_NAN ? __nanl ("") : 0;
+	      __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = __real__ x;
+	      __imag__ res = (icls == FP_NAN
+			      ? __nanl ("") : __copysignl (0.0, __imag__ x));
+	    }
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+	}
+    }
+  else
+    {
+      if (icls == FP_ZERO)
+	{
+	  if (__real__ x < 0.0)
+	    {
+	      __real__ res = 0.0;
+	      __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
+					  __imag__ x);
+	    }
+	  else
+	    {
+	      __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
+	      __imag__ res = __copysignl (0.0, __imag__ x);
+	    }
+	}
+      else if (rcls == FP_ZERO)
+	{
+	  long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
+
+	  __real__ res = __copysignl (r, __imag__ x);
+	  __imag__ res = r;
+	}
+      else
+	{
+	  long double d, r, s;
+
+	  d = __ieee754_hypotl (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
+	      s = (0.5L * __imag__ x) / r;
+	    }
+	  else
+	    {
+	      s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
+	      r = fabsl ((0.5L * __imag__ x) / s);
+	    }
+
+	  __real__ res = r;
+	  __imag__ res = __copysignl (s, __imag__ x);
+	}
+    }
+
+  return res;
+}
+weak_alias (__csqrtl, csqrtl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctan.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctan.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctan.c	(revision 2147)
@@ -0,0 +1,74 @@
+/* Complex tangent function for double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctan (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinf (__imag__ x))
+	{
+	  __real__ res = __copysign (0.0, __real__ x);
+	  __imag__ res = __copysign (1.0, __imag__ x);
+	}
+      else if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (__isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      double sin2rx, cos2rx;
+      double den;
+
+      __sincos (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_cosh (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__ctan, ctan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctan, __ctanl)
+weak_alias (__ctan, ctanl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanf.c	(revision 2147)
@@ -0,0 +1,72 @@
+/* Complex tangent function for float.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinff (__imag__ x))
+	{
+	  __real__ res = __copysignf (0.0, __real__ x);
+	  __imag__ res = __copysignf (1.0, __imag__ x);
+	}
+      else if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (__isinff (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      float sin2rx, cos2rx;
+      float den;
+
+      __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_coshf (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+#ifndef __ctanf
+weak_alias (__ctanf, ctanf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanh.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanh.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanh.c	(revision 2147)
@@ -0,0 +1,74 @@
+/* Complex hyperbole tangent for double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctanh (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinf (__real__ x))
+	{
+	  __real__ res = __copysign (1.0, __real__ x);
+	  __imag__ res = __copysign (0.0, __imag__ x);
+	}
+      else if (__imag__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nan ("");
+	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (__isinf (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      double sin2ix, cos2ix;
+      double den;
+
+      __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = __ieee754_sinh (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
+weak_alias (__ctanh, ctanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctanh, __ctanhl)
+weak_alias (__ctanh, ctanhl)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhf.c	(revision 2147)
@@ -0,0 +1,72 @@
+/* Complex hyperbole tangent for float.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanhf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinff (__real__ x))
+	{
+	  __real__ res = __copysignf (1.0, __real__ x);
+	  __imag__ res = __copysignf (0.0, __imag__ x);
+	}
+      else if (__imag__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanf ("");
+	  __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (__isinff (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      float sin2ix, cos2ix;
+      float den;
+
+      __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
+#ifndef __ctanhf
+weak_alias (__ctanhf, ctanhf)
+#endif
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanhl.c	(revision 2147)
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for long double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanhl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinfl (__real__ x))
+	{
+	  __real__ res = __copysignl (1.0, __real__ x);
+	  __imag__ res = __copysignl (0.0, __imag__ x);
+	}
+      else if (__imag__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (__isinfl (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      long double sin2ix, cos2ix;
+      long double den;
+
+      __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
+weak_alias (__ctanhl, ctanhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_ctanl.c	(revision 2147)
@@ -0,0 +1,70 @@
+/* Complex tangent function for long double.
+   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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinfl (__imag__ x))
+	{
+	  __real__ res = __copysignl (0.0, __real__ x);
+	  __imag__ res = __copysignl (1.0, __imag__ x);
+	}
+      else if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (__isinfl (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      long double sin2rx, cos2rx;
+      long double den;
+
+      __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__ctanl, ctanl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_erfl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_erfl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/s_erfl.c	(revision 2147)
@@ -0,0 +1,26 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__erfl (long double x)
+{
+  fputs ("__erfl not implemented\n", stderr);
+  __set_errno (ENOSYS);
+  return 0.0;
+}
+weak_alias (__erfl, erfl)
+
+stub_warning (erfl)
+
+long double
+__erfcl (long double x)
+{
+  fputs ("__erfcl not implemented\n", stderr);
+  __set_errno (ENOSYS);
+  return 0.0;
+}
+weak_alias (__erfcl, erfcl)
+
+stub_warning (erfcl)
+#include <stub-tag.h>
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_lgammal.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_lgammal.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_lgammal.c	(revision 2147)
@@ -0,0 +1,58 @@
+/* w_lgammal.c -- long double version of w_lgamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double lgammal(long double x)
+ * Return the logarithm of the Gamma function of x.
+ *
+ * Method: call __ieee754_lgammal_r
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __lgammal(long double x)
+#else
+	long double __lgammal(x)
+	long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_lgammal_r(x,&signgam);
+#else
+        long double y;
+	int local_signgam = 0;
+        y = __ieee754_lgammal_r(x,&local_signgam);
+	if (_LIB_VERSION != _ISOC_)
+	  /* ISO C99 does not define the global variable.  */
+	  signgam = local_signgam;
+        if(_LIB_VERSION == _IEEE_) return y;
+        if(!__finitel(y)&&__finitel(x)) {
+            if(__floorl(x)==x&&x<=0.0)
+                return __kernel_standard(x,x,215); /* lgamma pole */
+            else
+                return __kernel_standard(x,x,214); /* lgamma overflow */
+        } else
+            return y;
+#endif
+}
+weak_alias (__lgammal, lgammal)
+strong_alias (__lgammal, __gammal)
+weak_alias (__gammal, gammal)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammaf.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammaf.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammaf.c	(revision 2147)
@@ -0,0 +1,53 @@
+/* w_gammaf.c -- float version of w_gamma.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	float __tgammaf(float x)
+#else
+	float __tgammaf(x)
+	float x;
+#endif
+{
+        float y;
+	int local_signgam;
+	y = __ieee754_gammaf_r(x,&local_signgam);
+	if (local_signgam < 0) y = -y;
+#ifdef _IEEE_LIBM
+	return y;
+#else
+	if(_LIB_VERSION == _IEEE_) return y;
+
+	if(!__finitef(y)&&__finitef(x)) {
+	  if (x == (float)0.0)
+	    /* tgammaf pole */
+	    return (float)__kernel_standard((double)x,(double)x,150);
+	  else if(__floorf(x)==x&&x<(float)0.0)
+	    /* tgammaf domain */
+	    return (float)__kernel_standard((double)x,(double)x,141);
+	  else
+	    /* tgammaf overflow */
+	    return (float)__kernel_standard((double)x,(double)x,140);
+	}
+	return y;
+#endif
+}
+weak_alias (__tgammaf, tgammaf)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammal.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammal.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/generic/w_tgammal.c	(revision 2147)
@@ -0,0 +1,55 @@
+/* w_gammal.c -- long double version of w_gamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double gammal(double x)
+ * Return the Gamma function of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __tgammal(long double x)
+#else
+	long double __tgammal(x)
+	long double x;
+#endif
+{
+        long double y;
+	int local_signgam;
+	y = __ieee754_gammal_r(x,&local_signgam);
+	if (local_signgam < 0) y = -y;
+#ifdef _IEEE_LIBM
+	return y;
+#else
+	if(_LIB_VERSION == _IEEE_) return y;
+
+	if(!__finitel(y)&&__finitel(x)) {
+	  if(x==0.0)
+	    return __kernel_standard(x,x,250); /* tgamma pole */
+	  else if(__floorl(x)==x&&x<0.0)
+	    return __kernel_standard(x,x,241); /* tgamma domain */
+	  else
+	    return __kernel_standard(x,x,240); /* tgamma overflow */
+	}
+	return y;
+#endif
+}
+weak_alias (__tgammal, tgammal)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atan2l.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atan2l.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atan2l.c	(revision 2147)
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_atan2l (long double y, long double x)
+{
+  long double res;
+
+  asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
+
+  return res;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atanhl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atanhl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_atanhl.S	(revision 2147)
@@ -0,0 +1,120 @@
+/* ix87 specific implementation of arctanh function.
+   Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	/* Please note that we use double values for 0.5 and 1.0.  These
+	   numbers have exact representations and so we don't get accuracy
+	   problems.  The advantage is that the code is simpler.  */
+	ASM_TYPE_DIRECTIVE(half,@object)
+half:	.double 0.5
+	ASM_SIZE_DIRECTIVE(half)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(ln2_2,@object)
+ln2_2:	.tfloat 0.3465735902799726547086160
+	ASM_SIZE_DIRECTIVE(ln2_2)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_atanhl)
+	movl	12(%esp), %ecx
+
+	movl	%ecx, %eax
+	andl	$0x7fff, %eax
+	cmpl	$0x7fff, %eax
+	je	5f
+7:
+
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+
+	andl	$0x8000, %ecx	// ECX == 0 iff X >= 0
+
+	fldt	MO(ln2_2)	// 0.5*ln2
+	xorl	%ecx, 12(%esp)
+	fldt	4(%esp)		// |x| : 0.5*ln2
+	fcoml	MO(half)	// |x| : 0.5*ln2
+	fld	%st(0)		// |x| : |x| : 0.5*ln2
+	fnstsw			// |x| : |x| : 0.5*ln2
+	sahf
+	jae	2f
+	fadd	%st, %st(1)	// |x| : 2*|x| : 0.5*ln2
+	fld	%st		// |x| : |x| : 2*|x| : 0.5*ln2
+	fsubrl	MO(one)		// 1-|x| : |x| : 2*|x| : 0.5*ln2
+	fxch			// |x| : 1-|x| : 2*|x| : 0.5*ln2
+	fmul	%st(2)		// 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
+	fdivp			// (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
+	faddp			// 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+	fcoml	MO(limit)	// 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+	fnstsw			// 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+	sahf
+	jae	4f
+	fyl2xp1			// 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+	jecxz	3f
+	fchs			// 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3:	ret
+
+	.align ALIGNARG(4)
+4:	faddl	MO(one)		// 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+	fyl2x			// 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+	jecxz	3f
+	fchs			// 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3:	ret
+
+	.align ALIGNARG(4)
+2:	faddl	MO(one)		// 1+|x| : |x| : 0.5*ln2
+	fxch			// |x| : 1+|x| : 0.5*ln2
+	fsubrl	MO(one)		// 1-|x| : 1+|x| : 0.5*ln2
+	fdivrp			// (1+|x|)/(1-|x|) : 0.5*ln2
+	fyl2x			// 0.5*ln2*ld((1+|x|)/(1-|x|))
+	jecxz	3f
+	fchs			// 0.5*ln2*ld((1+x)/(1-x))
+3:	ret
+
+	// x == NaN or ±Inf
+5:	cmpl	$0x80000000, 8(%esp)
+	ja	6f
+	cmpl	$0, 4(%esp)
+	je	7b
+6:	fldt	4(%esp)
+	ret
+END(__ieee754_atanhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10.S	(revision 2147)
@@ -0,0 +1,38 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+/* 10^x = 2^(x * log2(10)) */
+ENTRY(__ieee754_exp10)
+	fldl	4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@cygnus.com.  */
+	fxam				/* Is NaN or +-Inf?  */
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	1f			/* Is +-Inf, jump.  */
+	fldl2t
+	fmulp				/* x * log2(10) */
+	fld	%st
+	frndint				/* int(x * log2(10)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(10)) */
+	fxch
+	f2xm1				/* 2^(fract(x * log2(10))) - 1 */
+	fld1
+	faddp				/* 2^(fract(x * log2(10))) */
+	fscale				/* e^x */
+	fstp	%st(1)
+	ret
+
+1:	testl	$0x200, %eax		/* Test sign.  */
+	jz	2f			/* If positive, jump.  */
+	fstp	%st
+	fldz				/* Set result to 0.  */
+2:	ret
+END (__ieee754_exp10)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10f.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10f.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10f.S	(revision 2147)
@@ -0,0 +1,38 @@
+/*
+ * Written by Ulrich Drepper.
+ */
+
+#include <machine/asm.h>
+
+/* e^x = 2^(x * log2(10)) */
+ENTRY(__ieee754_exp10f)
+	flds	4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@cygnus.com.  */
+	fxam				/* Is NaN or +-Inf?  */
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	1f			/* Is +-Inf, jump.  */
+	fldl2t
+	fmulp				/* x * log2(10) */
+	fld	%st
+	frndint				/* int(x * log2(10)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(10)) */
+	fxch
+	f2xm1				/* 2^(fract(x * log2(10))) - 1 */
+	fld1
+	faddp				/* 2^(fract(x * log2(10))) */
+	fscale				/* e^x */
+	fstp	%st(1)
+	ret
+
+1:	testl	$0x200, %eax		/* Test sign.  */
+	jz	2f			/* If positive, jump.  */
+	fstp	%st
+	fldz				/* Set result to 0.  */
+2:	ret
+END (__ieee754_exp10f)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10l.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10l.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp10l.S	(revision 2147)
@@ -0,0 +1,38 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+/* e^x = 2^(x * log2l(10)) */
+ENTRY(__ieee754_exp10l)
+	fldt	4(%esp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@cygnus.com.  */
+	fxam				/* Is NaN or +-Inf?  */
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	1f			/* Is +-Inf, jump.  */
+	fldl2t
+	fmulp				/* x * log2(10) */
+	fld	%st
+	frndint				/* int(x * log2(10)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(10)) */
+	fxch
+	f2xm1				/* 2^(fract(x * log2(10))) - 1 */
+	fld1
+	faddp				/* 2^(fract(x * log2(10))) */
+	fscale				/* e^x */
+	fstp	%st(1)
+	ret
+
+1:	testl	$0x200, %eax		/* Test sign.  */
+	jz	2f			/* If positive, jump.  */
+	fstp	%st
+	fldz				/* Set result to 0.  */
+2:	ret
+END (__ieee754_exp10l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp2l.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp2l.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_exp2l.S	(revision 2147)
@@ -0,0 +1,37 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_exp2l)
+	fldt	4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@cygnus.com.  */
+	fxam				/* Is NaN or +-Inf?  */
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	1f			/* Is +-Inf, jump.  */
+	fld	%st
+	frndint				/* int(x) */
+	fsubr	%st,%st(1)		/* fract(x) */
+	fxch
+	f2xm1				/* 2^(fract(x)) - 1 */
+	fld1
+	faddp				/* 2^(fract(x)) */
+	fscale				/* e^x */
+	fstp	%st(1)
+	ret
+
+1:	testl	$0x200, %eax		/* Test sign.  */
+	jz	2f			/* If positive, jump.  */
+	fstp	%st
+	fldz				/* Set result to 0.  */
+2:	ret
+END (__ieee754_exp2l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_fmodl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_fmodl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_fmodl.c	(revision 2147)
@@ -0,0 +1,22 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_fmodl (long double x, long double y)
+{
+  long double res;
+
+  asm ("1:\tfprem\n"
+       "fstsw   %%ax\n"
+       "sahf\n"
+       "jp      1b\n"
+       "fstp    %%st(1)"
+       : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
+  return res;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log10l.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log10l.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log10l.S	(revision 2147)
@@ -0,0 +1,68 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log10l)
+	fldlg2			// log10(2)
+	fldt	4(%esp)		// x : log10(2)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fxam
+	fnstsw
+	fld	%st		// x : x : log10(2)
+	sahf
+	jc	3f		// in case x is NaN or ±Inf
+4:	fsubl	MO(one)		// x-1 : x : log10(2)
+	fld	%st		// x-1 : x-1 : x : log10(2)
+	fabs			// |x-1| : x-1 : x : log10(2)
+	fcompl	MO(limit)	// x-1 : x : log10(2)
+	fnstsw			// x-1 : x : log10(2)
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : log10(2)
+	fyl2xp1			// log10(x)
+	ret
+
+2:	fstp	%st(0)		// x : log10(2)
+	fyl2x			// log10(x)
+	ret
+
+3:	jp	4b		// in case x is ±Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END(__ieee754_log10l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2.S	(revision 2147)
@@ -0,0 +1,65 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log2)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fldl	MO(one)
+	fldl	4(%esp)		// x : 1
+	fxam
+	fnstsw
+	fld	%st		// x : x : 1
+	sahf
+	jc	3f		// in case x is NaN or ±Inf
+4:	fsub	%st(2), %st	// x-1 : x : 1
+	fld	%st		// x-1 : x-1 : x : 1
+	fabs			// |x-1| : x-1 : x : 1
+	fcompl	MO(limit)	// x-1 : x : 1
+	fnstsw			// x-1 : x : 1
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : 1
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : 1
+	fyl2x			// log(x)
+	ret
+
+3:	jp	4b		// in case x is ±Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END (__ieee754_log2)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2f.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2f.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2f.S	(revision 2147)
@@ -0,0 +1,65 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log2f)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fldl	MO(one)
+	flds	4(%esp)		// x : 1
+	fxam
+	fnstsw
+	fld	%st		// x : x : 1
+	sahf
+	jc	3f		// in case x is NaN or ±Inf
+4:	fsub	%st(2), %st	// x-1 : x : 1
+	fld	%st		// x-1 : x-1 : x : 1
+	fabs			// |x-1| : x-1 : x : 1
+	fcompl	MO(limit)	// x-1 : x : 1
+	fnstsw			// x-1 : x : 1
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : 1
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : 1
+	fyl2x			// log(x)
+	ret
+
+3:	jp	4b		// in case x is ±Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END (__ieee754_log2f)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2l.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2l.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_log2l.S	(revision 2147)
@@ -0,0 +1,65 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log2l)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fldl	MO(one)
+	fldt	4(%esp)		// x : 1
+	fxam
+	fnstsw
+	fld	%st		// x : x : 1
+	sahf
+	jc	3f		// in case x is NaN or ±Inf
+4:	fsub	%st(2), %st	// x-1 : x : 1
+	fld	%st		// x-1 : x-1 : x : 1
+	fabs			// |x-1| : x-1 : x : 1
+	fcompl	MO(limit)	// x-1 : x : 1
+	fnstsw			// x-1 : x : 1
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : 1
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : 1
+	fyl2x			// log(x)
+	ret
+
+3:	jp	4b		// in case x is ±Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END (__ieee754_log2l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_logl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_logl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_logl.S	(revision 2147)
@@ -0,0 +1,58 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_logl)
+	fldln2			// log(2)
+	fldt	4(%esp)		// x : log(2)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fld	%st		// x : x : log(2)
+	fsubl	MO(one)		// x-1 : x : log(2)
+	fld	%st		// x-1 : x-1 : x : log(2)
+	fabs			// |x-1| : x-1 : x : log(2)
+	fcompl	MO(limit)	// x-1 : x : log(2)
+	fnstsw			// x-1 : x : log(2)
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : log(2)
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : log(2)
+	fyl2x			// log(x)
+	ret
+END (__ieee754_logl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_powl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_powl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_powl.S	(revision 2147)
@@ -0,0 +1,360 @@
+/* ix87 specific implementation of pow function.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(infinity,@object)
+inf_zero:
+infinity:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+	ASM_SIZE_DIRECTIVE(infinity)
+	ASM_TYPE_DIRECTIVE(zero,@object)
+zero:	.double 0.0
+	ASM_SIZE_DIRECTIVE(zero)
+	ASM_TYPE_DIRECTIVE(minf_mzero,@object)
+minf_mzero:
+minfinity:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
+mzero:
+	.byte 0, 0, 0, 0, 0, 0, 0, 0x80
+	ASM_SIZE_DIRECTIVE(minf_mzero)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+	ASM_TYPE_DIRECTIVE(p63,@object)
+p63:	.byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+	ASM_SIZE_DIRECTIVE(p63)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ecx)
+#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+#else
+#define MO(op) op
+#define MOX(op,x,f) op(,x,f)
+#endif
+
+	.text
+ENTRY(__ieee754_powl)
+	fldt	16(%esp)	// y
+	fxam
+
+#ifdef	PIC
+	LOAD_PIC_REG (cx)
+#endif
+
+	fnstsw
+	movb	%ah, %dl
+	andb	$0x45, %ah
+	cmpb	$0x40, %ah	// is y == 0 ?
+	je	11f
+
+	cmpb	$0x05, %ah	// is y == ±inf ?
+	je	12f
+
+	cmpb	$0x01, %ah	// is y == NaN ?
+	je	30f
+
+	fldt	4(%esp)		// x : y
+
+	subl	$8,%esp
+	cfi_adjust_cfa_offset (8)
+
+	fxam
+	fnstsw
+	movb	%ah, %dh
+	andb	$0x45, %ah
+	cmpb	$0x40, %ah
+	je	20f		// x is ±0
+
+	cmpb	$0x05, %ah
+	je	15f		// x is ±inf
+
+	fxch			// y : x
+
+	/* fistpll raises invalid exception for |y| >= 1L<<63.  */
+	fld	%st		// y : y : x
+	fabs			// |y| : y : x
+	fcompl	MO(p63)		// y : x
+	fnstsw
+	sahf
+	jnc	2f
+
+	/* First see whether `y' is a natural number.  In this case we
+	   can use a more precise algorithm.  */
+	fld	%st		// y : y : x
+	fistpll	(%esp)		// y : x
+	fildll	(%esp)		// int(y) : y : x
+	fucomp	%st(1)		// y : x
+	fnstsw
+	sahf
+	jne	2f
+
+	/* OK, we have an integer value for y.  */
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	popl	%edx
+	cfi_adjust_cfa_offset (-4)
+	orl	$0, %edx
+	fstp	%st(0)		// x
+	jns	4f		// y >= 0, jump
+	fdivrl	MO(one)		// 1/x		(now referred to as x)
+	negl	%eax
+	adcl	$0, %edx
+	negl	%edx
+4:	fldl	MO(one)		// 1 : x
+	fxch
+
+6:	shrdl	$1, %edx, %eax
+	jnc	5f
+	fxch
+	fmul	%st(1)		// x : ST*x
+	fxch
+5:	fmul	%st(0), %st	// x*x : ST*x
+	shrl	$1, %edx
+	movl	%eax, %ecx
+	orl	%edx, %ecx
+	jnz	6b
+	fstp	%st(0)		// ST*x
+	ret
+
+	/* y is ±NAN */
+30:	fldt	4(%esp)		// x : y
+	fldl	MO(one)		// 1.0 : x : y
+	fucomp	%st(1)		// x : y
+	fnstsw
+	sahf
+	je	31f
+	fxch			// y : x
+31:	fstp	%st(1)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+2:	/* y is a real number.  */
+	fxch			// x : y
+	fldl	MO(one)		// 1.0 : x : y
+	fld	%st(1)		// x : 1.0 : x : y
+	fsub	%st(1)		// x-1 : 1.0 : x : y
+	fabs			// |x-1| : 1.0 : x : y
+	fcompl	MO(limit)	// 1.0 : x : y
+	fnstsw
+	fxch			// x : 1.0 : y
+	sahf
+	ja	7f
+	fsub	%st(1)		// x-1 : 1.0 : y
+	fyl2xp1			// log2(x) : y
+	jmp	8f
+
+7:	fyl2x			// log2(x) : y
+8:	fmul	%st(1)		// y*log2(x) : y
+	fxam
+	fnstsw
+	andb	$0x45, %ah
+	cmpb	$0x05, %ah	// is y*log2(x) == ±inf ?
+	je	28f
+	fst	%st(1)		// y*log2(x) : y*log2(x)
+	frndint			// int(y*log2(x)) : y*log2(x)
+	fsubr	%st, %st(1)	// int(y*log2(x)) : fract(y*log2(x))
+	fxch			// fract(y*log2(x)) : int(y*log2(x))
+	f2xm1			// 2^fract(y*log2(x))-1 : int(y*log2(x))
+	faddl	MO(one)		// 2^fract(y*log2(x)) : int(y*log2(x))
+	fscale			// 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+	fstp	%st(1)		// 2^fract(y*log2(x))*2^int(y*log2(x))
+	ret
+
+	cfi_adjust_cfa_offset (8)
+28:	fstp	%st(1)		// y*log2(x)
+	fldl	MO(one)		// 1 : y*log2(x)
+	fscale			// 2^(y*log2(x)) : y*log2(x)
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+	fstp	%st(1)		// 2^(y*log2(x))
+	ret
+
+	// pow(x,±0) = 1
+	.align ALIGNARG(4)
+11:	fstp	%st(0)		// pop y
+	fldl	MO(one)
+	ret
+
+	// y == ±inf
+	.align ALIGNARG(4)
+12:	fstp	%st(0)		// pop y
+	fldt	4(%esp)		// x
+	fabs
+	fcompl	MO(one)		// < 1, == 1, or > 1
+	fnstsw
+	andb	$0x45, %ah
+	cmpb	$0x45, %ah
+	je	13f		// jump if x is NaN
+
+	cmpb	$0x40, %ah
+	je	14f		// jump if |x| == 1
+
+	shlb	$1, %ah
+	xorb	%ah, %dl
+	andl	$2, %edx
+	fldl	MOX(inf_zero, %edx, 4)
+	ret
+
+	.align ALIGNARG(4)
+14:	fldl	MO(one)
+	ret
+
+	.align ALIGNARG(4)
+13:	fldt	4(%esp)		// load x == NaN
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+	// x is ±inf
+15:	fstp	%st(0)		// y
+	testb	$2, %dh
+	jz	16f		// jump if x == +inf
+
+	// We must find out whether y is an odd integer.
+	fld	%st		// y : y
+	fistpll	(%esp)		// y
+	fildll	(%esp)		// int(y) : y
+	fucompp			// <empty>
+	fnstsw
+	sahf
+	jne	17f
+
+	// OK, the value is an integer, but is it odd?
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	popl	%edx
+	cfi_adjust_cfa_offset (-4)
+	andb	$1, %al
+	jz	18f		// jump if not odd
+	// It's an odd integer.
+	shrl	$31, %edx
+	fldl	MOX(minf_mzero, %edx, 8)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+16:	fcompl	MO(zero)
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+	fnstsw
+	shrl	$5, %eax
+	andl	$8, %eax
+	fldl	MOX(inf_zero, %eax, 1)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+17:	shll	$30, %edx	// sign bit for y in right position
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+18:	shrl	$31, %edx
+	fldl	MOX(inf_zero, %edx, 8)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+	// x is ±0
+20:	fstp	%st(0)		// y
+	testb	$2, %dl
+	jz	21f		// y > 0
+
+	// x is ±0 and y is < 0.  We must find out whether y is an odd integer.
+	testb	$2, %dh
+	jz	25f
+
+	fld	%st		// y : y
+	fistpll	(%esp)		// y
+	fildll	(%esp)		// int(y) : y
+	fucompp			// <empty>
+	fnstsw
+	sahf
+	jne	26f
+
+	// OK, the value is an integer, but is it odd?
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	popl	%edx
+	cfi_adjust_cfa_offset (-4)
+	andb	$1, %al
+	jz	27f		// jump if not odd
+	// It's an odd integer.
+	// Raise divide-by-zero exception and get minus infinity value.
+	fldl	MO(one)
+	fdivl	MO(zero)
+	fchs
+	ret
+
+	cfi_adjust_cfa_offset (8)
+25:	fstp	%st(0)
+26:	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+27:	// Raise divide-by-zero exception and get infinity value.
+	fldl	MO(one)
+	fdivl	MO(zero)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+	.align ALIGNARG(4)
+	// x is ±0 and y is > 0.  We must find out whether y is an odd integer.
+21:	testb	$2, %dh
+	jz	22f
+
+	fld	%st		// y : y
+	fistpll	(%esp)		// y
+	fildll	(%esp)		// int(y) : y
+	fucompp			// <empty>
+	fnstsw
+	sahf
+	jne	23f
+
+	// OK, the value is an integer, but is it odd?
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	popl	%edx
+	cfi_adjust_cfa_offset (-4)
+	andb	$1, %al
+	jz	24f		// jump if not odd
+	// It's an odd integer.
+	fldl	MO(mzero)
+	ret
+
+	cfi_adjust_cfa_offset (8)
+22:	fstp	%st(0)
+23:	addl	$8, %esp	// Don't use 2 x pop
+	cfi_adjust_cfa_offset (-8)
+24:	fldl	MO(zero)
+	ret
+
+END(__ieee754_powl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_remainderl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_remainderl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_remainderl.S	(revision 2147)
@@ -0,0 +1,21 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_remainderl)
+	fldt	16(%esp)
+	fldt	4(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstp	%st(1)
+	ret
+END (__ieee754_remainderl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_scalbl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_scalbl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_scalbl.S	(revision 2147)
@@ -0,0 +1,104 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Correct handling of y==-inf <drepper@gnu>
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(zero_nan,@object)
+zero_nan:
+	.double 0.0
+nan:	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+minus_zero:
+	.byte 0, 0, 0, 0, 0, 0, 0, 0x80
+	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+	ASM_SIZE_DIRECTIVE(zero_nan)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ecx)
+#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+#else
+#define MO(op) op
+#define MOX(op,x,f) op(,x,f)
+#endif
+
+	.text
+ENTRY(__ieee754_scalbl)
+	fldt	16(%esp)
+	fxam
+	fnstsw
+	fldt	4(%esp)
+	andl	$0x4700, %eax
+	cmpl	$0x0700, %eax
+	je	1f
+	andl	$0x4500, %eax
+	cmpl	$0x0100, %eax
+	je	2f
+	fxam
+	fnstsw
+	andl	$0x4500, %eax
+	cmpl	$0x0100, %eax
+	je	3f
+	fld	%st(1)
+	frndint
+	fcomp	%st(2)
+	fnstsw
+	sahf
+	jne	4f
+	fscale
+	fstp	%st(1)
+	ret
+
+	/* y is -inf */
+1:	fxam
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
+	fnstsw
+	movl	12(%esp), %edx
+	shrl	$5, %eax
+	fstp	%st
+	fstp	%st
+	andl	$0x8000, %edx
+	andl	$8, %eax
+	jnz	4f
+	shrl	$11, %edx
+	addl	%edx, %eax
+	fldl	MOX(zero_nan, %eax, 1)
+	ret
+
+	/* The result is NaN, but we must not raise an exception.
+	   So use a variable.  */
+2:	fstp	%st
+	fstp	%st
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
+	fldl	MO(nan)
+	ret
+
+	/* The first parameter is a NaN.  Return it.  */
+3:	fstp	%st(1)
+	ret
+
+	/* Return NaN and raise the invalid exception.  */
+4:	fstp	%st
+	fstp	%st
+	fldz
+	fdiv	%st
+	ret
+END(__ieee754_scalbl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_sqrtl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_sqrtl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/e_sqrtl.c	(revision 2147)
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_sqrtl (long double x)
+{
+  long double res;
+
+  asm ("fsqrt" : "=t" (res) : "0" (x));
+
+  return res;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_asinhl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_asinhl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_asinhl.S	(revision 2147)
@@ -0,0 +1,143 @@
+/* ix87 specific implementation of arcsinh.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(huge,@object)
+huge:	.tfloat 1e+4930
+	ASM_SIZE_DIRECTIVE(huge)
+	.align ALIGNARG(4)
+	/* Please note that we use double value for 1.0.  This number
+	   has an exact representation and so we don't get accuracy
+	   problems.  The advantage is that the code is simpler.  */
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__asinhl)
+	movl	12(%esp), %ecx
+	movl	$0x7fff, %eax
+	andl	%ecx, %eax
+	andl	$0x8000, %ecx
+	movl	%eax, %edx
+	orl	$0xffff8000, %edx
+	incl	%edx
+	jz	7f			// x in ±Inf or NaN
+	xorl	%ecx, 12(%esp)
+	fldt	4(%esp)			// |x|
+	cmpl	$0x3fde, %eax
+	jb	2f			// |x| < 2^-34
+	fldln2				// log(2) : |x|
+	cmpl	$0x4020, %eax
+	fxch				// |x| : log(2)
+	ja	3f			// |x| > 2^34
+#ifdef	PIC
+	LOAD_PIC_REG (dx)
+#endif
+	cmpl	$0x4000, %eax
+	ja	5f			// |x| > 2
+
+	// 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
+	fld	%st			// |x| : |x| : log(2)
+	fmul	%st(1)			// |x|^2 : |x| : log(2)
+	fld	%st			// |x|^2 : |x|^2 : |x| : log(2)
+	faddl	MO(one)			// 1+|x|^2 : |x|^2 : |x| : log(2)
+	fsqrt				// sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+	faddl	MO(one)			// 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+	fdivrp				// |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
+	faddp				// |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
+	fcoml	MO(limit)
+	fnstsw
+	sahf
+	ja	6f
+	fyl2xp1
+	jecxz	4f
+	fchs
+4:	ret
+
+7:	fldt	4(%esp)
+	ret
+
+6:	faddl	MO(one)
+	fyl2x
+	jecxz	4f
+	fchs
+4:	ret
+
+	// |x| < 2^-34 => y = x (inexact iff |x| != 0.0)
+	.align ALIGNARG(4)
+2:
+#ifdef	PIC
+	LOAD_PIC_REG (dx)
+#endif
+	jecxz	4f
+	fchs				// x
+4:	fld	%st			// x : x
+	fldt	MO(huge)		// huge : x : x
+	faddp				// huge+x : x
+	fstp	%st(0)			// x
+	ret
+
+	// |x| > 2^34 => y = sign(x) * (log(|x|) + log(2))
+	.align ALIGNARG(4)
+3:	fyl2x				// log(|x|)
+	fldln2				// log(2) : log(|x|)
+	faddp				// log(|x|)+log(2)
+	jecxz	4f
+	fchs
+4:	ret
+
+	// |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
+	.align ALIGNARG(4)
+5:	fld	%st			// |x| : |x| : log(2)
+	fadd	%st, %st(1)		// |x| : 2*|x| : log(2)
+	fld	%st			// |x| : |x| : 2*|x| : log(2)
+	fmul	%st(1)			// |x|^2 : |x| : 2*|x| : log(2)
+	faddl	MO(one)			// 1+|x|^2 : |x| : 2*|x| : log(2)
+	fsqrt				// sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
+	faddp				// |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
+	fdivrl	MO(one)			// 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
+	faddp				// 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
+	fyl2x				// log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
+	jecxz	4f
+	fchs
+4:	ret
+END(__asinhl)
+weak_alias (__asinhl, asinhl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_atanl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_atanl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_atanl.c	(revision 2147)
@@ -0,0 +1,22 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__atanl (long double x)
+{
+  long double res;
+
+  asm ("fld1\n"
+       "fpatan"
+       : "=t" (res) : "0" (x));
+
+  return res;
+}
+
+weak_alias (__atanl, atanl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_cexp.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_cexp.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_cexp.S	(revision 2147)
@@ -0,0 +1,257 @@
+/* ix87 specific implementation of complex exponential function for double.
+   Copyright (C) 1997, 2005 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object)
+huge_nan_null_null:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+	.double	0.0
+zero:	.double	0.0
+infinity:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+	.double 0.0
+	.byte 0, 0, 0, 0, 0, 0, 0, 0x80
+	ASM_SIZE_DIRECTIVE(huge_nan_null_null)
+
+	ASM_TYPE_DIRECTIVE(twopi,@object)
+twopi:
+	.byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40
+	.byte 0, 0, 0, 0, 0, 0
+	ASM_SIZE_DIRECTIVE(twopi)
+
+	ASM_TYPE_DIRECTIVE(l2e,@object)
+l2e:
+	.byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f
+	.byte 0, 0, 0, 0, 0, 0
+	ASM_SIZE_DIRECTIVE(l2e)
+
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ecx)
+#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+#else
+#define MO(op) op
+#define MOX(op,x,f) op(,x,f)
+#endif
+
+	.text
+ENTRY(__cexp)
+	fldl	8(%esp)			/* x */
+	fxam
+	fnstsw
+	fldl	16(%esp)		/* y : x */
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
+	movb	%ah, %dh
+	andb	$0x45, %ah
+	cmpb	$0x05, %ah
+	je	1f			/* Jump if real part is +-Inf */
+	cmpb	$0x01, %ah
+	je	2f			/* Jump if real part is NaN */
+
+	fxam				/* y : x */
+	fnstsw
+	/* If the imaginary part is not finite we return NaN+i NaN, as
+	   for the case when the real part is NaN.  A test for +-Inf and
+	   NaN would be necessary.  But since we know the stack register
+	   we applied `fxam' to is not empty we can simply use one test.
+	   Check your FPU manual for more information.  */
+	andb	$0x01, %ah
+	cmpb	$0x01, %ah
+	je	20f
+
+	/* We have finite numbers in the real and imaginary part.  Do
+	   the real work now.  */
+	fxch			/* x : y */
+	fldt	MO(l2e)		/* log2(e) : x : y */
+	fmulp			/* x * log2(e) : y */
+	fld	%st		/* x * log2(e) : x * log2(e) : y */
+	frndint			/* int(x * log2(e)) : x * log2(e) : y */
+	fsubr	%st, %st(1)	/* int(x * log2(e)) : frac(x * log2(e)) : y */
+	fxch			/* frac(x * log2(e)) : int(x * log2(e)) : y */
+	f2xm1			/* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */
+	faddl	MO(one)		/* 2^frac(x * log2(e)) : int(x * log2(e)) : y */
+	fscale			/* e^x : int(x * log2(e)) : y */
+	fst	%st(1)		/* e^x : e^x : y */
+	fxch	%st(2)		/* y : e^x : e^x */
+	fsincos			/* cos(y) : sin(y) : e^x : e^x */
+	fnstsw
+	testl	$0x400, %eax
+	jnz	7f
+	fmulp	%st, %st(3)	/* sin(y) : e^x : e^x * cos(y) */
+	fmulp	%st, %st(1)	/* e^x * sin(y) : e^x * cos(y) */
+	movl	4(%esp), %eax		/* Pointer to memory for result.  */
+	fstpl	8(%eax)
+	fstpl	(%eax)
+	ret	$4
+
+	/* We have to reduce the argument to fsincos.  */
+	.align ALIGNARG(4)
+7:	fldt	MO(twopi)	/* 2*pi : y : e^x : e^x */
+	fxch			/* y : 2*pi : e^x : e^x */
+8:	fprem1			/* y%(2*pi) : 2*pi : e^x : e^x */
+	fnstsw
+	testl	$0x400, %eax
+	jnz	8b
+	fstp	%st(1)		/* y%(2*pi) : e^x : e^x */
+	fsincos			/* cos(y) : sin(y) : e^x : e^x */
+	fmulp	%st, %st(3)
+	fmulp	%st, %st(1)
+	movl	4(%esp), %eax		/* Pointer to memory for result.  */
+	fstpl	8(%eax)
+	fstpl	(%eax)
+	ret	$4
+
+	/* The real part is +-inf.  We must make further differences.  */
+	.align ALIGNARG(4)
+1:	fxam			/* y : x */
+	fnstsw
+	movb	%ah, %dl
+	testb	$0x01, %ah	/* See above why 0x01 is usable here.  */
+	jne	3f
+
+
+	/* The real part is +-Inf and the imaginary part is finite.  */
+	andl	$0x245, %edx
+	cmpb	$0x40, %dl	/* Imaginary part == 0?  */
+	je	4f		/* Yes ->  */
+
+	fxch			/* x : y */
+	shrl	$5, %edx
+	fstp	%st(0)		/* y */ /* Drop the real part.  */
+	andl	$16, %edx	/* This puts the sign bit of the real part
+				   in bit 4.  So we can use it to index a
+				   small array to select 0 or Inf.  */
+	fsincos			/* cos(y) : sin(y) */
+	fnstsw
+	testl	$0x0400, %eax
+	jnz	5f
+	fldl	MOX(huge_nan_null_null,%edx,1)
+	movl	4(%esp), %edx		/* Pointer to memory for result.  */
+	fstl	8(%edx)
+	fstpl	(%edx)
+	ftst
+	fnstsw
+	shll	$23, %eax
+	andl	$0x80000000, %eax
+	orl	%eax, 4(%edx)
+	fstp	%st(0)
+	ftst
+	fnstsw
+	shll	$23, %eax
+	andl	$0x80000000, %eax
+	orl	%eax, 12(%edx)
+	fstp	%st(0)
+	ret	$4
+	/* We must reduce the argument to fsincos.  */
+	.align ALIGNARG(4)
+5:	fldt	MO(twopi)
+	fxch
+6:	fprem1
+	fnstsw
+	testl	$0x400, %eax
+	jnz	6b
+	fstp	%st(1)
+	fsincos
+	fldl	MOX(huge_nan_null_null,%edx,1)
+	movl	4(%esp), %edx		/* Pointer to memory for result.  */
+	fstl	8(%edx)
+	fstpl	(%edx)
+	ftst
+	fnstsw
+	shll	$23, %eax
+	andl	$0x80000000, %eax
+	orl	%eax, 4(%edx)
+	fstp	%st(0)
+	ftst
+	fnstsw
+	shll	$23, %eax
+	andl	$0x80000000, %eax
+	orl	%eax, 12(%edx)
+	fstp	%st(0)
+	ret	$4
+
+	/* The real part is +-Inf and the imaginary part is +-0.  So return
+	   +-Inf+-0i.  */
+	.align ALIGNARG(4)
+4:	movl	4(%esp), %eax		/* Pointer to memory for result.  */
+	fstpl	8(%eax)
+	shrl	$5, %edx
+	fstp	%st(0)
+	andl	$16, %edx
+	fldl	MOX(huge_nan_null_null,%edx,1)
+	fstpl	(%eax)
+	ret	$4
+
+	/* The real part is +-Inf, the imaginary is also is not finite.  */
+	.align ALIGNARG(4)
+3:	fstp	%st(0)
+	fstp	%st(0)		/* <empty> */
+	andb	$0x45, %ah
+	andb	$0x47, %dh
+	xorb	%dh, %ah
+	jnz	30f
+	fldl	MO(infinity)	/* Raise invalid exception.  */
+	fmull	MO(zero)
+	fstp	%st(0)
+30:	movl	%edx, %eax
+	shrl	$5, %edx
+	shll	$4, %eax
+	andl	$16, %edx
+	andl	$32, %eax
+	orl	%eax, %edx
+	movl	4(%esp), %eax		/* Pointer to memory for result.  */
+
+	fldl	MOX(huge_nan_null_null,%edx,1)
+	fldl	MOX(huge_nan_null_null+8,%edx,1)
+	fxch
+	fstpl	(%eax)
+	fstpl	8(%eax)
+	ret	$4
+
+	/* The real part is NaN.  */
+	.align ALIGNARG(4)
+20:	fldl	MO(infinity)		/* Raise invalid exception.  */
+	fmull	MO(zero)
+	fstp	%st(0)
+2:	fstp	%st(0)
+	fstp	%st(0)
+	movl	4(%esp), %eax		/* Pointer to memory for result.  */
+	fldl	MO(huge_nan_null_null+8)
+	fstl	(%eax)
+	fstpl	8(%eax)
+	ret	$4
+
+END(__cexp)
+weak_alias (__cexp, cexp)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_expm1l.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_expm1l.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_expm1l.S	(revision 2147)
@@ -0,0 +1,87 @@
+/* ix87 specific implementation of exp(x)-1.
+   Copyright (C) 1996, 1997, 2002, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+   Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+	/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(minus1,@object)
+minus1:	.double -1.0
+	ASM_SIZE_DIRECTIVE(minus1)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	ASM_TYPE_DIRECTIVE(l2e,@object)
+l2e:	.tfloat 1.442695040888963407359924681002
+	ASM_SIZE_DIRECTIVE(l2e)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__expm1l)
+	fldt	4(%esp)		// x
+	fxam			// Is NaN or +-Inf?
+	fstsw	%ax
+	movb	$0x45, %ch
+	andb	%ah, %ch
+	cmpb	$0x40, %ch
+	je	3f		// If +-0, jump.
+#ifdef	PIC
+	LOAD_PIC_REG (dx)
+#endif
+	cmpb	$0x05, %ch
+	je	2f		// If +-Inf, jump.
+
+	fldt	MO(l2e)		// log2(e) : x
+	fmulp			// log2(e)*x
+	fld	%st		// log2(e)*x : log2(e)*x
+	frndint			// int(log2(e)*x) : log2(e)*x
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fxch			// fract(log2(e)*x) : int(log2(e)*x)
+	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
+	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
+	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
+	ret
+
+2:	testl	$0x200, %eax	// Test sign.
+	jz	3f		// If positive, jump.
+	fstp	%st
+	fldl	MO(minus1)	// Set result to -1.0.
+3:	ret
+END(__expm1l)
+libm_hidden_def (__expm1l)
+weak_alias (__expm1l, expm1l)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_llrintl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_llrintl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_llrintl.S	(revision 2147)
@@ -0,0 +1,37 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997, 2005 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__llrintl)
+	fldt	4(%esp)
+	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
+	fistpll	(%esp)
+	fwait
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	popl	%edx
+	cfi_adjust_cfa_offset (-4)
+	ret
+END(__llrintl)
+weak_alias (__llrintl, llrintl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_log1pl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_log1pl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_log1pl.S	(revision 2147)
@@ -0,0 +1,76 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	/* The fyl2xp1 can only be used for values in
+		-1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
+	   0.29 is a safe value.
+	*/
+limit:	.tfloat 0.29
+	/* Please note:	 we use a double value here.  Since 1.0 has
+	   an exact representation this does not effect the accuracy
+	   but it helps to optimize the code.  */
+one:	.double 1.0
+
+/*
+ * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
+ * otherwise fyl2x with the needed extra computation.
+ */
+	.text
+ENTRY(__log1pl)
+	fldln2
+
+	fldt	4(%esp)
+
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+
+	fxam
+	fnstsw
+	fld	%st
+	sahf
+	jc	3f		// in case x is NaN or ±Inf
+4:
+	fabs
+#ifdef PIC
+	fldt	limit@GOTOFF(%edx)
+#else
+	fldt	limit
+#endif
+	fcompp
+	fnstsw
+	sahf
+	jnc	2f
+
+#ifdef PIC
+	faddl	one@GOTOFF(%edx)
+#else
+	faddl	one
+#endif
+	fyl2x
+	ret
+
+2:	fyl2xp1
+	ret
+
+3:	jp	4b		// in case x is ±Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+
+END (__log1pl)
+weak_alias (__log1pl, log1pl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_logbl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_logbl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_logbl.c	(revision 2147)
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__logbl (long double x)
+{
+  long double res;
+
+  asm ("fxtract\n"
+       "fstp	%%st" : "=t" (res) : "0" (x));
+  return res;
+}
+
+weak_alias (__logbl, logbl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_lrintl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_lrintl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_lrintl.S	(revision 2147)
@@ -0,0 +1,35 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997, 2005 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__lrintl)
+	fldt	4(%esp)
+	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
+	fistpl	(%esp)
+	fwait
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	ret
+END(__lrintl)
+weak_alias (__lrintl, lrintl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_nearbyintl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_nearbyintl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_nearbyintl.S	(revision 2147)
@@ -0,0 +1,29 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>.  */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyintl)
+	fldt	4(%esp)
+	pushl	%eax
+	cfi_adjust_cfa_offset (4)
+	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
+	fnstcw	(%esp)
+	movl	(%esp), %eax
+	orl	$0x20, %eax
+	movl	%eax, 4(%esp)
+	fldcw	4(%esp)
+	frndint
+	fclex
+	fldcw	(%esp)
+	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
+	popl	%eax
+	cfi_adjust_cfa_offset (-4)
+	ret
+END (__nearbyintl)
+weak_alias (__nearbyintl, nearbyintl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_remquol.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_remquol.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_remquol.S	(revision 2147)
@@ -0,0 +1,50 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define DVDND	PARMS
+#define DVSOR	DVDND+12
+#define QUOP	DVSOR+12
+
+	.text
+ENTRY (BP_SYM (__remquol))
+	ENTER
+
+	fldt	DVSOR(%esp)
+	fldt	DVDND(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstp	%st(1)
+	/* Compute the congruent of the quotient.  */
+	movl	%eax, %ecx
+	shrl	$8, %eax
+	shrl	$12, %ecx
+	andl	$4, %ecx
+	andl	$3, %eax
+	orl	%eax, %ecx
+	leal	(%ecx,%ecx,2),%ecx
+	movl	$0xef2a60, %eax
+	shrl	%cl, %eax
+	andl	$7, %eax
+	movl	QUOP(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%ecx, QUOP(%esp), $4)
+	movl	DVDND+8(%esp), %edx
+	xorl	DVSOR+8(%esp), %edx
+	testl	$0x8000, %edx
+	jz	1f
+	negl	%eax
+1:	movl	%eax, (%ecx)
+
+	LEAVE
+	ret
+END (BP_SYM (__remquol))
+weak_alias (BP_SYM (__remquol), BP_SYM (remquol))
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_rintl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_rintl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_rintl.c	(revision 2147)
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__rintl (long double x)
+{
+  long double res;
+
+  asm ("frndint" : "=t" (res) : "0" (x));
+  return res;
+}
+
+weak_alias (__rintl, rintl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_significandl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_significandl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_significandl.c	(revision 2147)
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__significandl (long double x)
+{
+  long double res;
+
+  asm ("fxtract\n"
+       "fstp	%%st(1)" : "=t" (res) : "0" (x));
+  return res;
+}
+
+weak_alias (__significandl, significandl)
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincos.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincos.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincos.S	(revision 2147)
@@ -0,0 +1,65 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997, 2000 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define ANGLE	PARMS
+#define SINP	ANGLE+8
+#define COSP	SINP+PTR_SIZE
+
+	.text
+ENTRY (BP_SYM (__sincos))
+	ENTER
+
+	fldl	ANGLE(%esp)
+	fsincos
+	movl	SINP(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $8)
+	movl	COSP(%esp), %edx
+	CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $8)
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpl	(%edx)
+	fstpl	(%ecx)
+
+	LEAVE
+	ret
+
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpl	(%edx)
+	fstpl	(%ecx)
+
+	LEAVE
+	ret
+END (BP_SYM (__sincos))
+weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosf.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosf.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosf.S	(revision 2147)
@@ -0,0 +1,65 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997, 2000 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define ANGLE	PARMS
+#define SINP	ANGLE+4
+#define COSP	SINP+PTR_SIZE
+
+	.text
+ENTRY (BP_SYM (__sincosf))
+	ENTER
+
+	flds	ANGLE(%esp)
+	fsincos
+	movl	SINP(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $4)
+	movl	COSP(%esp), %edx
+	CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $4)
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstps	(%edx)
+	fstps	(%ecx)
+
+	LEAVE
+	ret
+
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstps	(%edx)
+	fstps	(%ecx)
+
+	LEAVE
+	ret
+END (BP_SYM (__sincosf))
+weak_alias (BP_SYM (__sincosf), BP_SYM (sincosf))
Index: trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosl.S
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosl.S	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/i386/fpu/s_sincosl.S	(revision 2147)
@@ -0,0 +1,65 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997, 2000 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define ANGLE	PARMS
+#define SINP	ANGLE+12
+#define COSP	SINP+PTR_SIZE
+
+	.text
+ENTRY (BP_SYM (__sincosl))
+	ENTER
+
+	fldt	ANGLE(%esp)
+	fsincos
+	movl	SINP(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $12)
+	movl	COSP(%esp), %edx
+	CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $12)
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpt	(%edx)
+	fstpt	(%ecx)
+
+	LEAVE
+	ret
+
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpt	(%edx)
+	fstpt	(%ecx)
+
+	LEAVE
+	ret
+END (BP_SYM (__sincosl))
+weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_acoshl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_acoshl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_acoshl.c	(revision 2147)
@@ -0,0 +1,72 @@
+/* e_acoshl.c -- long double version of e_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* __ieee754_acoshl(x)
+ * Method :
+ *	Based on
+ *		acoshl(x) = logl [ x + sqrtl(x*x-1) ]
+ *	we have
+ *		acoshl(x) := logl(x)+ln2,	if x is large; else
+ *		acoshl(x) := logl(2x-1/(sqrtl(x*x-1)+x)) if x>2; else
+ *		acoshl(x) := log1pl(t+sqrtl(2.0*t+t*t)); where t=x-1.
+ *
+ * Special cases:
+ *	acoshl(x) is NaN with signal if x<1.
+ *	acoshl(NaN) is NaN without signal.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one	= 1.0,
+ln2	= 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
+
+#ifdef __STDC__
+	long double __ieee754_acoshl(long double x)
+#else
+	long double __ieee754_acoshl(x)
+	long double x;
+#endif
+{
+	long double t;
+	u_int32_t se,i0,i1;
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
+	if(se<0x3fff || se & 0x8000) {	/* x < 1 */
+	    return (x-x)/(x-x);
+	} else if(se >=0x401d) {	/* x > 2**30 */
+	    if(se >=0x7fff) {		/* x is inf of NaN */
+	        return x+x;
+	    } else
+		return __ieee754_logl(x)+ln2;	/* acoshl(huge)=logl(2x) */
+	} else if(((se-0x3fff)|i0|i1)==0) {
+	    return 0.0;			/* acosh(1) = 0 */
+	} else if (se > 0x4000) {	/* 2**28 > x > 2 */
+	    t=x*x;
+	    return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one)));
+	} else {			/* 1<x<2 */
+	    t = x-one;
+	    return __log1pl(t+__sqrtl(2.0*t+t*t));
+	}
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_gammal_r.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_gammal_r.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_gammal_r.c	(revision 2147)
@@ -0,0 +1,62 @@
+/* Implementation of gamma function according to ISO C.
+   Copyright (C) 1997, 1999, 2001, 2003, 2004 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 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.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_private.h>
+
+
+long double
+__ieee754_gammal_r (long double x, int *signgamp)
+{
+  /* We don't have a real gamma implementation now.  We'll use lgamma
+     and the exp function.  But due to the required boundary
+     conditions we must check some values separately.  */
+  u_int32_t es, hx, lx;
+
+  GET_LDOUBLE_WORDS (es, hx, lx, x);
+
+  if (((es & 0x7fff) | hx | lx) == 0)
+    {
+      /* Return value for x == 0 is Inf with divide by zero exception.  */
+      *signgamp = 0;
+      return 1.0 / x;
+    }
+  if (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0)
+    {
+      /* x == -Inf.  According to ISO this is NaN.  */
+      *signgamp = 0;
+      return x - x;
+    }
+  if ((es & 0x7fff) == 0x7fff && ((hx & 0x7fffffff) | lx) != 0)
+    {
+      /* NaN, return it.  */
+      *signgamp = 0;
+      return x;
+    }
+  if ((es & 0x8000) != 0 && x < 0xffffffff && __rintl (x) == x)
+    {
+      /* Return value for integer x < 0 is NaN with invalid exception.  */
+      *signgamp = 0;
+      return (x - x) / (x - x);
+    }
+
+  /* XXX FIXME.  */
+  return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j0l.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j0l.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j0l.c	(revision 2147)
@@ -0,0 +1,644 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Long double expansions are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author 
+  reserves the right to distribute this material elsewhere under different
+  copying permissions.  These modifications are distributed here under 
+  the following terms:
+
+    This library is free software; you can redistribute it and/or
+    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.
+
+    This 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_j0(x), __ieee754_y0(x)
+ * Bessel function of the first and second kinds of order zero.
+ * Method -- j0(x):
+ *	1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ...
+ *	2. Reduce x to |x| since j0(x)=j0(-x),  and
+ *	   for x in (0,2)
+ *		j0(x) = 1 - z/4 + z^2*R0/S0,  where z = x*x;
+ *	   for x in (2,inf)
+ *		j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+ *	   where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
+ *	   as follow:
+ *		cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
+ *			= 1/sqrt(2) * (cos(x) + sin(x))
+ *		sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)
+ *			= 1/sqrt(2) * (sin(x) - cos(x))
+ *	   (To avoid cancellation, use
+ *		sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ *	    to compute the worse one.)
+ *
+ *	3 Special cases
+ *		j0(nan)= nan
+ *		j0(0) = 1
+ *		j0(inf) = 0
+ *
+ * Method -- y0(x):
+ *	1. For x<2.
+ *	   Since
+ *		y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...)
+ *	   therefore y0(x)-2/pi*j0(x)*ln(x) is an even function.
+ *	   We use the following function to approximate y0,
+ *		y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2
+ *
+ *	   Note: For tiny x, U/V = u0 and j0(x)~1, hence
+ *		y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)
+ *	2. For x>=2.
+ *		y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
+ *	   where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
+ *	   by the method mentioned above.
+ *	3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static long double pzero (long double), qzero (long double);
+#else
+static long double pzero (), qzero ();
+#endif
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  huge = 1e4930L,
+  one = 1.0L,
+  invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
+  tpi = 6.3661977236758134307553505349005744813784e-1L,
+
+  /* J0(x) = 1 - x^2 / 4 + x^4 R0(x^2) / S0(x^2)
+     0 <= x <= 2
+     peak relative error 1.41e-22 */
+  R[5] = {
+  4.287176872744686992880841716723478740566E7L,
+  -6.652058897474241627570911531740907185772E5L,
+  7.011848381719789863458364584613651091175E3L,
+  -3.168040850193372408702135490809516253693E1L,
+  6.030778552661102450545394348845599300939E-2L,
+},
+
+ S[4] = {
+   2.743793198556599677955266341699130654342E9L,
+   3.364330079384816249840086842058954076201E7L,
+   1.924119649412510777584684927494642526573E5L,
+   6.239282256012734914211715620088714856494E2L,
+   /*   1.000000000000000000000000000000000000000E0L,*/
+};
+
+#ifdef __STDC__
+static const long double zero = 0.0;
+#else
+static long double zero = 0.0;
+#endif
+
+#ifdef __STDC__
+long double
+__ieee754_j0l (long double x)
+#else
+long double
+__ieee754_j0l (x)
+     long double x;
+#endif
+{
+  long double z, s, c, ss, cc, r, u, v;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x7fff)
+    return one / (x * x);
+  x = fabsl (x);
+  if (ix >= 0x4000)		/* |x| >= 2.0 */
+    {
+      __sincosl (x, &s, &c);
+      ss = s - c;
+      cc = s + c;
+      if (ix < 0x7ffe)
+	{			/* make sure x+x not overflow */
+	  z = -__cosl (x + x);
+	  if ((s * c) < zero)
+	    cc = z / ss;
+	  else
+	    ss = z / cc;
+	}
+      /*
+       * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
+       * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
+       */
+      if (ix > 0x4080)	/* 2^129 */
+	z = (invsqrtpi * cc) / __ieee754_sqrtl (x);
+      else
+	{
+	  u = pzero (x);
+	  v = qzero (x);
+	  z = invsqrtpi * (u * cc - v * ss) / __ieee754_sqrtl (x);
+	}
+      return z;
+    }
+  if (ix < 0x3fef) /* |x| < 2**-16 */
+    {
+      if (huge + x > one)
+	{			/* raise inexact if x != 0 */
+	  if (ix < 0x3fde) /* |x| < 2^-33 */
+	    return one;
+	  else
+	    return one - 0.25 * x * x;
+	}
+    }
+  z = x * x;
+  r = z * (R[0] + z * (R[1] + z * (R[2] + z * (R[3] + z * R[4]))));
+  s = S[0] + z * (S[1] + z * (S[2] + z * (S[3] + z)));
+  if (ix < 0x3fff)
+    {				/* |x| < 1.00 */
+      return (one - 0.25 * z + z * (r / s));
+    }
+  else
+    {
+      u = 0.5 * x;
+      return ((one + u) * (one - u) + z * (r / s));
+    }
+}
+
+
+/* y0(x) = 2/pi ln(x) J0(x) + U(x^2)/V(x^2)
+   0 < x <= 2
+   peak relative error 1.7e-21 */
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+U[6] = {
+  -1.054912306975785573710813351985351350861E10L,
+  2.520192609749295139432773849576523636127E10L,
+  -1.856426071075602001239955451329519093395E9L,
+  4.079209129698891442683267466276785956784E7L,
+  -3.440684087134286610316661166492641011539E5L,
+  1.005524356159130626192144663414848383774E3L,
+};
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+V[5] = {
+  1.429337283720789610137291929228082613676E11L,
+  2.492593075325119157558811370165695013002E9L,
+  2.186077620785925464237324417623665138376E7L,
+  1.238407896366385175196515057064384929222E5L,
+  4.693924035211032457494368947123233101664E2L,
+  /*  1.000000000000000000000000000000000000000E0L */
+};
+
+#ifdef __STDC__
+long double
+__ieee754_y0l (long double x)
+#else
+long double
+__ieee754_y0l (x)
+     long double x;
+#endif
+{
+  long double z, s, c, ss, cc, u, v;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
+  if (se & 0x8000)
+    return zero / (zero * x);
+  if (ix >= 0x7fff)
+    return one / (x + x * x);
+  if ((i0 | i1) == 0)
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
+  if (ix >= 0x4000)
+    {				/* |x| >= 2.0 */
+
+      /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
+       * where x0 = x-pi/4
+       *      Better formula:
+       *              cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
+       *                      =  1/sqrt(2) * (sin(x) + cos(x))
+       *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+       *                      =  1/sqrt(2) * (sin(x) - cos(x))
+       * To avoid cancellation, use
+       *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+       * to compute the worse one.
+       */
+      __sincosl (x, &s, &c);
+      ss = s - c;
+      cc = s + c;
+      /*
+       * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
+       * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
+       */
+      if (ix < 0x7ffe)
+	{			/* make sure x+x not overflow */
+	  z = -__cosl (x + x);
+	  if ((s * c) < zero)
+	    cc = z / ss;
+	  else
+	    ss = z / cc;
+	}
+      if (ix > 0x4080)	/* 1e39 */
+	z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
+      else
+	{
+	  u = pzero (x);
+	  v = qzero (x);
+	  z = invsqrtpi * (u * ss + v * cc) / __ieee754_sqrtl (x);
+	}
+      return z;
+    }
+  if (ix <= 0x3fde) /* x < 2^-33 */
+    {
+      z = -7.380429510868722527629822444004602747322E-2L
+	+ tpi * __ieee754_logl (x);
+      return z;
+    }
+  z = x * x;
+  u = U[0] + z * (U[1] + z * (U[2] + z * (U[3] + z * (U[4] + z * U[5]))));
+  v = V[0] + z * (V[1] + z * (V[2] + z * (V[3] + z * (V[4] + z))));
+  return (u / v + tpi * (__ieee754_j0l (x) * __ieee754_logl (x)));
+}
+
+/* The asymptotic expansions of pzero is
+ *	1 - 9/128 s^2 + 11025/98304 s^4 - ...,	where s = 1/x.
+ * For x >= 2, We approximate pzero by
+ *	pzero(x) = 1 + s^2 R(s^2) / S(s^2)
+ */
+#ifdef __STDC__
+static const long double pR8[7] = {
+#else
+static long double pR8[7] = {
+#endif
+  /* 8 <= x <= inf
+     Peak relative error 4.62 */
+  -4.094398895124198016684337960227780260127E-9L,
+  -8.929643669432412640061946338524096893089E-7L,
+  -6.281267456906136703868258380673108109256E-5L,
+  -1.736902783620362966354814353559382399665E-3L,
+  -1.831506216290984960532230842266070146847E-2L,
+  -5.827178869301452892963280214772398135283E-2L,
+  -2.087563267939546435460286895807046616992E-2L,
+};
+#ifdef __STDC__
+static const long double pS8[6] = {
+#else
+static long double pS8[6] = {
+#endif
+  5.823145095287749230197031108839653988393E-8L,
+  1.279281986035060320477759999428992730280E-5L,
+  9.132668954726626677174825517150228961304E-4L,
+  2.606019379433060585351880541545146252534E-2L,
+  2.956262215119520464228467583516287175244E-1L,
+  1.149498145388256448535563278632697465675E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double pR5[7] = {
+#else
+static long double pR5[7] = {
+#endif
+  /* 4.54541015625 <= x <= 8
+     Peak relative error 6.51E-22 */
+  -2.041226787870240954326915847282179737987E-7L,
+  -2.255373879859413325570636768224534428156E-5L,
+  -7.957485746440825353553537274569102059990E-4L,
+  -1.093205102486816696940149222095559439425E-2L,
+  -5.657957849316537477657603125260701114646E-2L,
+  -8.641175552716402616180994954177818461588E-2L,
+  -1.354654710097134007437166939230619726157E-2L,
+};
+#ifdef __STDC__
+static const long double pS5[6] = {
+#else
+static long double pS5[6] = {
+#endif
+  2.903078099681108697057258628212823545290E-6L,
+  3.253948449946735405975737677123673867321E-4L,
+  1.181269751723085006534147920481582279979E-2L,
+  1.719212057790143888884745200257619469363E-1L,
+  1.006306498779212467670654535430694221924E0L,
+  2.069568808688074324555596301126375951502E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double pR3[7] = {
+#else
+static long double pR3[7] = {
+#endif
+  /* 2.85711669921875 <= x <= 4.54541015625
+     peak relative error 5.25e-21 */
+  -5.755732156848468345557663552240816066802E-6L,
+  -3.703675625855715998827966962258113034767E-4L,
+  -7.390893350679637611641350096842846433236E-3L,
+  -5.571922144490038765024591058478043873253E-2L,
+  -1.531290690378157869291151002472627396088E-1L,
+  -1.193350853469302941921647487062620011042E-1L,
+  -8.567802507331578894302991505331963782905E-3L,
+};
+#ifdef __STDC__
+static const long double pS3[6] = {
+#else
+static long double pS3[6] = {
+#endif
+  8.185931139070086158103309281525036712419E-5L,
+  5.398016943778891093520574483111255476787E-3L,
+  1.130589193590489566669164765853409621081E-1L,
+  9.358652328786413274673192987670237145071E-1L,
+  3.091711512598349056276917907005098085273E0L,
+  3.594602474737921977972586821673124231111E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double pR2[7] = {
+#else
+static long double pR2[7] = {
+#endif
+  /* 2 <= x <= 2.85711669921875
+     peak relative error 2.64e-21 */
+  -1.219525235804532014243621104365384992623E-4L,
+  -4.838597135805578919601088680065298763049E-3L,
+  -5.732223181683569266223306197751407418301E-2L,
+  -2.472947430526425064982909699406646503758E-1L,
+  -3.753373645974077960207588073975976327695E-1L,
+  -1.556241316844728872406672349347137975495E-1L,
+  -5.355423239526452209595316733635519506958E-3L,
+};
+#ifdef __STDC__
+static const long double pS2[6] = {
+#else
+static long double pS2[6] = {
+#endif
+  1.734442793664291412489066256138894953823E-3L,
+  7.158111826468626405416300895617986926008E-2L,
+  9.153839713992138340197264669867993552641E-1L,
+  4.539209519433011393525841956702487797582E0L,
+  8.868932430625331650266067101752626253644E0L,
+  6.067161890196324146320763844772857713502E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static long double
+pzero (long double x)
+#else
+static long double
+pzero (x)
+     long double x;
+#endif
+{
+#ifdef __STDC__
+  const long double *p, *q;
+#else
+  long double *p, *q;
+#endif
+  long double z, r, s;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x4002)
+    {
+      p = pR8;
+      q = pS8;
+    }				/* x >= 8 */
+  else
+    {
+      i1 = (ix << 16) | (i0 >> 16);
+      if (i1 >= 0x40019174)	/* x >= 4.54541015625 */
+	{
+	  p = pR5;
+	  q = pS5;
+	}
+      else if (i1 >= 0x4000b6db)	/* x >= 2.85711669921875 */
+	{
+	  p = pR3;
+	  q = pS3;
+	}
+      else if (ix >= 0x4000)	/* x better be >= 2 */
+	{
+	  p = pR2;
+	  q = pS2;
+	}
+    }
+  z = one / (x * x);
+  r =
+    p[0] + z * (p[1] +
+		z * (p[2] + z * (p[3] + z * (p[4] + z * (p[5] + z * p[6])))));
+  s =
+    q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * (q[5] + z)))));
+  return (one + z * r / s);
+}
+
+
+/* For x >= 8, the asymptotic expansions of qzero is
+ *	-1/8 s + 75/1024 s^3 - ..., where s = 1/x.
+ * We approximate qzero by
+ *	qzero(x) = s*(-.125 + R(s^2) / S(s^2))
+ */
+#ifdef __STDC__
+static const long double qR8[7] = {
+#else
+static long double qR8[7] = {
+#endif
+  /* 8 <= x <= inf
+     peak relative error 2.23e-21 */
+  3.001267180483191397885272640777189348008E-10L,
+  8.693186311430836495238494289942413810121E-8L,
+  8.496875536711266039522937037850596580686E-6L,
+  3.482702869915288984296602449543513958409E-4L,
+  6.036378380706107692863811938221290851352E-3L,
+  3.881970028476167836382607922840452192636E-2L,
+  6.132191514516237371140841765561219149638E-2L,
+};
+#ifdef __STDC__
+static const long double qS8[7] = {
+#else
+static long double qS8[7] = {
+#endif
+  4.097730123753051126914971174076227600212E-9L,
+  1.199615869122646109596153392152131139306E-6L,
+  1.196337580514532207793107149088168946451E-4L,
+  5.099074440112045094341500497767181211104E-3L,
+  9.577420799632372483249761659674764460583E-2L,
+  7.385243015344292267061953461563695918646E-1L,
+  1.917266424391428937962682301561699055943E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double qR5[7] = {
+#else
+static long double qR5[7] = {
+#endif
+  /* 4.54541015625 <= x <= 8
+     peak relative error 1.03e-21 */
+  3.406256556438974327309660241748106352137E-8L,
+  4.855492710552705436943630087976121021980E-6L,
+  2.301011739663737780613356017352912281980E-4L,
+  4.500470249273129953870234803596619899226E-3L,
+  3.651376459725695502726921248173637054828E-2L,
+  1.071578819056574524416060138514508609805E-1L,
+  7.458950172851611673015774675225656063757E-2L,
+};
+#ifdef __STDC__
+static const long double qS5[7] = {
+#else
+static long double qS5[7] = {
+#endif
+  4.650675622764245276538207123618745150785E-7L,
+  6.773573292521412265840260065635377164455E-5L,
+  3.340711249876192721980146877577806687714E-3L,
+  7.036218046856839214741678375536970613501E-2L,
+  6.569599559163872573895171876511377891143E-1L,
+  2.557525022583599204591036677199171155186E0L,
+  3.457237396120935674982927714210361269133E0L,
+  /* 1.000000000000000000000000000000000000000E0L,*/
+};
+
+#ifdef __STDC__
+static const long double qR3[7] = {
+#else
+static long double qR3[7] = {
+#endif
+  /* 2.85711669921875 <= x <= 4.54541015625
+     peak relative error 5.24e-21 */
+  1.749459596550816915639829017724249805242E-6L,
+  1.446252487543383683621692672078376929437E-4L,
+  3.842084087362410664036704812125005761859E-3L,
+  4.066369994699462547896426554180954233581E-2L,
+  1.721093619117980251295234795188992722447E-1L,
+  2.538595333972857367655146949093055405072E-1L,
+  8.560591367256769038905328596020118877936E-2L,
+};
+#ifdef __STDC__
+static const long double qS3[7] = {
+#else
+static long double qS3[7] = {
+#endif
+  2.388596091707517488372313710647510488042E-5L,
+  2.048679968058758616370095132104333998147E-3L,
+  5.824663198201417760864458765259945181513E-2L,
+  6.953906394693328750931617748038994763958E-1L,
+  3.638186936390881159685868764832961092476E0L,
+  7.900169524705757837298990558459547842607E0L,
+  5.992718532451026507552820701127504582907E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double qR2[7] = {
+#else
+static long double qR2[7] = {
+#endif
+  /* 2 <= x <= 2.85711669921875
+     peak relative error 1.58e-21  */
+  6.306524405520048545426928892276696949540E-5L,
+  3.209606155709930950935893996591576624054E-3L,
+  5.027828775702022732912321378866797059604E-2L,
+  3.012705561838718956481911477587757845163E-1L,
+  6.960544893905752937420734884995688523815E-1L,
+  5.431871999743531634887107835372232030655E-1L,
+  9.447736151202905471899259026430157211949E-2L,
+};
+#ifdef __STDC__
+static const long double qS2[7] = {
+#else
+static long double qS2[7] = {
+#endif
+  8.610579901936193494609755345106129102676E-4L,
+  4.649054352710496997203474853066665869047E-2L,
+  8.104282924459837407218042945106320388339E-1L,
+  5.807730930825886427048038146088828206852E0L,
+  1.795310145936848873627710102199881642939E1L,
+  2.281313316875375733663657188888110605044E1L,
+  1.011242067883822301487154844458322200143E1L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static long double
+qzero (long double x)
+#else
+static long double
+qzero (x)
+     long double x;
+#endif
+{
+#ifdef __STDC__
+  const long double *p, *q;
+#else
+  long double *p, *q;
+#endif
+  long double s, r, z;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x4002)		/* x >= 8 */
+    {
+      p = qR8;
+      q = qS8;
+    }
+  else
+    {
+      i1 = (ix << 16) | (i0 >> 16);
+      if (i1 >= 0x40019174)	/* x >= 4.54541015625 */
+	{
+	  p = qR5;
+	  q = qS5;
+	}
+      else if (i1 >= 0x4000b6db)	/* x >= 2.85711669921875 */
+	{
+	  p = qR3;
+	  q = qS3;
+	}
+      else if (ix >= 0x4000)	/* x better be >= 2 */
+	{
+	  p = qR2;
+	  q = qS2;
+	}
+    }
+  z = one / (x * x);
+  r =
+    p[0] + z * (p[1] +
+		z * (p[2] + z * (p[3] + z * (p[4] + z * (p[5] + z * p[6])))));
+  s =
+    q[0] + z * (q[1] +
+		z * (q[2] +
+		     z * (q[3] + z * (q[4] + z * (q[5] + z * (q[6] + z))))));
+  return (-.125 + z * r / s) / x;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j1l.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j1l.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_j1l.c	(revision 2147)
@@ -0,0 +1,651 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Long double expansions are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author 
+  reserves the right to distribute this material elsewhere under different
+  copying permissions.  These modifications are distributed here under 
+  the following terms:
+
+    This library is free software; you can redistribute it and/or
+    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.
+
+    This 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_j1(x), __ieee754_y1(x)
+ * Bessel function of the first and second kinds of order zero.
+ * Method -- j1(x):
+ *	1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...
+ *	2. Reduce x to |x| since j1(x)=-j1(-x),  and
+ *	   for x in (0,2)
+ *		j1(x) = x/2 + x*z*R0/S0,  where z = x*x;
+ *	   for x in (2,inf)
+ * 		j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
+ * 		y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * 	   where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ *	   as follow:
+ *		cos(x1) =  cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
+ *			=  1/sqrt(2) * (sin(x) - cos(x))
+ *		sin(x1) =  sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ *			= -1/sqrt(2) * (sin(x) + cos(x))
+ * 	   (To avoid cancellation, use
+ *		sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * 	    to compute the worse one.)
+ *
+ *	3 Special cases
+ *		j1(nan)= nan
+ *		j1(0) = 0
+ *		j1(inf) = 0
+ *
+ * Method -- y1(x):
+ *	1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN
+ *	2. For x<2.
+ *	   Since
+ *		y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)
+ *	   therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.
+ *	   We use the following function to approximate y1,
+ *		y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2
+ *	   Note: For tiny x, 1/x dominate y1 and hence
+ *		y1(tiny) = -2/pi/tiny
+ *	3. For x>=2.
+ * 		y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * 	   where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ *	   by method mentioned above.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static long double pone (long double), qone (long double);
+#else
+static long double pone (), qone ();
+#endif
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  huge = 1e4930L,
+ one = 1.0L,
+ invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
+  tpi =  6.3661977236758134307553505349005744813784e-1L,
+
+  /* J1(x) = .5 x + x x^2 R(x^2) / S(x^2)
+     0 <= x <= 2
+     Peak relative error 4.5e-21 */
+R[5] = {
+    -9.647406112428107954753770469290757756814E7L,
+    2.686288565865230690166454005558203955564E6L,
+    -3.689682683905671185891885948692283776081E4L,
+    2.195031194229176602851429567792676658146E2L,
+    -5.124499848728030297902028238597308971319E-1L,
+},
+
+  S[4] =
+{
+  1.543584977988497274437410333029029035089E9L,
+  2.133542369567701244002565983150952549520E7L,
+  1.394077011298227346483732156167414670520E5L,
+  5.252401789085732428842871556112108446506E2L,
+  /*  1.000000000000000000000000000000000000000E0L, */
+};
+
+#ifdef __STDC__
+static const long double zero = 0.0;
+#else
+static long double zero = 0.0;
+#endif
+
+
+#ifdef __STDC__
+long double
+__ieee754_j1l (long double x)
+#else
+long double
+__ieee754_j1l (x)
+     long double x;
+#endif
+{
+  long double z, c, r, s, ss, cc, u, v, y;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x7fff)
+    return one / x;
+  y = fabsl (x);
+  if (ix >= 0x4000)
+    {				/* |x| >= 2.0 */
+      __sincosl (y, &s, &c);
+      ss = -s - c;
+      cc = s - c;
+      if (ix < 0x7ffe)
+	{			/* make sure y+y not overflow */
+	  z = __cosl (y + y);
+	  if ((s * c) > zero)
+	    cc = z / ss;
+	  else
+	    ss = z / cc;
+	}
+      /*
+       * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
+       * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
+       */
+      if (ix > 0x4080)
+	z = (invsqrtpi * cc) / __ieee754_sqrtl (y);
+      else
+	{
+	  u = pone (y);
+	  v = qone (y);
+	  z = invsqrtpi * (u * cc - v * ss) / __ieee754_sqrtl (y);
+	}
+      if (se & 0x8000)
+	return -z;
+      else
+	return z;
+    }
+  if (ix < 0x3fde) /* |x| < 2^-33 */
+    {
+      if (huge + x > one)
+	return 0.5 * x;		/* inexact if x!=0 necessary */
+    }
+  z = x * x;
+  r = z * (R[0] + z * (R[1]+ z * (R[2] + z * (R[3] + z * R[4]))));
+  s = S[0] + z * (S[1] + z * (S[2] + z * (S[3] + z)));
+  r *= x;
+  return (x * 0.5 + r / s);
+}
+
+
+/* Y1(x) = 2/pi * (log(x) * j1(x) - 1/x) + x R(x^2)
+   0 <= x <= 2
+   Peak relative error 2.3e-23 */
+#ifdef __STDC__
+static const long double U0[6] = {
+#else
+static long double U0[6] = {
+#endif
+  -5.908077186259914699178903164682444848615E10L,
+  1.546219327181478013495975514375773435962E10L,
+  -6.438303331169223128870035584107053228235E8L,
+  9.708540045657182600665968063824819371216E6L,
+  -6.138043997084355564619377183564196265471E4L,
+  1.418503228220927321096904291501161800215E2L,
+};
+#ifdef __STDC__
+static const long double V0[5] = {
+#else
+static long double V0[5] = {
+#endif
+  3.013447341682896694781964795373783679861E11L,
+  4.669546565705981649470005402243136124523E9L,
+  3.595056091631351184676890179233695857260E7L,
+  1.761554028569108722903944659933744317994E5L,
+  5.668480419646516568875555062047234534863E2L,
+  /*  1.000000000000000000000000000000000000000E0L, */
+};
+
+
+#ifdef __STDC__
+long double
+__ieee754_y1l (long double x)
+#else
+long double
+__ieee754_y1l (x)
+     long double x;
+#endif
+{
+  long double z, s, c, ss, cc, u, v;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
+  if (se & 0x8000)
+    return zero / (zero * x);
+  if (ix >= 0x7fff)
+    return one / (x + x * x);
+  if ((i0 | i1) == 0)
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
+  if (ix >= 0x4000)
+    {				/* |x| >= 2.0 */
+      __sincosl (x, &s, &c);
+      ss = -s - c;
+      cc = s - c;
+      if (ix < 0x7fe00000)
+	{			/* make sure x+x not overflow */
+	  z = __cosl (x + x);
+	  if ((s * c) > zero)
+	    cc = z / ss;
+	  else
+	    ss = z / cc;
+	}
+      /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
+       * where x0 = x-3pi/4
+       *      Better formula:
+       *              cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
+       *                      =  1/sqrt(2) * (sin(x) - cos(x))
+       *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+       *                      = -1/sqrt(2) * (cos(x) + sin(x))
+       * To avoid cancellation, use
+       *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+       * to compute the worse one.
+       */
+      if (ix > 0x4080)
+	z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
+      else
+	{
+	  u = pone (x);
+	  v = qone (x);
+	  z = invsqrtpi * (u * ss + v * cc) / __ieee754_sqrtl (x);
+	}
+      return z;
+    }
+  if (ix <= 0x3fbe)
+    {				/* x < 2**-65 */
+      return (-tpi / x);
+    }
+  z = x * x;
+ u = U0[0] + z * (U0[1] + z * (U0[2] + z * (U0[3] + z * (U0[4] + z * U0[5]))));
+ v = V0[0] + z * (V0[1] + z * (V0[2] + z * (V0[3] + z * (V0[4] + z))));
+  return (x * (u / v) +
+	  tpi * (__ieee754_j1l (x) * __ieee754_logl (x) - one / x));
+}
+
+
+/* For x >= 8, the asymptotic expansions of pone is
+ *	1 + 15/128 s^2 - 4725/2^15 s^4 - ...,	where s = 1/x.
+ * We approximate pone by
+ * 	pone(x) = 1 + (R/S)
+ */
+
+/* J1(x) cosX + Y1(x) sinX  =  sqrt( 2/(pi x)) P1(x)
+   P1(x) = 1 + z^2 R(z^2), z=1/x
+   8 <= x <= inf  (0 <= z <= 0.125)
+   Peak relative error 5.2e-22  */
+
+#ifdef __STDC__
+static const long double pr8[7] = {
+#else
+static long double pr8[7] = {
+#endif
+  8.402048819032978959298664869941375143163E-9L,
+  1.813743245316438056192649247507255996036E-6L,
+  1.260704554112906152344932388588243836276E-4L,
+  3.439294839869103014614229832700986965110E-3L,
+  3.576910849712074184504430254290179501209E-2L,
+  1.131111483254318243139953003461511308672E-1L,
+  4.480715825681029711521286449131671880953E-2L,
+};
+#ifdef __STDC__
+static const long double ps8[6] = {
+#else
+static long double ps8[6] = {
+#endif
+  7.169748325574809484893888315707824924354E-8L,
+  1.556549720596672576431813934184403614817E-5L,
+  1.094540125521337139209062035774174565882E-3L,
+  3.060978962596642798560894375281428805840E-2L,
+  3.374146536087205506032643098619414507024E-1L,
+  1.253830208588979001991901126393231302559E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* J1(x) cosX + Y1(x) sinX  =  sqrt( 2/(pi x)) P1(x)
+   P1(x) = 1 + z^2 R(z^2), z=1/x
+   4.54541015625 <= x <= 8
+   Peak relative error 7.7e-22  */
+#ifdef __STDC__
+static const long double pr5[7] = {
+#else
+static long double pr5[7] = {
+#endif
+  4.318486887948814529950980396300969247900E-7L,
+  4.715341880798817230333360497524173929315E-5L,
+  1.642719430496086618401091544113220340094E-3L,
+  2.228688005300803935928733750456396149104E-2L,
+  1.142773760804150921573259605730018327162E-1L,
+  1.755576530055079253910829652698703791957E-1L,
+  3.218803858282095929559165965353784980613E-2L,
+};
+#ifdef __STDC__
+static const long double ps5[6] = {
+#else
+static long double ps5[6] = {
+#endif
+  3.685108812227721334719884358034713967557E-6L,
+  4.069102509511177498808856515005792027639E-4L,
+  1.449728676496155025507893322405597039816E-2L,
+  2.058869213229520086582695850441194363103E-1L,
+  1.164890985918737148968424972072751066553E0L,
+  2.274776933457009446573027260373361586841E0L,
+  /*  1.000000000000000000000000000000000000000E0L,*/
+};
+
+/* J1(x) cosX + Y1(x) sinX  =  sqrt( 2/(pi x)) P1(x)
+   P1(x) = 1 + z^2 R(z^2), z=1/x
+   2.85711669921875 <= x <= 4.54541015625
+   Peak relative error 6.5e-21  */
+#ifdef __STDC__
+static const long double pr3[7] = {
+#else
+static long double pr3[7] = {
+#endif
+  1.265251153957366716825382654273326407972E-5L,
+  8.031057269201324914127680782288352574567E-4L,
+  1.581648121115028333661412169396282881035E-2L,
+  1.179534658087796321928362981518645033967E-1L,
+  3.227936912780465219246440724502790727866E-1L,
+  2.559223765418386621748404398017602935764E-1L,
+  2.277136933287817911091370397134882441046E-2L,
+};
+#ifdef __STDC__
+static const long double ps3[6] = {
+#else
+static long double ps3[6] = {
+#endif
+  1.079681071833391818661952793568345057548E-4L,
+  6.986017817100477138417481463810841529026E-3L,
+  1.429403701146942509913198539100230540503E-1L,
+  1.148392024337075609460312658938700765074E0L,
+  3.643663015091248720208251490291968840882E0L,
+  3.990702269032018282145100741746633960737E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* J1(x) cosX + Y1(x) sinX  =  sqrt( 2/(pi x)) P1(x)
+   P1(x) = 1 + z^2 R(z^2), z=1/x
+   2 <= x <= 2.85711669921875
+   Peak relative error 3.5e-21  */
+#ifdef __STDC__
+static const long double pr2[7] = {
+#else
+static long double pr2[7] = {
+#endif
+  2.795623248568412225239401141338714516445E-4L,
+  1.092578168441856711925254839815430061135E-2L,
+  1.278024620468953761154963591853679640560E-1L,
+  5.469680473691500673112904286228351988583E-1L,
+  8.313769490922351300461498619045639016059E-1L,
+  3.544176317308370086415403567097130611468E-1L,
+  1.604142674802373041247957048801599740644E-2L,
+};
+#ifdef __STDC__
+static const long double ps2[6] = {
+#else
+static long double ps2[6] = {
+#endif
+  2.385605161555183386205027000675875235980E-3L,
+  9.616778294482695283928617708206967248579E-2L,
+  1.195215570959693572089824415393951258510E0L,
+  5.718412857897054829999458736064922974662E0L,
+  1.065626298505499086386584642761602177568E1L,
+  6.809140730053382188468983548092322151791E0L,
+ /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+
+#ifdef __STDC__
+static long double
+pone (long double x)
+#else
+static long double
+pone (x)
+     long double x;
+#endif
+{
+#ifdef __STDC__
+  const long double *p, *q;
+#else
+  long double *p, *q;
+#endif
+  long double z, r, s;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x4002) /* x >= 8 */
+    {
+      p = pr8;
+      q = ps8;
+    }
+  else
+    {
+      i1 = (ix << 16) | (i0 >> 16);
+      if (i1 >= 0x40019174)	/* x >= 4.54541015625 */
+	{
+	  p = pr5;
+	  q = ps5;
+	}
+      else if (i1 >= 0x4000b6db)	/* x >= 2.85711669921875 */
+	{
+	  p = pr3;
+	  q = ps3;
+	}
+      else if (ix >= 0x4000)	/* x better be >= 2 */
+	{
+	  p = pr2;
+	  q = ps2;
+	}
+    }
+  z = one / (x * x);
+ r = p[0] + z * (p[1] +
+		 z * (p[2] + z * (p[3] + z * (p[4] + z * (p[5] + z * p[6])))));
+ s = q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * (q[5] + z)))));
+  return one + z * r / s;
+}
+
+
+/* For x >= 8, the asymptotic expansions of qone is
+ *	3/8 s - 105/1024 s^3 - ..., where s = 1/x.
+ * We approximate pone by
+ * 	qone(x) = s*(0.375 + (R/S))
+ */
+
+/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
+   Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
+   8 <= x <= inf
+   Peak relative error 8.3e-22 */
+
+#ifdef __STDC__
+static const long double qr8[7] = {
+#else
+static long double qr8[7] = {
+#endif
+  -5.691925079044209246015366919809404457380E-10L,
+  -1.632587664706999307871963065396218379137E-7L,
+  -1.577424682764651970003637263552027114600E-5L,
+  -6.377627959241053914770158336842725291713E-4L,
+  -1.087408516779972735197277149494929568768E-2L,
+  -6.854943629378084419631926076882330494217E-2L,
+  -1.055448290469180032312893377152490183203E-1L,
+};
+#ifdef __STDC__
+static const long double qs8[7] = {
+#else
+static long double qs8[7] = {
+#endif
+  5.550982172325019811119223916998393907513E-9L,
+  1.607188366646736068460131091130644192244E-6L,
+  1.580792530091386496626494138334505893599E-4L,
+  6.617859900815747303032860443855006056595E-3L,
+  1.212840547336984859952597488863037659161E-1L,
+  9.017885953937234900458186716154005541075E-1L,
+  2.201114489712243262000939120146436167178E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
+   Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
+   4.54541015625 <= x <= 8
+   Peak relative error 4.1e-22 */
+#ifdef __STDC__
+static const long double qr5[7] = {
+#else
+static long double qr5[7] = {
+#endif
+  -6.719134139179190546324213696633564965983E-8L,
+  -9.467871458774950479909851595678622044140E-6L,
+  -4.429341875348286176950914275723051452838E-4L,
+  -8.539898021757342531563866270278505014487E-3L,
+  -6.818691805848737010422337101409276287170E-2L,
+  -1.964432669771684034858848142418228214855E-1L,
+  -1.333896496989238600119596538299938520726E-1L,
+};
+#ifdef __STDC__
+static const long double qs5[7] = {
+#else
+static long double qs5[7] = {
+#endif
+  6.552755584474634766937589285426911075101E-7L,
+  9.410814032118155978663509073200494000589E-5L,
+  4.561677087286518359461609153655021253238E-3L,
+  9.397742096177905170800336715661091535805E-2L,
+  8.518538116671013902180962914473967738771E-1L,
+  3.177729183645800174212539541058292579009E0L,
+  4.006745668510308096259753538973038902990E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
+   Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
+   2.85711669921875 <= x <= 4.54541015625
+   Peak relative error 2.2e-21 */
+#ifdef __STDC__
+static const long double qr3[7] = {
+#else
+static long double qr3[7] = {
+#endif
+  -3.618746299358445926506719188614570588404E-6L,
+  -2.951146018465419674063882650970344502798E-4L,
+  -7.728518171262562194043409753656506795258E-3L,
+  -8.058010968753999435006488158237984014883E-2L,
+  -3.356232856677966691703904770937143483472E-1L,
+  -4.858192581793118040782557808823460276452E-1L,
+  -1.592399251246473643510898335746432479373E-1L,
+};
+#ifdef __STDC__
+static const long double qs3[7] = {
+#else
+static long double qs3[7] = {
+#endif
+  3.529139957987837084554591421329876744262E-5L,
+  2.973602667215766676998703687065066180115E-3L,
+  8.273534546240864308494062287908662592100E-2L,
+  9.613359842126507198241321110649974032726E-1L,
+  4.853923697093974370118387947065402707519E0L,
+  1.002671608961669247462020977417828796933E1L,
+  7.028927383922483728931327850683151410267E0L,
+  /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
+   Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
+   2 <= x <= 2.85711669921875
+   Peak relative error 6.9e-22 */
+#ifdef __STDC__
+static const long double qr2[7] = {
+#else
+static long double qr2[7] = {
+#endif
+  -1.372751603025230017220666013816502528318E-4L,
+  -6.879190253347766576229143006767218972834E-3L,
+  -1.061253572090925414598304855316280077828E-1L,
+  -6.262164224345471241219408329354943337214E-1L,
+  -1.423149636514768476376254324731437473915E0L,
+  -1.087955310491078933531734062917489870754E0L,
+  -1.826821119773182847861406108689273719137E-1L,
+};
+#ifdef __STDC__
+static const long double qs2[7] = {
+#else
+static long double qs2[7] = {
+#endif
+  1.338768933634451601814048220627185324007E-3L,
+  7.071099998918497559736318523932241901810E-2L,
+  1.200511429784048632105295629933382142221E0L,
+  8.327301713640367079030141077172031825276E0L,
+  2.468479301872299311658145549931764426840E1L,
+  2.961179686096262083509383820557051621644E1L,
+  1.201402313144305153005639494661767354977E1L,
+ /* 1.000000000000000000000000000000000000000E0L, */
+};
+
+
+#ifdef __STDC__
+static long double
+qone (long double x)
+#else
+static long double
+qone (x)
+     long double x;
+#endif
+{
+#ifdef __STDC__
+  const long double *p, *q;
+#else
+  long double *p, *q;
+#endif
+  static long double s, r, z;
+  int32_t ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  if (ix >= 0x4002)		/* x >= 8 */
+    {
+      p = qr8;
+      q = qs8;
+    }
+  else
+    {
+      i1 = (ix << 16) | (i0 >> 16);
+      if (i1 >= 0x40019174)	/* x >= 4.54541015625 */
+	{
+	  p = qr5;
+	  q = qs5;
+	}
+      else if (i1 >= 0x4000b6db)	/* x >= 2.85711669921875 */
+	{
+	  p = qr3;
+	  q = qs3;
+	}
+      else if (ix >= 0x4000)	/* x better be >= 2 */
+	{
+	  p = qr2;
+	  q = qs2;
+	}
+    }
+  z = one / (x * x);
+  r =
+    p[0] + z * (p[1] +
+		z * (p[2] + z * (p[3] + z * (p[4] + z * (p[5] + z * p[6])))));
+  s =
+    q[0] + z * (q[1] +
+		z * (q[2] +
+		     z * (q[3] + z * (q[4] + z * (q[5] + z * (q[6] + z))))));
+  return (.375 + z * r / s) / x;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_jnl.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_jnl.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_jnl.c	(revision 2147)
@@ -0,0 +1,386 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications for long double are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author 
+  reserves the right to distribute this material elsewhere under different
+  copying permissions.  These modifications are distributed here under 
+  the following terms:
+
+    This library is free software; you can redistribute it and/or
+    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.
+
+    This 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/*
+ * __ieee754_jn(n, x), __ieee754_yn(n, x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with overflow signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ *	For n=0, j0(x) is called,
+ *	for n=1, j1(x) is called,
+ *	for n<x, forward recursion us used starting
+ *	from values of j0(x) and j1(x).
+ *	for n>x, a continued fraction approximation to
+ *	j(n,x)/j(n-1,x) is evaluated and then backward
+ *	recursion is used starting from a supposed value
+ *	for j(n,x). The resulting value of j(0,x) is
+ *	compared with the actual value to correct the
+ *	supposed value of j(n,x).
+ *
+ *	yn(n,x) is similar in all respects, except
+ *	that forward recursion is used for all
+ *	values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L;
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+#ifdef __STDC__
+long double
+__ieee754_jnl (int n, long double x)
+#else
+long double
+__ieee754_jnl (n, x)
+     int n;
+     long double x;
+#endif
+{
+  u_int32_t se, i0, i1;
+  int32_t i, ix, sgn;
+  long double a, b, temp, di;
+  long double z, w;
+
+  /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+   * Thus, J(-n,x) = J(n,-x)
+   */
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+
+  /* if J(n,NaN) is NaN */
+  if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+    return x + x;
+  if (n < 0)
+    {
+      n = -n;
+      x = -x;
+      se ^= 0x8000;
+    }
+  if (n == 0)
+    return (__ieee754_j0l (x));
+  if (n == 1)
+    return (__ieee754_j1l (x));
+  sgn = (n & 1) & (se >> 15);	/* even n -- 0, odd n -- sign(x) */
+  x = fabsl (x);
+  if ((ix | i0 | i1) == 0 || ix >= 0x7fff)	/* if x is 0 or inf */
+    b = zero;
+  else if ((long double) n <= x)
+    {
+      /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
+      if (ix >= 0x412D)
+	{			/* x > 2**302 */
+
+	  /* ??? This might be a futile gesture.
+	     If x exceeds X_TLOSS anyway, the wrapper function
+	     will set the result to zero. */
+
+	  /* (x >> n**2)
+	   *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+	   *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+	   *      Let s=sin(x), c=cos(x),
+	   *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+	   *
+	   *             n    sin(xn)*sqt2    cos(xn)*sqt2
+	   *          ----------------------------------
+	   *             0     s-c             c+s
+	   *             1    -s-c            -c+s
+	   *             2    -s+c            -c-s
+	   *             3     s+c             c-s
+	   */
+	  long double s;
+	  long double c;
+	  __sincosl (x, &s, &c);
+	  switch (n & 3)
+	    {
+	    case 0:
+	      temp = c + s;
+	      break;
+	    case 1:
+	      temp = -c + s;
+	      break;
+	    case 2:
+	      temp = -c - s;
+	      break;
+	    case 3:
+	      temp = c - s;
+	      break;
+	    }
+	  b = invsqrtpi * temp / __ieee754_sqrtl (x);
+	}
+      else
+	{
+	  a = __ieee754_j0l (x);
+	  b = __ieee754_j1l (x);
+	  for (i = 1; i < n; i++)
+	    {
+	      temp = b;
+	      b = b * ((long double) (i + i) / x) - a;	/* avoid underflow */
+	      a = temp;
+	    }
+	}
+    }
+  else
+    {
+      if (ix < 0x3fde)
+	{			/* x < 2**-33 */
+	  /* x is tiny, return the first Taylor expansion of J(n,x)
+	   * J(n,x) = 1/n!*(x/2)^n  - ...
+	   */
+	  if (n >= 400)		/* underflow, result < 10^-4952 */
+	    b = zero;
+	  else
+	    {
+	      temp = x * 0.5;
+	      b = temp;
+	      for (a = one, i = 2; i <= n; i++)
+		{
+		  a *= (long double) i;	/* a = n! */
+		  b *= temp;	/* b = (x/2)^n */
+		}
+	      b = b / a;
+	    }
+	}
+      else
+	{
+	  /* use backward recurrence */
+	  /*                      x      x^2      x^2
+	   *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....
+	   *                      2n  - 2(n+1) - 2(n+2)
+	   *
+	   *                      1      1        1
+	   *  (for large x)   =  ----  ------   ------   .....
+	   *                      2n   2(n+1)   2(n+2)
+	   *                      -- - ------ - ------ -
+	   *                       x     x         x
+	   *
+	   * Let w = 2n/x and h=2/x, then the above quotient
+	   * is equal to the continued fraction:
+	   *                  1
+	   *      = -----------------------
+	   *                     1
+	   *         w - -----------------
+	   *                        1
+	   *              w+h - ---------
+	   *                     w+2h - ...
+	   *
+	   * To determine how many terms needed, let
+	   * Q(0) = w, Q(1) = w(w+h) - 1,
+	   * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
+	   * When Q(k) > 1e4      good for single
+	   * When Q(k) > 1e9      good for double
+	   * When Q(k) > 1e17     good for quadruple
+	   */
+	  /* determine k */
+	  long double t, v;
+	  long double q0, q1, h, tmp;
+	  int32_t k, m;
+	  w = (n + n) / (long double) x;
+	  h = 2.0L / (long double) x;
+	  q0 = w;
+	  z = w + h;
+	  q1 = w * z - 1.0L;
+	  k = 1;
+	  while (q1 < 1.0e11L)
+	    {
+	      k += 1;
+	      z += h;
+	      tmp = z * q1 - q0;
+	      q0 = q1;
+	      q1 = tmp;
+	    }
+	  m = n + n;
+	  for (t = zero, i = 2 * (n + k); i >= m; i -= 2)
+	    t = one / (i / x - t);
+	  a = t;
+	  b = one;
+	  /*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
+	   *  Hence, if n*(log(2n/x)) > ...
+	   *  single 8.8722839355e+01
+	   *  double 7.09782712893383973096e+02
+	   *  long double 1.1356523406294143949491931077970765006170e+04
+	   *  then recurrent value may overflow and the result is
+	   *  likely underflow to zero
+	   */
+	  tmp = n;
+	  v = two / x;
+	  tmp = tmp * __ieee754_logl (fabsl (v * tmp));
+
+	  if (tmp < 1.1356523406294143949491931077970765006170e+04L)
+	    {
+	      for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+		{
+		  temp = b;
+		  b *= di;
+		  b = b / x - a;
+		  a = temp;
+		  di -= two;
+		}
+	    }
+	  else
+	    {
+	      for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+		{
+		  temp = b;
+		  b *= di;
+		  b = b / x - a;
+		  a = temp;
+		  di -= two;
+		  /* scale b to avoid spurious overflow */
+		  if (b > 1e100L)
+		    {
+		      a /= b;
+		      t /= b;
+		      b = one;
+		    }
+		}
+	    }
+	  b = (t * __ieee754_j0l (x) / b);
+	}
+    }
+  if (sgn == 1)
+    return -b;
+  else
+    return b;
+}
+
+#ifdef __STDC__
+long double
+__ieee754_ynl (int n, long double x)
+#else
+long double
+__ieee754_ynl (n, x)
+     int n;
+     long double x;
+#endif
+{
+  u_int32_t se, i0, i1;
+  int32_t i, ix;
+  int32_t sign;
+  long double a, b, temp;
+
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  /* if Y(n,NaN) is NaN */
+  if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+    return x + x;
+  if ((ix | i0 | i1) == 0)
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
+  if (se & 0x8000)
+    return zero / (zero * x);
+  sign = 1;
+  if (n < 0)
+    {
+      n = -n;
+      sign = 1 - ((n & 1) << 1);
+    }
+  if (n == 0)
+    return (__ieee754_y0l (x));
+  if (n == 1)
+    return (sign * __ieee754_y1l (x));
+  if (ix == 0x7fff)
+    return zero;
+  if (ix >= 0x412D)
+    {				/* x > 2**302 */
+
+      /* ??? See comment above on the possible futility of this.  */
+
+      /* (x >> n**2)
+       *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+       *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+       *      Let s=sin(x), c=cos(x),
+       *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+       *
+       *             n    sin(xn)*sqt2    cos(xn)*sqt2
+       *          ----------------------------------
+       *             0     s-c             c+s
+       *             1    -s-c            -c+s
+       *             2    -s+c            -c-s
+       *             3     s+c             c-s
+       */
+      long double s;
+      long double c;
+      __sincosl (x, &s, &c);
+      switch (n & 3)
+	{
+	case 0:
+	  temp = s - c;
+	  break;
+	case 1:
+	  temp = -s - c;
+	  break;
+	case 2:
+	  temp = -s + c;
+	  break;
+	case 3:
+	  temp = s + c;
+	  break;
+	}
+      b = invsqrtpi * temp / __ieee754_sqrtl (x);
+    }
+  else
+    {
+      a = __ieee754_y0l (x);
+      b = __ieee754_y1l (x);
+      /* quit if b is -inf */
+      GET_LDOUBLE_WORDS (se, i0, i1, b);
+      for (i = 1; i < n && se != 0xffff; i++)
+	{
+	  temp = b;
+	  b = ((long double) (i + i) / x) * b - a;
+	  GET_LDOUBLE_WORDS (se, i0, i1, b);
+	  a = temp;
+	}
+    }
+  if (sign > 0)
+    return b;
+  else
+    return -b;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_lgammal_r.c	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/e_lgammal_r.c	(revision 2147)
@@ -0,0 +1,446 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Long double expansions are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author 
+  reserves the right to distribute this material elsewhere under different
+  copying permissions.  These modifications are distributed here under 
+  the following terms:
+
+    This library is free software; you can redistribute it and/or
+    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.
+
+    This 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_lgammal_r(x, signgamp)
+ * Reentrant version of the logarithm of the Gamma function
+ * with user provide pointer for the sign of Gamma(x).
+ *
+ * Method:
+ *   1. Argument Reduction for 0 < x <= 8
+ *	Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
+ *	reduce x to a number in [1.5,2.5] by
+ *		lgamma(1+s) = log(s) + lgamma(s)
+ *	for example,
+ *		lgamma(7.3) = log(6.3) + lgamma(6.3)
+ *			    = log(6.3*5.3) + lgamma(5.3)
+ *			    = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
+ *   2. Polynomial approximation of lgamma around its
+ *	minimun ymin=1.461632144968362245 to maintain monotonicity.
+ *	On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
+ *		Let z = x-ymin;
+ *		lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
+ *   2. Rational approximation in the primary interval [2,3]
+ *	We use the following approximation:
+ *		s = x-2.0;
+ *		lgamma(x) = 0.5*s + s*P(s)/Q(s)
+ *	Our algorithms are based on the following observation
+ *
+ *                             zeta(2)-1    2    zeta(3)-1    3
+ * lgamma(2+s) = s*(1-Euler) + --------- * s  -  --------- * s  + ...
+ *                                 2                 3
+ *
+ *	where Euler = 0.5771... is the Euler constant, which is very
+ *	close to 0.5.
+ *
+ *   3. For x>=8, we have
+ *	lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....
+ *	(better formula:
+ *	   lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)
+ *	Let z = 1/x, then we approximation
+ *		f(z) = lgamma(x) - (x-0.5)(log(x)-1)
+ *	by
+ *				    3       5             11
+ *		w = w0 + w1*z + w2*z  + w3*z  + ... + w6*z
+ *
+ *   4. For negative x, since (G is gamma function)
+ *		-x*G(-x)*G(x) = pi/sin(pi*x),
+ *	we have
+ *		G(x) = pi/(sin(pi*x)*(-x)*G(-x))
+ *	since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
+ *	Hence, for x<0, signgam = sign(sin(pi*x)) and
+ *		lgamma(x) = log(|Gamma(x)|)
+ *			  = log(pi/(|x*sin(pi*x)|)) - lgamma(-x);
+ *	Note: one should avoid compute pi*(-x) directly in the
+ *	      computation of sin(pi*(-x)).
+ *
+ *   5. Special Cases
+ *		lgamma(2+s) ~ s*(1-Euler) for tiny s
+ *		lgamma(1)=lgamma(2)=0
+ *		lgamma(x) ~ -log(x) for tiny x
+ *		lgamma(0) = lgamma(inf) = inf
+ *		lgamma(-integer) = +-inf
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  half = 0.5L,
+  one = 1.0L,
+  pi = 3.14159265358979323846264L,
+  two63 = 9.223372036854775808e18L,
+
+  /* lgam(1+x) = 0.5 x + x a(x)/b(x)
+     -0.268402099609375 <= x <= 0
+     peak relative error 6.6e-22 */
+  a0 = -6.343246574721079391729402781192128239938E2L,
+  a1 =  1.856560238672465796768677717168371401378E3L,
+  a2 =  2.404733102163746263689288466865843408429E3L,
+  a3 =  8.804188795790383497379532868917517596322E2L,
+  a4 =  1.135361354097447729740103745999661157426E2L,
+  a5 =  3.766956539107615557608581581190400021285E0L,
+
+  b0 =  8.214973713960928795704317259806842490498E3L,
+  b1 =  1.026343508841367384879065363925870888012E4L,
+  b2 =  4.553337477045763320522762343132210919277E3L,
+  b3 =  8.506975785032585797446253359230031874803E2L,
+  b4 =  6.042447899703295436820744186992189445813E1L,
+  /* b5 =  1.000000000000000000000000000000000000000E0 */
+
+
+  tc =  1.4616321449683623412626595423257213284682E0L,
+  tf = -1.2148629053584961146050602565082954242826E-1,/* double precision */
+/* tt = (tail of tf), i.e. tf + tt has extended precision. */
+  tt = 3.3649914684731379602768989080467587736363E-18L,
+  /* lgam ( 1.4616321449683623412626595423257213284682E0 ) =
+-1.2148629053584960809551455717769158215135617312999903886372437313313530E-1 */
+
+  /* lgam (x + tc) = tf + tt + x g(x)/h(x)
+     - 0.230003726999612341262659542325721328468 <= x
+     <= 0.2699962730003876587373404576742786715318
+     peak relative error 2.1e-21 */
+  g0 = 3.645529916721223331888305293534095553827E-18L,
+  g1 = 5.126654642791082497002594216163574795690E3L,
+  g2 = 8.828603575854624811911631336122070070327E3L,
+  g3 = 5.464186426932117031234820886525701595203E3L,
+  g4 = 1.455427403530884193180776558102868592293E3L,
+  g5 = 1.541735456969245924860307497029155838446E2L,
+  g6 = 4.335498275274822298341872707453445815118E0L,
+
+  h0 = 1.059584930106085509696730443974495979641E4L,
+  h1 =  2.147921653490043010629481226937850618860E4L,
+  h2 = 1.643014770044524804175197151958100656728E4L,
+  h3 =  5.869021995186925517228323497501767586078E3L,
+  h4 =  9.764244777714344488787381271643502742293E2L,
+  h5 =  6.442485441570592541741092969581997002349E1L,
+  /* h6 = 1.000000000000000000000000000000000000000E0 */
+
+
+  /* lgam (x+1) = -0.5 x + x u(x)/v(x)
+     -0.100006103515625 <= x <= 0.231639862060546875
+     peak relative error 1.3e-21 */
+  u0 = -8.886217500092090678492242071879342025627E1L,
+  u1 =  6.840109978129177639438792958320783599310E2L,
+  u2 =  2.042626104514127267855588786511809932433E3L,
+  u3 =  1.911723903442667422201651063009856064275E3L,
+  u4 =  7.447065275665887457628865263491667767695E2L,
+  u5 =  1.132256494121790736268471016493103952637E2L,
+  u6 =  4.484398885516614191003094714505960972894E0L,
+
+  v0 =  1.150830924194461522996462401210374632929E3L,
+  v1 =  3.399692260848747447377972081399737098610E3L,
+  v2 =  3.786631705644460255229513563657226008015E3L,
+  v3 =  1.966450123004478374557778781564114347876E3L,
+  v4 =  4.741359068914069299837355438370682773122E2L,
+  v5 =  4.508989649747184050907206782117647852364E1L,
+  /* v6 =  1.000000000000000000000000000000000000000E0 */
+
+
+  /* lgam (x+2) = .5 x + x s(x)/r(x)
+     0 <= x <= 1
+     peak relative error 7.2e-22 */
+  s0 =  1.454726263410661942989109455292824853344E6L,
+  s1 = -3.901428390086348447890408306153378922752E6L,
+  s2 = -6.573568698209374121847873064292963089438E6L,
+  s3 = -3.319055881485044417245964508099095984643E6L,
+  s4 = -7.094891568758439227560184618114707107977E5L,
+  s5 = -6.263426646464505837422314539808112478303E4L,
+  s6 = -1.684926520999477529949915657519454051529E3L,
+
+  r0 = -1.883978160734303518163008696712983134698E7L,
+  r1 = -2.815206082812062064902202753264922306830E7L,
+  r2 = -1.600245495251915899081846093343626358398E7L,
+  r3 = -4.310526301881305003489257052083370058799E6L,
+  r4 = -5.563807682263923279438235987186184968542E5L,
+  r5 = -3.027734654434169996032905158145259713083E4L,
+  r6 = -4.501995652861105629217250715790764371267E2L,
+  /* r6 =  1.000000000000000000000000000000000000000E0 */
+
+
+/* lgam(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x w(1/x^2)
+   x >= 8
+   Peak relative error 1.51e-21
+   w0 = LS2PI - 0.5 */
+  w0 =  4.189385332046727417803e-1L,
+  w1 =  8.333333333333331447505E-2L,
+  w2 = -2.777777777750349603440E-3L,
+  w3 =  7.936507795855070755671E-4L,
+  w4 = -5.952345851765688514613E-4L,
+  w5 =  8.412723297322498080632E-4L,
+  w6 = -1.880801938119376907179E-3L,
+  w7 =  4.885026142432270781165E-3L;
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+#ifdef __STDC__
+static long double
+sin_pi (long double x)
+#else
+static long double
+sin_pi (x)
+     long double x;
+#endif
+{
+  long double y, z;
+  int n, ix;
+  u_int32_t se, i0, i1;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+  ix = (ix << 16) | (i0 >> 16);
+  if (ix < 0x3ffd8000) /* 0.25 */
+    return __sinl (pi * x);
+  y = -x;			/* x is assume negative */
+
+  /*
+   * argument reduction, make sure inexact flag not raised if input
+   * is an integer
+   */
+  z = __floorl (y);
+  if (z != y)
+    {				/* inexact anyway */
+      y  *= 0.5;
+      y = 2.0*(y - __floorl(y));		/* y = |x| mod 2.0 */
+      n = (int) (y*4.0);
+    }
+  else
+    {
+      if (ix >= 0x403f8000)  /* 2^64 */
+	{
+	  y = zero; n = 0;                 /* y must be even */
+	}
+      else
+	{
+	if (ix < 0x403e8000)  /* 2^63 */
+	  z = y + two63;	/* exact */
+	GET_LDOUBLE_WORDS (se, i0, i1, z);
+	n = i1 & 1;
+	y  = n;
+	n <<= 2;
+      }
+    }
+
+  switch (n)
+    {
+    case 0:
+      y = __sinl (pi * y);
+      break;
+    case 1:
+    case 2:
+      y = __cosl (pi * (half - y));
+      break;
+    case 3:
+    case 4:
+      y = __sinl (pi * (one - y));
+      break;
+    case 5:
+    case 6:
+      y = -__cosl (pi * (y - 1.5));
+      break;
+    default:
+      y = __sinl (pi * (y - 2.0));
+      break;
+    }
+  return -y;
+}
+
+
+#ifdef __STDC__
+long double
+__ieee754_lgammal_r (long double x, int *signgamp)
+#else
+long double
+__ieee754_lgammal_r (x, signgamp)
+     long double x;
+     int *signgamp;
+#endif
+{
+  long double t, y, z, nadj, p, p1, p2, q, r, w;
+  int i, ix;
+  u_int32_t se, i0, i1;
+
+  *signgamp = 1;
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  ix = se & 0x7fff;
+
+  if ((ix | i0 | i1) == 0)
+    return one / fabsl (x);
+
+  ix = (ix << 16) | (i0 >> 16);
+
+  /* purge off +-inf, NaN, +-0, and negative arguments */
+  if (ix >= 0x7fff0000)
+    return x * x;
+
+  if (ix < 0x3fc08000) /* 2^-63 */
+    {				/* |x|<2**-63, return -log(|x|) */
+      if (se & 0x8000)
+	{
+	  *signgamp = -1;
+	  return -__ieee754_logl (-x);
+	}
+      else
+	return -__ieee754_logl (x);
+    }
+  if (se & 0x8000)
+    {
+      t = sin_pi (x);
+      if (t == zero)
+	return one / fabsl (t);	/* -integer */
+      nadj = __ieee754_logl (pi / fabsl (t * x));
+      if (t < zero)
+	*signgamp = -1;
+      x = -x;
+    }
+
+  /* purge off 1 and 2 */
+  if ((((ix - 0x3fff8000) | i0 | i1) == 0)
+      || (((ix - 0x40008000) | i0 | i1) == 0))
+    r = 0;
+  else if (ix < 0x40008000) /* 2.0 */
+    {
+      /* x < 2.0 */
+      if (ix <= 0x3ffee666) /* 8.99993896484375e-1 */
+	{
+	  /* lgamma(x) = lgamma(x+1) - log(x) */
+	  r = -__ieee754_logl (x);
+	  if (ix >= 0x3ffebb4a) /* 7.31597900390625e-1 */
+	    {
+	      y = x - one;
+	      i = 0;
+	    }
+	  else if (ix >= 0x3ffced33)/* 2.31639862060546875e-1 */
+	    {
+	      y = x - (tc - one);
+	      i = 1;
+	    }
+	  else
+	    {
+	      /* x < 0.23 */
+	      y = x;
+	      i = 2;
+	    }
+	}
+      else
+	{
+	  r = zero;
+	  if (ix >= 0x3fffdda6) /* 1.73162841796875 */
+	    {
+	      /* [1.7316,2] */
+	      y = x - 2.0;
+	      i = 0;
+	    }
+	  else if (ix >= 0x3fff9da6)/* 1.23162841796875 */
+	    {
+	      /* [1.23,1.73] */
+	      y = x - tc;
+	      i = 1;
+	    }
+	  else
+	    {
+	      /* [0.9, 1.23] */
+	      y = x - one;
+	      i = 2;
+	    }
+	}
+      switch (i)
+	{
+	case 0:
+	  p1 = a0 + y * (a1 + y * (a2 + y * (a3 + y * (a4 + y * a5))));
+	  p2 = b0 + y * (b1 + y * (b2 + y * (b3 + y * (b4 + y))));
+	  r += half * y + y * p1/p2;
+	  break;
+	case 1:
+    p1 = g0 + y * (g1 + y * (g2 + y * (g3 + y * (g4 + y * (g5 + y * g6)))));
+    p2 = h0 + y * (h1 + y * (h2 + y * (h3 + y * (h4 + y * (h5 + y)))));
+    p = tt + y * p1/p2;
+	  r += (tf + p);
+	  break;
+	case 2:
+ p1 = y * (u0 + y * (u1 + y * (u2 + y * (u3 + y * (u4 + y * (u5 + y * u6))))));
+      p2 = v0 + y * (v1 + y * (v2 + y * (v3 + y * (v4 + y * (v5 + y)))));
+	  r += (-half * y + p1 / p2);
+	}
+    }
+  else if (ix < 0x40028000) /* 8.0 */
+    {
+      /* x < 8.0 */
+      i = (int) x;
+      t = zero;
+      y = x - (double) i;
+  p = y *
+     (s0 + y * (s1 + y * (s2 + y * (s3 + y * (s4 + y * (s5 + y * s6))))));
+  q = r0 + y * (r1 + y * (r2 + y * (r3 + y * (r4 + y * (r5 + y * (r6 + y))))));
+      r = half * y + p / q;
+      z = one;			/* lgamma(1+s) = log(s) + lgamma(s) */
+      switch (i)
+	{
+	case 7:
+	  z *= (y + 6.0);	/* FALLTHRU */
+	case 6:
+	  z *= (y + 5.0);	/* FALLTHRU */
+	case 5:
+	  z *= (y + 4.0);	/* FALLTHRU */
+	case 4:
+	  z *= (y + 3.0);	/* FALLTHRU */
+	case 3:
+	  z *= (y + 2.0);	/* FALLTHRU */
+	  r += __ieee754_logl (z);
+	  break;
+	}
+    }
+  else if (ix < 0x40418000) /* 2^66 */
+    {
+      /* 8.0 <= x < 2**66 */
+      t = __ieee754_logl (x);
+      z = one / x;
+      y = z * z;
+      w = w0 + z * (w1
+          + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7))))));
+      r = (x - half) * (t - one) + w;
+    }
+  else
+    /* 2**66 <= x <= inf */
+    r = x * (__ieee754_logl (x) - one);
+  if (se & 0x8000)
+    r = nadj - r;
+  return r;
+}
Index: trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/math_ldbl.h
===================================================================
--- trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/math_ldbl.h	(revision 2147)
+++ trunk/src/emx/src/lib/lgpl/sysdeps/ieee754/ldbl-96/math_ldbl.h	(revision 2147)
@@ -0,0 +1,98 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+/* A union which permits us to convert between a long double and
+   three 32 bit ints.  */
+
+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
+
+typedef union
+{
+  long double value;
+  struct
+  {
+    int sign_exponent:16;
+    unsigned int empty:16;
+    u_int32_t msw;
+    u_int32_t lsw;
+  } parts;
+} ieee_long_double_shape_type;
+
+#endif
+
+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+
+typedef union
+{
+  long double value;
+  struct
+  {
+    u_int32_t lsw;
+    u_int32_t msw;
+    int sign_exponent:16;
+    unsigned int empty:16;
+  } parts;
+} ieee_long_double_shape_type;
+
+#endif
+
+/* Get three 32 bit ints from a double.  */
+
+#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d)			\
+do {								\
+  ieee_long_double_shape_type ew_u;				\
+  ew_u.value = (d);						\
+  (exp) = ew_u.parts.sign_exponent;				\
+  (ix0) = ew_u.parts.msw;					\
+  (ix1) = ew_u.parts.lsw;					\
+} while (0)
+
+/* Set a double from two 32 bit ints.  */
+
+#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1)			\
+do {								\
+  ieee_long_double_shape_type iw_u;				\
+  iw_u.parts.sign_exponent = (exp);				\
+  iw_u.parts.msw = (ix0);					\
+  iw_u.parts.lsw = (ix1);					\
+  (d) = iw_u.value;						\
+} while (0)
+
+/* Get the more significant 32 bits of a long double mantissa.  */
+
+#define GET_LDOUBLE_MSW(v,d)					\
+do {								\
+  ieee_long_double_shape_type sh_u;				\
+  sh_u.value = (d);						\
+  (v) = sh_u.parts.msw;						\
+} while (0)
+
+/* Set the more significant 32 bits of a long double mantissa from an int.  */
+
+#define SET_LDOUBLE_MSW(d,v)					\
+do {								\
+  ieee_long_double_shape_type sh_u;				\
+  sh_u.value = (d);						\
+  sh_u.parts.msw = (v);						\
+  (d) = sh_u.value;						\
+} while (0)
+
+/* Get int from the exponent of a long double.  */
+
+#define GET_LDOUBLE_EXP(exp,d)					\
+do {								\
+  ieee_long_double_shape_type ge_u;				\
+  ge_u.value = (d);						\
+  (exp) = ge_u.parts.sign_exponent;				\
+} while (0)
+
+/* Set exponent of a long double from an int.  */
+
+#define SET_LDOUBLE_EXP(d,exp)					\
+do {								\
+  ieee_long_double_shape_type se_u;				\
+  se_u.value = (d);						\
+  se_u.parts.sign_exponent = (exp);				\
+  (d) = se_u.value;						\
+} while (0)
