--- /dev/null	Thu Oct  9 19:48:51 2014
+++ new/usr/src/head/complex.h	Thu Oct  9 19:48:51 2014
@@ -0,0 +1,134 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _COMPLEX_H
+#define	_COMPLEX_H
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/* #if !defined(__cplusplus) */
+
+/*
+ * Compilation environments for Solaris must provide the _Imaginary datatype
+ * and the compiler intrinsics _Complex_I and _Imaginary_I
+ */
+#if defined(__SUNPRO_C)
+#define	_Complex_I	_Complex_I
+#define	_Imaginary_I	_Imaginary_I
+#else
+#define	_Complex_I	1.0fi
+#define	_Imaginary_I	1.0fi
+#endif
+#define	complex		_Complex
+#define	imaginary	_Imaginary
+#undef	I
+#define	I		_Imaginary_I
+
+extern float cabsf(float complex);
+extern float cargf(float complex);
+extern float cimagf(float complex);
+extern float crealf(float complex);
+extern float complex cacosf(float complex);
+extern float complex cacoshf(float complex);
+extern float complex casinf(float complex);
+extern float complex casinhf(float complex);
+extern float complex catanf(float complex);
+extern float complex catanhf(float complex);
+extern float complex ccosf(float complex);
+extern float complex ccoshf(float complex);
+extern float complex cexpf(float complex);
+extern float complex clogf(float complex);
+extern float complex conjf(float complex);
+extern float complex cpowf(float complex, float complex);
+extern float complex cprojf(float complex);
+extern float complex csinf(float complex);
+extern float complex csinhf(float complex);
+extern float complex csqrtf(float complex);
+extern float complex ctanf(float complex);
+extern float complex ctanhf(float complex);
+
+extern double cabs(double complex);
+extern double carg(double complex);
+extern double cimag(double complex);
+extern double creal(double complex);
+extern double complex cacos(double complex);
+extern double complex cacosh(double complex);
+extern double complex casin(double complex);
+extern double complex casinh(double complex);
+extern double complex catan(double complex);
+extern double complex catanh(double complex);
+extern double complex ccos(double complex);
+extern double complex ccosh(double complex);
+extern double complex cexp(double complex);
+#if defined(__PRAGMA_REDEFINE_EXTNAME)
+#pragma redefine_extname clog __clog
+#else
+#undef	clog
+#define	clog	__clog
+#endif
+extern double complex clog(double complex);
+extern double complex conj(double complex);
+extern double complex cpow(double complex, double complex);
+extern double complex cproj(double complex);
+extern double complex csin(double complex);
+extern double complex csinh(double complex);
+extern double complex csqrt(double complex);
+extern double complex ctan(double complex);
+extern double complex ctanh(double complex);
+
+extern long double cabsl(long double complex);
+extern long double cargl(long double complex);
+extern long double cimagl(long double complex);
+extern long double creall(long double complex);
+extern long double complex cacoshl(long double complex);
+extern long double complex cacosl(long double complex);
+extern long double complex casinhl(long double complex);
+extern long double complex casinl(long double complex);
+extern long double complex catanhl(long double complex);
+extern long double complex catanl(long double complex);
+extern long double complex ccoshl(long double complex);
+extern long double complex ccosl(long double complex);
+extern long double complex cexpl(long double complex);
+extern long double complex clogl(long double complex);
+extern long double complex conjl(long double complex);
+extern long double complex cpowl(long double complex, long double complex);
+extern long double complex cprojl(long double complex);
+extern long double complex csinhl(long double complex);
+extern long double complex csinl(long double complex);
+extern long double complex csqrtl(long double complex);
+extern long double complex ctanhl(long double complex);
+extern long double complex ctanl(long double complex);
+
+/* #endif */	/* !defined(__cplusplus) */
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _COMPLEX_H */
--- /dev/null	Thu Oct  9 19:48:51 2014
+++ new/usr/src/head/floatingpoint.h	Thu Oct  9 19:48:51 2014
@@ -0,0 +1,212 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*	Copyright (C) 1989 AT&T	*/
+/*	  All Rights Reserved */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _FLOATINGPOINT_H
+#define	_FLOATINGPOINT_H
+
+#ifdef __STDC__
+#include <stdio_tag.h>
+#endif
+#include <sys/ieeefp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * <floatingpoint.h> contains definitions for constants, types, variables,
+ * and functions for:
+ *	IEEE floating-point arithmetic base conversion;
+ *	IEEE floating-point arithmetic modes;
+ *	IEEE floating-point arithmetic exception handling.
+ */
+
+#ifndef __P
+#ifdef __STDC__
+#define	__P(p)	p
+#else
+#define	__P(p)	()
+#endif
+#endif	/* !defined(__P) */
+
+#if defined(__STDC__) && !defined(_FILEDEFED)
+#define	_FILEDEFED
+typedef	__FILE FILE;
+#endif
+
+#define	N_IEEE_EXCEPTION 5	/* Number of floating-point exceptions. */
+
+typedef int sigfpe_code_type;	/* Type of SIGFPE code. */
+
+typedef void (*sigfpe_handler_type)();	/* Pointer to exception handler */
+
+#define	SIGFPE_DEFAULT (void (*)())0	/* default exception handling */
+#define	SIGFPE_IGNORE  (void (*)())1  	/* ignore this exception or code */
+#define	SIGFPE_ABORT   (void (*)())2  	/* force abort on exception */
+
+extern sigfpe_handler_type sigfpe __P((sigfpe_code_type, sigfpe_handler_type));
+
+/*
+ * Types for IEEE floating point.
+ */
+typedef float single;
+
+#ifndef _EXTENDED
+#define	_EXTENDED
+typedef unsigned extended[3];
+#endif
+
+typedef long double quadruple;	/* Quadruple-precision type. */
+
+typedef unsigned fp_exception_field_type;
+				/*
+				 * A field containing fp_exceptions OR'ed
+				 * together.
+				 */
+/*
+ * Definitions for base conversion.
+ */
+#define	DECIMAL_STRING_LENGTH 512	/* Size of buffer in decimal_record. */
+
+typedef char decimal_string[DECIMAL_STRING_LENGTH];
+				/* Decimal significand. */
+
+typedef struct {
+	enum fp_class_type fpclass;
+	int	sign;
+	int	exponent;
+	decimal_string ds;	/* Significand - each char contains an ascii */
+				/* digit, except the string-terminating */
+				/* ascii null. */
+	int	more;		/* On conversion from decimal to binary, != 0 */
+				/* indicates more non-zero digits following */
+				/* ds. */
+	int 	ndigits;	/* On fixed_form conversion from binary to */
+				/* decimal, contains number of digits */
+				/* required for ds. */
+} decimal_record;
+
+enum decimal_form {
+	fixed_form,		/* Fortran F format: ndigits specifies number */
+				/* of digits after point; if negative, */
+				/* specifies rounding to occur to left of */
+				/* point. */
+	floating_form		/* Fortran E format: ndigits specifies number */
+				/* of significant digits. */
+};
+
+typedef struct {
+	enum fp_direction_type rd;
+				/* Rounding direction. */
+	enum decimal_form df;	/* Format for conversion from binary to */
+				/* decimal. */
+	int ndigits;		/* Number of digits for conversion. */
+} decimal_mode;
+
+enum decimal_string_form {	/* Valid decimal number string formats. */
+	invalid_form,		/* Not a valid decimal string format. */
+	whitespace_form,	/* All white space - valid in Fortran! */
+	fixed_int_form,		/* <digs> 		*/
+	fixed_intdot_form,	/* <digs>. 		*/
+	fixed_dotfrac_form,	/* .<digs>		*/
+	fixed_intdotfrac_form,	/* <digs>.<frac>	*/
+	floating_int_form,	/* <digs><exp>		*/
+	floating_intdot_form,	/* <digs>.<exp>		*/
+	floating_dotfrac_form,	/* .<digs><exp>		*/
+	floating_intdotfrac_form, /* <digs>.<digs><exp>	*/
+	inf_form,		/* inf			*/
+	infinity_form,		/* infinity		*/
+	nan_form,		/* nan			*/
+	nanstring_form		/* nan(string)		*/
+};
+
+extern void single_to_decimal __P((single *, decimal_mode *, decimal_record *,
+				fp_exception_field_type *));
+extern void double_to_decimal __P((double *, decimal_mode *, decimal_record *,
+				fp_exception_field_type *));
+extern void extended_to_decimal __P((extended *, decimal_mode *,
+				decimal_record *, fp_exception_field_type *));
+extern void quadruple_to_decimal __P((quadruple *, decimal_mode *,
+				decimal_record *, fp_exception_field_type *));
+
+extern void decimal_to_single __P((single *, decimal_mode *, decimal_record *,
+				fp_exception_field_type *));
+extern void decimal_to_double __P((double *, decimal_mode *, decimal_record *,
+				fp_exception_field_type *));
+extern void decimal_to_extended __P((extended *, decimal_mode *,
+				decimal_record *, fp_exception_field_type *));
+extern void decimal_to_quadruple __P((quadruple *, decimal_mode *,
+				decimal_record *, fp_exception_field_type *));
+
+extern void string_to_decimal __P((char **, int, int, decimal_record *,
+				enum decimal_string_form *, char **));
+extern void func_to_decimal __P((char **, int, int, decimal_record *,
+				enum decimal_string_form *, char **,
+				int (*)(void), int *, int (*)(int)));
+extern void file_to_decimal __P((char **, int, int, decimal_record *,
+				enum decimal_string_form *, char **,
+				FILE *, int *));
+
+extern char *seconvert __P((single *, int, int *, int *, char *));
+extern char *sfconvert __P((single *, int, int *, int *, char *));
+extern char *sgconvert __P((single *, int, int, char *));
+extern char *econvert __P((double, int, int *, int *, char *));
+extern char *fconvert __P((double, int, int *, int *, char *));
+extern char *gconvert __P((double, int, int, char *));
+extern char *qeconvert __P((quadruple *, int, int *, int *, char *));
+extern char *qfconvert __P((quadruple *, int, int *, int *, char *));
+extern char *qgconvert __P((quadruple *, int, int, char *));
+
+extern char *ecvt __P((double, int, int *, int *));
+extern char *fcvt __P((double, int, int *, int *));
+extern char *gcvt __P((double, int, char *));
+
+#if __cplusplus >= 199711L
+namespace std {
+#endif
+/*
+ * ANSI C Standard says the following entry points should be
+ * prototyped in <stdlib.h>.  They are now, but weren't before.
+ */
+extern double atof __P((const char *));
+extern double strtod __P((const char *, char **));
+#if __cplusplus >= 199711L
+}
+
+using std::atof;
+using std::strtod;
+#endif /* end of namespace std */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FLOATINGPOINT_H */
--- old/usr/src/lib/Makefile	Thu Oct  9 19:48:51 2014
+++ new/usr/src/lib/Makefile	Thu Oct  9 19:48:51 2014
@@ -154,8 +154,12 @@
 	librdc		\
 	libinstzones	\
 	libpkg		\
-	libpcidb
+	libpcidb	\
+	libm1		\
+	libm		\
+	libmvec
 
+
 SUBDIRS += \
 	passwdutil	\
 	pam_modules	\
@@ -560,7 +564,7 @@
 auditd_plugins: libbsm libnsl libsecdb
 gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
 libadt_jni:	libbsm
-libast: 	libsocket
+libast: 	libsocket libm
 libadutils: 	libldap5 libresolv libsocket libnsl
 nsswitch:	libadutils libidmap
 libbe: 		libzfs
@@ -589,6 +593,9 @@
 		libdladm libsecdb
 libiscsit:	libc libnvpair libstmf libuuid libnsl
 libkmf:		libcryptoutil pkcs11
+libm:		libc
+libm1:		libc libm
+libmvec:	libc libm
 libnsl:		libmd5
 libmapid:	libresolv
 librdc:		libsocket libnsl libnsctl libunistat libdscfg
@@ -602,7 +609,7 @@
 libsasl:	libgss libsocket pkcs11 libmd
 sasl_plugins:	pkcs11 libgss libsocket libsasl
 libsctp:	libsocket
-libshell:	libast libcmd libdll libsocket libsecdb
+libshell:	libast libcmd libdll libsocket libsecdb libm
 libsip:		libmd5
 libsmbfs:	libcmdutils libsocket libnsl libkrb5
 libsocket:	libnsl
@@ -634,7 +641,7 @@
 print:		libldap5
 udapl/udapl_tavor:	udapl/libdat
 libzfs:		libdevid libgen libnvpair libuutil \
-		libadm libavl libefi libidmap libmd libzfs_core
+		libadm libavl libefi libidmap libmd libzfs_core libm
 libzfs_core:	libnvpair
 libzfs_jni:	libdiskmgt libnvpair libzfs
 libzpool:	libavl libumem libnvpair libcmdutils
@@ -663,6 +670,13 @@
 libhotplug:	libnvpair
 cfgadm_plugins:	libhotplug
 libilb:		libsocket
+libipmi:	libm
+libprtdiag:	libm
+libsqlite:	libm
+libstmf:	libm
+libvscan: 	libm
+
+
 $(INTEL_BUILD)libdiskmgt:libfdisk
 
 #
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/Makefile.com	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,1029 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+#
+
+LIBRARY		= libm.a
+VERS		= .2
+
+LIBMDIR		= $(SRC)/lib/libm
+
+m9xsseOBJS_i386	= \
+		__fex_hdlr.o \
+		__fex_i386.o \
+		__fex_sse.o \
+		__fex_sym.o \
+		fex_log.o
+
+m9xsseOBJS	= $(m9xsseOBJS_$(TARGET_ARCH))
+
+m9xOBJS_amd64	= \
+		__fex_sse.o \
+		feprec.o
+
+m9xOBJS_sparc	= \
+		lrint.o \
+		lrintf.o \
+		lrintl.o \
+		lround.o \
+		lroundf.o \
+		lroundl.o
+
+m9xOBJS_i386	= \
+		__fex_sse.o \
+		feprec.o \
+		lrint.o \
+		lrintf.o \
+		lrintl.o \
+		lround.o \
+		lroundf.o \
+		lroundl.o
+
+#
+# lrint.o, lrintf.o, lrintl.o, lround.o, lroundf.o & lroundl.o are 32-bit only
+#
+m9xOBJS		= \
+		$(m9xOBJS_$(TARGET_ARCH)) \
+		__fex_$(MACH).o \
+		__fex_hdlr.o \
+		__fex_sym.o \
+		fdim.o \
+		fdimf.o \
+		fdiml.o \
+		feexcept.o \
+		fenv.o \
+		feround.o \
+		fex_handler.o \
+		fex_log.o \
+		fma.o \
+		fmaf.o \
+		fmal.o \
+		fmax.o \
+		fmaxf.o \
+		fmaxl.o \
+		fmin.o \
+		fminf.o \
+		fminl.o \
+		frexp.o \
+		frexpf.o \
+		frexpl.o \
+		ldexp.o \
+		ldexpf.o \
+		ldexpl.o \
+		llrint.o \
+		llrintf.o \
+		llrintl.o \
+		llround.o \
+		llroundf.o \
+		llroundl.o \
+		modf.o \
+		modff.o \
+		modfl.o \
+		nan.o \
+		nanf.o \
+		nanl.o \
+		nearbyint.o \
+		nearbyintf.o \
+		nearbyintl.o \
+		nexttoward.o \
+		nexttowardf.o \
+		nexttowardl.o \
+		remquo.o \
+		remquof.o \
+		remquol.o \
+		round.o \
+		roundf.o \
+		roundl.o \
+		scalbln.o \
+		scalblnf.o \
+		scalblnl.o \
+		tgamma.o \
+		tgammaf.o \
+		tgammal.o \
+		trunc.o \
+		truncf.o \
+		truncl.o
+
+OBJS_M9XSSE	= $(m9xsseOBJS:%=pics/%)
+
+COBJS_i386	= \
+		__libx_errno.o
+
+COBJS_sparc	= \
+		$(COBJS_i386) \
+		_TBL_atan.o \
+		_TBL_exp2.o \
+		_TBL_log.o \
+		_TBL_log2.o \
+		_TBL_tan.o \
+		__tan.o \
+		__tanf.o
+
+#
+# atan2pi.o and sincospi.o is for internal use only
+#
+
+COBJS_amd64 = \
+		_TBL_atan.o \
+		_TBL_exp2.o \
+		_TBL_log.o \
+		_TBL_log2.o \
+		__tan.o \
+		__tanf.o \
+		_TBL_tan.o \
+		copysign.o \
+		exp.o \
+		fabs.o \
+		fmod.o \
+		ilogb.o \
+		isnan.o \
+		nextafter.o \
+		remainder.o \
+		rint.o \
+		scalbn.o
+
+COBJS_sparcv9 = $(COBJS_amd64)
+
+COBJS		= \
+		$(COBJS_$(TARGET_ARCH)) \
+		__cos.o \
+		__lgamma.o \
+		__rem_pio2.o \
+		__rem_pio2m.o \
+		__sin.o \
+		__sincos.o \
+		__xpg6.o \
+		_lib_version.o \
+		_SVID_error.o \
+		_TBL_ipio2.o \
+		_TBL_sin.o \
+		acos.o \
+		acosh.o \
+		asin.o \
+		asinh.o \
+		atan.o \
+		atan2.o \
+		atan2pi.o \
+		atanh.o \
+		cbrt.o \
+		ceil.o \
+		cos.o \
+		cosh.o \
+		erf.o \
+		exp10.o \
+		exp2.o \
+		expm1.o \
+		floor.o \
+		gamma.o \
+		gamma_r.o \
+		hypot.o \
+		j0.o \
+		j1.o \
+		jn.o \
+		lgamma.o \
+		lgamma_r.o \
+		log.o \
+		log10.o \
+		log1p.o \
+		log2.o \
+		logb.o \
+		matherr.o \
+		pow.o \
+		scalb.o \
+		signgam.o \
+		significand.o \
+		sin.o \
+		sincos.o \
+		sincospi.o \
+		sinh.o \
+		sqrt.o \
+		tan.o \
+		tanh.o
+
+#
+# LSARC/2003/658 adds isnanl
+#
+QOBJS_sparc	= \
+		_TBL_atanl.o \
+		_TBL_expl.o \
+		_TBL_expm1l.o \
+		_TBL_logl.o \
+		finitel.o \
+		isnanl.o
+
+QOBJS_sparcv9	= $(QOBJS_sparc)
+
+QOBJS_amd64	= \
+		finitel.o \
+		isnanl.o
+
+#
+# atan2pil.o, ieee_funcl.o, rndintl.o, sinpil.o, sincospil.o
+# are for internal use only
+#
+# LSARC/2003/279 adds the following:
+#		gammal.o	1
+#		gammal_r.o	1
+#		j0l.o		2
+#		j1l.o		2
+#		jnl.o		2
+#		lgammal_r.o	1
+#		scalbl.o	1
+#		significandl.o	1
+#
+QOBJS		= \
+		$(QOBJS_$(TARGET_ARCH)) \
+		__cosl.o \
+		__lgammal.o \
+		__poly_libmq.o \
+		__rem_pio2l.o \
+		__sincosl.o \
+		__sinl.o \
+		__tanl.o \
+		_TBL_cosl.o \
+		_TBL_ipio2l.o \
+		_TBL_sinl.o \
+		_TBL_tanl.o \
+		acoshl.o \
+		acosl.o \
+		asinhl.o \
+		asinl.o \
+		atan2l.o \
+		atan2pil.o \
+		atanhl.o \
+		atanl.o \
+		cbrtl.o \
+		copysignl.o \
+		coshl.o \
+		cosl.o \
+		erfl.o \
+		exp10l.o \
+		exp2l.o \
+		expl.o \
+		expm1l.o \
+		fabsl.o \
+		floorl.o \
+		fmodl.o \
+		gammal.o \
+		gammal_r.o \
+		hypotl.o \
+		ieee_funcl.o \
+		ilogbl.o \
+		j0l.o \
+		j1l.o \
+		jnl.o \
+		lgammal.o \
+		lgammal_r.o \
+		log10l.o \
+		log1pl.o \
+		log2l.o \
+		logbl.o \
+		logl.o \
+		nextafterl.o \
+		powl.o \
+		remainderl.o \
+		rintl.o \
+		rndintl.o \
+		scalbl.o \
+		scalbnl.o \
+		signgaml.o \
+		significandl.o \
+		sincosl.o \
+		sincospil.o \
+		sinhl.o \
+		sinl.o \
+		sinpil.o \
+		sqrtl.o \
+		tanhl.o \
+		tanl.o
+
+#
+# LSARC/2003/658 adds isnanf
+#
+ROBJS_sparc	= \
+		__cosf.o \
+		__sincosf.o \
+		__sinf.o \
+		isnanf.o
+
+ROBJS_sparcv9	= $(ROBJS_sparc)
+
+ROBJS_amd64	= \
+		isnanf.o \
+		__cosf.o \
+		__sincosf.o \
+		__sinf.o
+
+#
+# atan2pif.o, sincosf.o, sincospif.o are for internal use only
+#
+# LSARC/2003/279 adds the following:
+#		besself.o	6
+#		scalbf.o	1
+#		gammaf.o	1
+#		gammaf_r.o	1
+#		lgammaf_r.o	1
+#		significandf.o	1
+#
+ROBJS		= \
+		$(ROBJS_$(TARGET_ARCH)) \
+		_TBL_r_atan_.o \
+		acosf.o \
+		acoshf.o \
+		asinf.o \
+		asinhf.o \
+		atan2f.o \
+		atan2pif.o \
+		atanf.o \
+		atanhf.o \
+		besself.o \
+		cbrtf.o \
+		copysignf.o \
+		cosf.o \
+		coshf.o \
+		erff.o \
+		exp10f.o \
+		exp2f.o \
+		expf.o \
+		expm1f.o \
+		fabsf.o \
+		floorf.o \
+		fmodf.o \
+		gammaf.o \
+		gammaf_r.o \
+		hypotf.o \
+		ilogbf.o \
+		lgammaf.o \
+		lgammaf_r.o \
+		log10f.o \
+		log1pf.o \
+		log2f.o \
+		logbf.o \
+		logf.o \
+		nextafterf.o \
+		powf.o \
+		remainderf.o \
+		rintf.o \
+		scalbf.o \
+		scalbnf.o \
+		signgamf.o \
+		significandf.o \
+		sinf.o \
+		sinhf.o \
+		sincosf.o \
+		sincospif.o \
+		sqrtf.o \
+		tanf.o \
+		tanhf.o
+
+#
+# LSARC/2003/658 adds isnanf/isnanl
+#
+
+SOBJS_sparc 	= \
+		copysign.o \
+		exp.o \
+		fabs.o \
+		fmod.o \
+		ilogb.o \
+		isnan.o \
+		nextafter.o \
+		remainder.o \
+		rint.o \
+		scalbn.o
+
+SOBJS_i386	= \
+		__reduction.o \
+		finitef.o \
+		finitel.o \
+		isnanf.o \
+		isnanl.o \
+		$(SOBJS_sparc)
+
+SOBJS_amd64	= \
+		__swapFLAGS.o
+#		_xtoll.o \
+#		_xtoull.o \
+
+
+SOBJS		= \
+		$(SOBJS_$(TARGET_ARCH))
+
+complexOBJS	= \
+		cabs.o \
+		cabsf.o \
+		cabsl.o \
+		cacos.o \
+		cacosf.o \
+		cacosh.o \
+		cacoshf.o \
+		cacoshl.o \
+		cacosl.o \
+		carg.o \
+		cargf.o \
+		cargl.o \
+		casin.o \
+		casinf.o \
+		casinh.o \
+		casinhf.o \
+		casinhl.o \
+		casinl.o \
+		catan.o \
+		catanf.o \
+		catanh.o \
+		catanhf.o \
+		catanhl.o \
+		catanl.o \
+		ccos.o \
+		ccosf.o \
+		ccosh.o \
+		ccoshf.o \
+		ccoshl.o \
+		ccosl.o \
+		cexp.o \
+		cexpf.o \
+		cexpl.o \
+		cimag.o \
+		cimagf.o \
+		cimagl.o \
+		clog.o \
+		clogf.o \
+		clogl.o \
+		conj.o \
+		conjf.o \
+		conjl.o \
+		cpow.o \
+		cpowf.o \
+		cpowl.o \
+		cproj.o \
+		cprojf.o \
+		cprojl.o \
+		creal.o \
+		crealf.o \
+		creall.o \
+		csin.o \
+		csinf.o \
+		csinh.o \
+		csinhf.o \
+		csinhl.o \
+		csinl.o \
+		csqrt.o \
+		csqrtf.o \
+		csqrtl.o \
+		ctan.o \
+		ctanf.o \
+		ctanh.o \
+		ctanhf.o \
+		ctanhl.o \
+		ctanl.o \
+		k_atan2.o \
+		k_atan2l.o \
+		k_cexp.o \
+		k_cexpl.o \
+		k_clog_r.o \
+		k_clog_rl.o
+
+OBJECTS		= $(COBJS) $(ROBJS) $(QOBJS) $(SOBJS) $(m9xOBJS) $(complexOBJS)
+
+include		$(SRC)/lib/Makefile.lib
+include 	$(LIBMDIR)/Makefile.libm.com
+include		$(SRC)/lib/Makefile.rootfs
+
+SRCDIR		= ../common/
+LIBS		= $(DYNLIB) $(LINTLIB)
+
+LINTERROFF	= -erroff=E_FUNC_SET_NOT_USED
+LINTERROFF	+= -erroff=E_FUNC_RET_ALWAYS_IGNOR2
+LINTERROFF	+= -erroff=E_FUNC_RET_MAYBE_IGNORED2
+LINTERROFF	+= -erroff=E_IMPL_CONV_RETURN
+LINTERROFF	+= -erroff=E_NAME_MULTIPLY_DEF2
+LINTFLAGS	+= $(LINTERROFF)
+LINTFLAGS64	+= $(LINTERROFF)
+LINTFLAGS64	+= -errchk=longptr64
+
+CPPFLAGS	+= -DLIBM_BUILD
+
+CFLAGS 		+= $(C_BIGPICFLAGS)
+CFLAGS64	+= $(C_BIGPICFLAGS)
+
+m9x_IL		= $(LIBMDIR)/common/m9x/__fenv_$(TARGET_ARCH).il
+
+SRCS_LD_i386_amd64 = \
+	../common/LD/finitel.c \
+	../common/LD/isnanl.c \
+	../common/LD/nextafterl.c
+
+SRCS_LD = \
+	$(SRCS_LD_i386_$(TARGET_ARCH)) \
+	../common/LD/__cosl.c \
+	../common/LD/__lgammal.c \
+	../common/LD/__poly_libmq.c \
+	../common/LD/__rem_pio2l.c \
+	../common/LD/__sincosl.c \
+	../common/LD/__sinl.c \
+	../common/LD/__tanl.c \
+	../common/LD/_TBL_cosl.c \
+	../common/LD/_TBL_ipio2l.c \
+	../common/LD/_TBL_sinl.c \
+	../common/LD/_TBL_tanl.c \
+	../common/LD/acoshl.c \
+	../common/LD/asinhl.c \
+	../common/LD/atan2pil.c \
+	../common/LD/atanhl.c \
+	../common/LD/cbrtl.c \
+	../common/LD/coshl.c \
+	../common/LD/cosl.c \
+	../common/LD/erfl.c \
+	../common/LD/gammal.c \
+	../common/LD/gammal_r.c \
+	../common/LD/hypotl.c \
+	../common/LD/j0l.c \
+	../common/LD/j1l.c \
+	../common/LD/jnl.c \
+	../common/LD/lgammal.c \
+	../common/LD/lgammal_r.c \
+	../common/LD/log1pl.c \
+	../common/LD/logbl.c \
+	../common/LD/scalbl.c \
+	../common/LD/signgaml.c \
+	../common/LD/significandl.c \
+	../common/LD/sincosl.c \
+	../common/LD/sincospil.c \
+	../common/LD/sinhl.c \
+	../common/LD/sinl.c \
+	../common/LD/sinpil.c \
+	../common/LD/tanhl.c \
+	../common/LD/tanl.c
+
+SRCS_LD_i386 = \
+	$(SRCS_LD)
+
+SRCS_R_amd64 = \
+	../common/R/__tanf.c \
+	../common/R/isnanf.c \
+	../common/R/__cosf.c \
+	../common/R/__sincosf.c \
+	../common/R/__sinf.c \
+	../common/R/acosf.c \
+	../common/R/asinf.c \
+	../common/R/atan2f.c \
+	../common/R/copysignf.c \
+	../common/R/exp10f.c \
+	../common/R/exp2f.c \
+	../common/R/expm1f.c \
+	../common/R/fabsf.c \
+	../common/R/hypotf.c \
+	../common/R/ilogbf.c \
+	../common/R/log10f.c \
+	../common/R/log2f.c \
+	../common/R/nextafterf.c \
+	../common/R/powf.c \
+	../common/R/rintf.c \
+	../common/R/scalbnf.c
+
+# sparc + sparcv9
+SRCS_R_sparc = \
+	../common/R/__tanf.c \
+	../common/R/__cosf.c \
+	../common/R/__sincosf.c \
+	../common/R/__sinf.c \
+	../common/R/isnanf.c \
+	../common/R/acosf.c \
+	../common/R/asinf.c \
+	../common/R/atan2f.c \
+	../common/R/copysignf.c \
+	../common/R/exp10f.c \
+	../common/R/exp2f.c \
+	../common/R/expm1f.c \
+	../common/R/fabsf.c \
+	../common/R/fmodf.c \
+	../common/R/hypotf.c \
+	../common/R/ilogbf.c \
+	../common/R/log10f.c \
+	../common/R/log2f.c \
+	../common/R/nextafterf.c \
+	../common/R/powf.c \
+	../common/R/remainderf.c \
+	../common/R/rintf.c \
+	../common/R/scalbnf.c
+
+SRCS_R = \
+	$(SRCS_R_$(MACH)) \
+	$(SRCS_R_$(TARGET_ARCH)) \
+	../common/R/_TBL_r_atan_.c \
+	../common/R/acoshf.c \
+	../common/R/asinhf.c \
+	../common/R/atan2pif.c \
+	../common/R/atanf.c \
+	../common/R/atanhf.c \
+	../common/R/besself.c \
+	../common/R/cbrtf.c \
+	../common/R/cosf.c \
+	../common/R/coshf.c \
+	../common/R/erff.c \
+	../common/R/expf.c \
+	../common/R/floorf.c \
+	../common/R/gammaf.c \
+	../common/R/gammaf_r.c \
+	../common/R/lgammaf.c \
+	../common/R/lgammaf_r.c \
+	../common/R/log1pf.c \
+	../common/R/logbf.c \
+	../common/R/logf.c \
+	../common/R/scalbf.c \
+	../common/R/signgamf.c \
+	../common/R/significandf.c \
+	../common/R/sinf.c \
+	../common/R/sinhf.c \
+	../common/R/sincosf.c \
+	../common/R/sincospif.c \
+	../common/R/sqrtf.c \
+	../common/R/tanf.c \
+	../common/R/tanhf.c
+
+SRCS_Q = \
+	../common/Q/_TBL_atanl.c \
+	../common/Q/_TBL_expl.c \
+	../common/Q/_TBL_expm1l.c \
+	../common/Q/_TBL_logl.c \
+	../common/Q/finitel.c \
+	../common/Q/isnanl.c \
+	../common/Q/__cosl.c \
+	../common/Q/__lgammal.c \
+	../common/Q/__poly_libmq.c \
+	../common/Q/__rem_pio2l.c \
+	../common/Q/__sincosl.c \
+	../common/Q/__sinl.c \
+	../common/Q/__tanl.c \
+	../common/Q/_TBL_cosl.c \
+	../common/Q/_TBL_ipio2l.c \
+	../common/Q/_TBL_sinl.c \
+	../common/Q/_TBL_tanl.c \
+	../common/Q/acoshl.c \
+	../common/Q/acosl.c \
+	../common/Q/asinhl.c \
+	../common/Q/asinl.c \
+	../common/Q/atan2l.c \
+	../common/Q/atan2pil.c \
+	../common/Q/atanhl.c \
+	../common/Q/atanl.c \
+	../common/Q/cbrtl.c \
+	../common/Q/copysignl.c \
+	../common/Q/coshl.c \
+	../common/Q/cosl.c \
+	../common/Q/erfl.c \
+	../common/Q/exp10l.c \
+	../common/Q/exp2l.c \
+	../common/Q/expl.c \
+	../common/Q/expm1l.c \
+	../common/Q/fabsl.c \
+	../common/Q/floorl.c \
+	../common/Q/fmodl.c \
+	../common/Q/gammal.c \
+	../common/Q/gammal_r.c \
+	../common/Q/hypotl.c \
+	../common/Q/ieee_funcl.c \
+	../common/Q/ilogbl.c \
+	../common/Q/j0l.c \
+	../common/Q/j1l.c \
+	../common/Q/jnl.c \
+	../common/Q/lgammal.c \
+	../common/Q/lgammal_r.c \
+	../common/Q/log10l.c \
+	../common/Q/log1pl.c \
+	../common/Q/log2l.c \
+	../common/Q/logbl.c \
+	../common/Q/logl.c \
+	../common/Q/nextafterl.c \
+	../common/Q/powl.c \
+	../common/Q/remainderl.c \
+	../common/Q/rintl.c \
+	../common/Q/rndintl.c \
+	../common/Q/scalbl.c \
+	../common/Q/scalbnl.c \
+	../common/Q/signgaml.c \
+	../common/Q/significandl.c \
+	../common/Q/sincosl.c \
+	../common/Q/sincospil.c \
+	../common/Q/sinhl.c \
+	../common/Q/sinl.c \
+	../common/Q/sinpil.c \
+	../common/Q/sqrtl.c \
+	../common/Q/tanhl.c \
+	../common/Q/tanl.c
+
+SRCS_Q_sparc = \
+	$(SRCS_Q)
+
+SRCS_complex = \
+	../common/complex/cabs.c \
+	../common/complex/cabsf.c \
+	../common/complex/cabsl.c \
+	../common/complex/cacos.c \
+	../common/complex/cacosf.c \
+	../common/complex/cacosh.c \
+	../common/complex/cacoshf.c \
+	../common/complex/cacoshl.c \
+	../common/complex/cacosl.c \
+	../common/complex/carg.c \
+	../common/complex/cargf.c \
+	../common/complex/cargl.c \
+	../common/complex/casin.c \
+	../common/complex/casinf.c \
+	../common/complex/casinh.c \
+	../common/complex/casinhf.c \
+	../common/complex/casinhl.c \
+	../common/complex/casinl.c \
+	../common/complex/catan.c \
+	../common/complex/catanf.c \
+	../common/complex/catanh.c \
+	../common/complex/catanhf.c \
+	../common/complex/catanhl.c \
+	../common/complex/catanl.c \
+	../common/complex/ccos.c \
+	../common/complex/ccosf.c \
+	../common/complex/ccosh.c \
+	../common/complex/ccoshf.c \
+	../common/complex/ccoshl.c \
+	../common/complex/ccosl.c \
+	../common/complex/cexp.c \
+	../common/complex/cexpf.c \
+	../common/complex/cexpl.c \
+	../common/complex/cimag.c \
+	../common/complex/cimagf.c \
+	../common/complex/cimagl.c \
+	../common/complex/clog.c \
+	../common/complex/clogf.c \
+	../common/complex/clogl.c \
+	../common/complex/conj.c \
+	../common/complex/conjf.c \
+	../common/complex/conjl.c \
+	../common/complex/cpow.c \
+	../common/complex/cpowf.c \
+	../common/complex/cpowl.c \
+	../common/complex/cproj.c \
+	../common/complex/cprojf.c \
+	../common/complex/cprojl.c \
+	../common/complex/creal.c \
+	../common/complex/crealf.c \
+	../common/complex/creall.c \
+	../common/complex/csin.c \
+	../common/complex/csinf.c \
+	../common/complex/csinh.c \
+	../common/complex/csinhf.c \
+	../common/complex/csinhl.c \
+	../common/complex/csinl.c \
+	../common/complex/csqrt.c \
+	../common/complex/csqrtf.c \
+	../common/complex/csqrtl.c \
+	../common/complex/ctan.c \
+	../common/complex/ctanf.c \
+	../common/complex/ctanh.c \
+	../common/complex/ctanhf.c \
+	../common/complex/ctanhl.c \
+	../common/complex/ctanl.c \
+	../common/complex/k_atan2.c \
+	../common/complex/k_atan2l.c \
+	../common/complex/k_cexp.c \
+	../common/complex/k_cexpl.c \
+	../common/complex/k_clog_r.c \
+	../common/complex/k_clog_rl.c
+
+SRCS_m9x_i386 = \
+	../common/m9x/__fex_sse.c \
+	../common/m9x/feprec.c \
+	../common/m9x/__fex_i386.c
+
+SRCS_m9x_i386_i386 = \
+	../common/m9x/lroundf.c
+
+SRCS_m9x_i386_amd64 = \
+	../common/m9x/llrint.c \
+	../common/m9x/llrintf.c \
+	../common/m9x/llrintl.c \
+	../common/m9x/nexttowardl.c \
+	../common/m9x/remquo.c \
+	../common/m9x/remquof.c \
+	../common/m9x/round.c \
+	../common/m9x/roundl.c \
+	../common/m9x/scalbln.c \
+	../common/m9x/scalblnf.c \
+	../common/m9x/scalblnl.c \
+	../common/m9x/trunc.c \
+	../common/m9x/truncl.c
+
+# sparc
+SRCS_m9x_sparc_sparc = \
+	../common/m9x/lrint.c \
+	../common/m9x/lrintf.c \
+	../common/m9x/lrintl.c \
+	../common/m9x/lround.c \
+	../common/m9x/lroundf.c \
+	../common/m9x/lroundl.c
+
+SRCS_m9x_sparc = \
+	../common/m9x/__fex_sparc.c \
+	../common/m9x/llrint.c \
+	../common/m9x/llrintf.c \
+	../common/m9x/llrintl.c \
+	../common/m9x/nexttowardl.c \
+	../common/m9x/remquo.c \
+	../common/m9x/remquof.c \
+	../common/m9x/remquol.c \
+	../common/m9x/round.c \
+	../common/m9x/roundl.c \
+	../common/m9x/scalbln.c \
+	../common/m9x/scalblnf.c \
+	../common/m9x/scalblnl.c \
+	../common/m9x/trunc.c \
+	../common/m9x/truncl.c
+
+SRCS_m9x = \
+	$(SRCS_m9x_$(MACH)) \
+	$(SRCS_m9x_sparc_$(TARGET_ARCH)) \
+	$(SRCS_m9x_i386_$(TARGET_ARCH)) \
+	../common/m9x/__fex_hdlr.c \
+	../common/m9x/__fex_sym.c \
+	../common/m9x/fdim.c \
+	../common/m9x/fdimf.c \
+	../common/m9x/fdiml.c \
+	../common/m9x/feexcept.c \
+	../common/m9x/fenv.c \
+	../common/m9x/feround.c \
+	../common/m9x/fex_handler.c \
+	../common/m9x/fex_log.c \
+	../common/m9x/fma.c \
+	../common/m9x/fmaf.c \
+	../common/m9x/fmal.c \
+	../common/m9x/fmax.c \
+	../common/m9x/fmaxf.c \
+	../common/m9x/fmaxl.c \
+	../common/m9x/fmin.c \
+	../common/m9x/fminf.c \
+	../common/m9x/fminl.c \
+	../common/m9x/frexp.c \
+	../common/m9x/frexpf.c \
+	../common/m9x/frexpl.c \
+	../common/m9x/ldexp.c \
+	../common/m9x/ldexpf.c \
+	../common/m9x/ldexpl.c \
+	../common/m9x/llround.c \
+	../common/m9x/llroundf.c \
+	../common/m9x/llroundl.c \
+	../common/m9x/modf.c \
+	../common/m9x/modff.c \
+	../common/m9x/modfl.c \
+	../common/m9x/nan.c \
+	../common/m9x/nanf.c \
+	../common/m9x/nanl.c \
+	../common/m9x/nearbyint.c \
+	../common/m9x/nearbyintf.c \
+	../common/m9x/nearbyintl.c \
+	../common/m9x/nexttoward.c \
+	../common/m9x/nexttowardf.c \
+	../common/m9x/roundf.c \
+	../common/m9x/tgamma.c \
+	../common/m9x/tgammaf.c \
+	../common/m9x/tgammal.c \
+	../common/m9x/truncf.c
+
+SRCS_C_sparc = \
+	../common/C/__tan.c \
+	../common/C/_TBL_atan.c \
+	../common/C/_TBL_exp2.c \
+	../common/C/_TBL_log.c \
+	../common/C/_TBL_log2.c \
+	../common/C/_TBL_tan.c \
+	../common/C/acos.c \
+	../common/C/asin.c \
+	../common/C/atan.c \
+	../common/C/atan2.c \
+	../common/C/ceil.c \
+	../common/C/cos.c \
+	../common/C/exp.c \
+	../common/C/exp10.c \
+	../common/C/exp2.c \
+	../common/C/expm1.c \
+	../common/C/floor.c \
+	../common/C/fmod.c \
+	../common/C/hypot.c \
+	../common/C/ilogb.c \
+	../common/C/isnan.c \
+	../common/C/log.c \
+	../common/C/log10.c \
+	../common/C/log2.c \
+	../common/C/pow.c \
+	../common/C/remainder.c \
+	../common/C/rint.c \
+	../common/C/scalbn.c \
+	../common/C/sin.c \
+	../common/C/sincos.c \
+	../common/C/tan.c
+
+SRCS_i386_i386 	= \
+	../common/C/__libx_errno.c
+
+SRCS_sparc_sparc = \
+	$(SRCS_i386_i386)
+
+SRCS_sparc_sparcv9 = \
+	../common/C/copysign.c \
+	../common/C/fabs.c \
+	../common/C/nextafter.c
+
+SRCS_i386_amd64 = \
+	../common/C/_TBL_atan.c \
+	../common/C/_TBL_exp2.c \
+	../common/C/_TBL_log.c \
+	../common/C/_TBL_log2.c \
+	../common/C/__tan.c \
+	../common/C/_TBL_tan.c \
+	../common/C/copysign.c \
+	../common/C/exp.c \
+	../common/C/fabs.c \
+	../common/C/ilogb.c \
+	../common/C/isnan.c \
+	../common/C/nextafter.c \
+	../common/C/rint.c \
+	../common/C/scalbn.c \
+	../common/C/acos.c \
+	../common/C/asin.c \
+	../common/C/atan.c \
+	../common/C/atan2.c \
+	../common/C/ceil.c \
+	../common/C/cos.c \
+	../common/C/exp10.c \
+	../common/C/exp2.c \
+	../common/C/expm1.c \
+	../common/C/floor.c \
+	../common/C/hypot.c \
+	../common/C/log.c \
+	../common/C/log10.c \
+	../common/C/log2.c \
+	../common/C/pow.c \
+	../common/C/sin.c \
+	../common/C/sincos.c \
+	../common/C/tan.c
+
+SRCS_C = \
+	$(SRCS_C_$(MACH)) \
+	$(SRCS_C_i386_$(TARGET_ARCH)) \
+	../common/C/__cos.c \
+	../common/C/__lgamma.c \
+	../common/C/__rem_pio2.c \
+	../common/C/__rem_pio2m.c \
+	../common/C/__sin.c \
+	../common/C/__sincos.c \
+	../common/C/__xpg6.c \
+	../common/C/_lib_version.c \
+	../common/C/_SVID_error.c \
+	../common/C/_TBL_ipio2.c \
+	../common/C/_TBL_sin.c \
+	../common/C/acosh.c \
+	../common/C/asinh.c \
+	../common/C/atan2pi.c \
+	../common/C/atanh.c \
+	../common/C/cbrt.c \
+	../common/C/cosh.c \
+	../common/C/erf.c \
+	../common/C/gamma.c \
+	../common/C/gamma_r.c \
+	../common/C/j0.c \
+	../common/C/j1.c \
+	../common/C/jn.c \
+	../common/C/lgamma.c \
+	../common/C/lgamma_r.c \
+	../common/C/log1p.c \
+	../common/C/logb.c \
+	../common/C/matherr.c \
+	../common/C/scalb.c \
+	../common/C/signgam.c \
+	../common/C/significand.c \
+	../common/C/sincospi.c \
+	../common/C/sinh.c \
+	../common/C/sqrt.c \
+	../common/C/tanh.c
+
+SRCS	= \
+	$(SRCS_Q_$(MACH)) \
+	$(SRCS_LD_$(MACH)) \
+	$(SRCS_R) \
+	$(SRCS_complex) \
+	$(SRCS_C)
+
+.KEEP_STATE:
+
+all:	$(LIBS)
+
+lint:	lintcheck
+
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/amd64/src/libm_inlines.h	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,221 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright 2011, Richard Lowe.
+ */
+
+/* Functions in this file are duplicated in locallibm.il.  Keep them in sync */
+
+#ifndef _LIBM_INLINES_H
+#define	_LIBM_INLINES_H
+
+#ifdef __GNUC__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <sys/ieeefp.h>
+
+extern __inline__ float
+__inline_sqrtf(float a)
+{
+	float ret;
+
+	__asm__ __volatile__("sqrtss %1, %0\n\t" : "=x" (ret) : "x" (a));
+	return (ret);
+}
+
+extern __inline__ double
+__inline_sqrt(double a)
+{
+	double ret;
+
+	__asm__ __volatile__("sqrtsd %1, %0\n\t" : "=x" (ret) : "x" (a));
+	return (ret);
+}
+
+extern __inline__ double
+__ieee754_sqrt(double a)
+{
+	return (__inline_sqrt(a));
+}
+
+/*
+ * 00 - 24 bits
+ * 01 - reserved
+ * 10 - 53 bits
+ * 11 - 64 bits
+ */
+extern __inline__ int
+__swapRP(int i)
+{
+	int ret;
+	uint16_t cw;
+
+	__asm__ __volatile__("fstcw %0\n\t" : "=m" (cw));
+
+	ret = (cw >> 8) & 0x3;
+	cw = (cw & 0xfcff) | ((i & 0x3) << 8);
+
+	__asm__ __volatile__("fldcw %0\n\t" : : "m" (cw));
+
+	return (ret);
+}
+
+/*
+ * 00 - Round to nearest, with even preferred
+ * 01 - Round down
+ * 10 - Round up
+ * 11 - Chop
+ */
+extern __inline__ enum fp_direction_type
+__swap87RD(enum fp_direction_type i)
+{
+	int ret;
+	uint16_t cw;
+
+	__asm__ __volatile__("fstcw %0\n\t" : "=m" (cw));
+
+	ret = (cw >> 10) & 0x3;
+	cw = (cw & 0xf3ff) | ((i & 0x3) << 10);
+
+	__asm__ __volatile__("fldcw %0\n\t" : : "m" (cw));
+
+	return (ret);
+}
+
+extern __inline__ int
+abs(int i)
+{
+	int ret;
+	__asm__ __volatile__(
+	    "movl    %1, %0\n\t"
+	    "negl    %1\n\t"
+	    "cmovnsl %1, %0\n\t"
+	    : "=r" (ret), "+r" (i)
+	    :
+	    : "cc");
+	return (ret);
+}
+
+extern __inline__ double
+copysign(double d1, double d2)
+{
+	double tmpd;
+
+	__asm__ __volatile__(
+	    "movd %3, %1\n\t"
+	    "andpd %1, %0\n\t"
+	    "andnpd %2, %1\n\t"
+	    "orpd %1, %0\n\t"
+	    : "+&x" (d1), "=&x" (tmpd)
+	    : "x" (d2), "r" (0x7fffffffffffffff));
+
+	return (d1);
+}
+
+extern __inline__ double
+fabs(double d)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "movd  %2, %1\n\t"
+	    "andpd %1, %0"
+	    : "+x" (d), "=&x" (tmp)
+	    : "r" (0x7fffffffffffffff));
+
+	return (d);
+}
+
+extern __inline__ float
+fabsf(float d)
+{
+	__asm__ __volatile__(
+	    "andpd %1, %0"
+	    : "+x" (d)
+	    : "x" (0x7fffffff));
+
+	return (d);
+}
+
+extern __inline__ int
+finite(double d)
+{
+	long ret = 0x7fffffffffffffff;
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "movq %2, %1\n\t"
+	    "andq %1, %0\n\t"
+	    "movq $0x7ff0000000000000, %1\n\t"
+	    "subq %1, %0\n\t"
+	    "shrq $63, %0\n\t"
+	    : "+r" (ret), "=r" (tmp)
+	    : "x" (d)
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ int
+signbit(double d)
+{
+	long ret;
+	__asm__ __volatile__(
+	    "movmskpd %1, %0\n\t"
+	    "andq     $1, %0\n\t"
+	    : "=r" (ret)
+	    : "x" (d)
+	    : "cc");
+	return (ret);
+}
+
+extern __inline__ double
+sqrt(double d)
+{
+	return (__inline_sqrt(d));
+}
+
+extern __inline__ float
+sqrtf(float f)
+{
+	return (__inline_sqrtf(f));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __GNUC__ */
+
+#endif /* _LIBM_INLINES_H */
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/__tan.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,195 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* INDENT OFF */
+/*
+ * __k_tan( double x;  double y; int k )
+ * kernel tan/cotan function on [-pi/4, pi/4], pi/4 ~ 0.785398164
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ * Input k indicate -- tan if k=0; else -1/tan
+ *
+ * Table look up algorithm
+ *	1. by tan(-x) = -tan(x), need only to consider positive x
+ *	2. if x < 5/32 = [0x3fc40000, 0] = 0.15625 , then
+ *	     if x < 2^-27 (hx < 0x3e400000 0), set w=x with inexact if x!= 0
+ *	     else
+ *		z = x*x;
+ *		w = x + (y+(x*z)*(t1+z*(t2+z*(t3+z*(t4+z*(t5+z*t6))))))
+ *	   return (k==0)? w: 1/w;
+ *	3. else
+ *		ht = (hx + 0x4000)&0x7fff8000	(round x to a break point t)
+ *		lt = 0
+ *		i  = (hy-0x3fc40000)>>15;	(i<=64)
+ *		x' = (x - t)+y 			(|x'| ~<= 2^-7)
+ *	   By
+ *		tan(t+x')
+ *		  = (tan(t)+tan(x'))/(1-tan(x')tan(t))
+ *	   We have
+ *		             sin(x')+tan(t)*(tan(t)*sin(x'))
+ *		  = tan(t) + -------------------------------	for k=0
+ *			        cos(x') - tan(t)*sin(x')
+ *
+ *		             cos(x') - tan(t)*sin(x')
+ *		  = - --------------------------------------	for k=1
+ *		       tan(t) + tan(t)*(cos(x')-1) + sin(x')
+ *
+ *
+ *	   where 	tan(t) is from the table,
+ *			sin(x') = x + pp1*x^3 + pp2*x^5
+ *			cos(x') = 1 + qq1*x^2 + qq2*x^4
+ */
+
+#include "libm.h"
+
+extern const double _TBL_tan_hi[], _TBL_tan_lo[];
+static const double q[] = {
+/* one  = */  1.0,
+/*
+ *                       2       2       -59.56
+ * |sin(x) - pp1*x*(pp2+x *(pp3+x )| <= 2        for |x|<1/64
+ */
+/* pp1  = */  8.33326120969096230395312119298978359438478946686e-0003,
+/* pp2  = */  1.20001038589438965215025680596868692381425944526e+0002,
+/* pp3  = */ -2.00001730975089451192161504877731204032897949219e+0001,
+
+/*
+ *                   2      2        -56.19
+ * |cos(x) - (1+qq1*x (qq2+x ))| <= 2        for |x|<=1/128
+ */
+/* qq1  = */  4.16665486385721928197511942926212213933467864990e-0002,
+/* qq2  = */ -1.20000339921340035687080671777948737144470214844e+0001,
+
+/*
+ * |tan(x) - PF(x)|
+ * |--------------| <= 2^-58.57 for |x|<0.15625
+ * |      x       |
+ *
+ * where (let z = x*x)
+ *	PF(x) = x + (t1*x*z)(t2 + z(t3 + z))(t4 + z)(t5 + z(t6 + z))
+ */
+/* t1 = */  3.71923358986516816929168705030406272271648049355e-0003,
+/* t2 = */  6.02645120354857866118436504621058702468872070312e+0000,
+/* t3 = */  2.42627327587398156083509093150496482849121093750e+0000,
+/* t4 = */  2.44968983934252770851003333518747240304946899414e+0000,
+/* t5 = */  6.07089252571767978849948121933266520500183105469e+0000,
+/* t6 = */ -2.49403756995593761658369658107403665781021118164e+0000,
+};
+
+
+#define	one q[0]
+#define	pp1 q[1]
+#define	pp2 q[2]
+#define	pp3 q[3]
+#define	qq1 q[4]
+#define	qq2 q[5]
+#define	t1  q[6]
+#define	t2  q[7]
+#define	t3  q[8]
+#define	t4  q[9]
+#define	t5  q[10]
+#define	t6  q[11]
+
+/* INDENT ON */
+
+
+double
+__k_tan(double x, double y, int k) {
+	double a, t, z, w = 0.0L, s, c, r, rh, xh, xl;
+	int i, j, hx, ix;
+
+	t = one;
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix < 0x3fc40000) {		/* 0.15625 */
+		if (ix < 0x3e400000) {	/* 2^-27 */
+			if ((i = (int) x) == 0)		/* generate inexact */
+				w = x;
+			t = y;
+		} else {
+			z = x * x;
+			t = y + (((t1 * x) * z) * (t2 + z * (t3 + z))) *
+				((t4 + z) * (t5 + z * (t6 + z)));
+			w = x + t;
+		}
+		if (k == 0)
+			return (w);
+		/*
+		 * Compute -1/(x+T) with great care
+		 * Let r = -1/(x+T), rh = r chopped to 20 bits.
+		 * Also let xh	= x+T chopped to 20 bits, xl = (x-xh)+T. Then
+		 *   -1/(x+T)	= rh + (-1/(x+T)-rh) = rh + r*(1+rh*(x+T))
+		 *		= rh + r*((1+rh*xh)+rh*xl).
+		 */
+		rh = r = -one / w;
+		((int *) &rh)[LOWORD] = 0;
+		xh = w;
+		((int *) &xh)[LOWORD] = 0;
+		xl = (x - xh) + t;
+		return (rh + r * ((one + rh * xh) + rh * xl));
+	}
+	j = (ix + 0x4000) & 0x7fff8000;
+	i = (j - 0x3fc40000) >> 15;
+	((int *) &t)[HIWORD] = j;
+	if (hx > 0)
+		x = y - (t - x);
+	else
+		x = -y - (t + x);
+	a = _TBL_tan_hi[i];
+	z = x * x;
+	s = (pp1 * x) * (pp2 + z * (pp3 + z));	/* sin(x) */
+	t = (qq1 * z) * (qq2 + z);		/* cos(x) - 1 */
+	if (k == 0) {
+		w = a * s;
+		t = _TBL_tan_lo[i] + (s + a * w) / (one - (w - t));
+		return (hx < 0 ? -a - t : a + t);
+	} else {
+		w = s + a * t;
+		c = w + _TBL_tan_lo[i];
+		t = a * s - t;
+		/*
+		 * Now try to compute [(1-T)/(a+c)] accurately
+		 *
+		 * Let r = 1/(a+c), rh = (1-T)*r chopped to 20 bits.
+		 * Also let xh = a+c chopped to 20 bits, xl = (a-xh)+c. Then
+		 *	(1-T)/(a+c) = rh + ((1-T)/(a+c)-rh)
+		 *		= rh + r*(1-T-rh*(a+c))
+		 *		= rh + r*((1-T-rh*xh)-rh*xl)
+		 *		= rh + r*(((1-rh*xh)-T)-rh*xl)
+		 */
+		r = one / (a + c);
+		rh = (one - t) * r;
+		((int *) &rh)[LOWORD] = 0;
+		xh = a + c;
+		((int *) &xh)[LOWORD] = 0;
+		xl = (a - xh) + c;
+		z = rh + r * (((one - rh * xh) - t) - rh * xl);
+		return (hx >= 0 ? -z : z);
+	}
+}
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/acos.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,154 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak acos = __acos
+
+/* INDENT OFF */
+/*
+ * acos(x)
+ * Method :
+ *	acos(x)  = pi/2 - asin(x)
+ *	acos(-x) = pi/2 + asin(x)
+ * For |x|<=0.5
+ *	acos(x) = pi/2 - (x + x*x^2*R(x^2))	(see asin.c)
+ * For x>0.5
+ * 	acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))
+ *		= 2asin(sqrt((1-x)/2))
+ *		= 2s + 2s*z*R(z) 	...z=(1-x)/2, s=sqrt(z)
+ *		= 2f + (2c + 2s*z*R(z))
+ *     where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term
+ *     for f so that f+c ~ sqrt(z).
+ * For x<-0.5
+ *	acos(x) = pi - 2asin(sqrt((1-|x|)/2))
+ *		= pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z)
+ *
+ * Special cases:
+ *	if x is NaN, return x itself;
+ *	if |x|>1, return NaN with invalid signal.
+ *
+ * Function needed: sqrt
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __acos, __sqrt, __isnan */
+#include "libm_protos.h"	/* _SVID_libm_error */
+#include "libm_macros.h"
+#include <math.h>
+
+/* INDENT OFF */
+static const double xxx[] = {
+/* one */	 1.00000000000000000000e+00,	/* 3FF00000, 00000000 */
+/* pi */	 3.14159265358979311600e+00,	/* 400921FB, 54442D18 */
+/* pio2_hi */	 1.57079632679489655800e+00,	/* 3FF921FB, 54442D18 */
+/* pio2_lo */	 6.12323399573676603587e-17,	/* 3C91A626, 33145C07 */
+/* pS0 */	 1.66666666666666657415e-01,	/* 3FC55555, 55555555 */
+/* pS1 */	-3.25565818622400915405e-01,	/* BFD4D612, 03EB6F7D */
+/* pS2 */	 2.01212532134862925881e-01,	/* 3FC9C155, 0E884455 */
+/* pS3 */	-4.00555345006794114027e-02,	/* BFA48228, B5688F3B */
+/* pS4 */	 7.91534994289814532176e-04,	/* 3F49EFE0, 7501B288 */
+/* pS5 */	 3.47933107596021167570e-05,	/* 3F023DE1, 0DFDF709 */
+/* qS1 */	-2.40339491173441421878e+00,	/* C0033A27, 1C8A2D4B */
+/* qS2 */	 2.02094576023350569471e+00,	/* 40002AE5, 9C598AC8 */
+/* qS3 */	-6.88283971605453293030e-01,	/* BFE6066C, 1B8D0159 */
+/* qS4 */	 7.70381505559019352791e-02	/* 3FB3B8C5, B12E9282 */
+};
+#define	one	xxx[0]
+#define	pi	xxx[1]
+#define	pio2_hi	xxx[2]
+#define	pio2_lo	xxx[3]
+#define	pS0	xxx[4]
+#define	pS1	xxx[5]
+#define	pS2	xxx[6]
+#define	pS3	xxx[7]
+#define	pS4	xxx[8]
+#define	pS5	xxx[9]
+#define	qS1	xxx[10]
+#define	qS2	xxx[11]
+#define	qS3	xxx[12]
+#define	qS4	xxx[13]
+/* INDENT ON */
+
+double
+acos(double x) {
+	double z, p, q, r, w, s, c, df;
+	int hx, ix;
+
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix >= 0x3ff00000) {	/* |x| >= 1 */
+		if (((ix - 0x3ff00000) | ((int *) &x)[LOWORD]) == 0) {
+			/* |x| == 1 */
+			if (hx > 0)	/* acos(1) = 0 */
+				return (0.0);
+			else		/* acos(-1) = pi */
+				return (pi + 2.0 * pio2_lo);
+		} else if (isnan(x))
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+			return (ix >= 0x7ff80000 ? x : (x - x) / (x - x));
+			/* assumes sparc-like QNaN */
+#else
+			return (x - x) / (x - x);	/* acos(|x|>1) is NaN */
+#endif
+		else
+			return (_SVID_libm_err(x, x, 1));
+	}
+	if (ix < 0x3fe00000) {	/* |x| < 0.5 */
+		if (ix <= 0x3c600000)
+			return (pio2_hi + pio2_lo);	/* if |x| < 2**-57 */
+		z = x * x;
+		p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 +
+			z * (pS4 + z * pS5)))));
+		q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
+		r = p / q;
+		return (pio2_hi - (x - (pio2_lo - x * r)));
+	} else if (hx < 0) {
+		/* x < -0.5 */
+		z = (one + x) * 0.5;
+		p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 +
+			z * (pS4 + z * pS5)))));
+		q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
+		s = sqrt(z);
+		r = p / q;
+		w = r * s - pio2_lo;
+		return (pi - 2.0 * (s + w));
+	} else {
+		/* x > 0.5 */
+		z = (one - x) * 0.5;
+		s = sqrt(z);
+		df = s;
+		((int *) &df)[LOWORD] = 0;
+		c = (z - df * df) / (s + df);
+		p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 +
+			z * (pS4 + z * pS5)))));
+		q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));
+		r = p / q;
+		w = r * s + c;
+		return (2.0 * (df + w));
+	}
+}
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/acosh.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,96 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak acosh = __acosh
+
+/* INDENT OFF */
+/*
+ * acosh(x)
+ * Method :
+ *	Based on
+ *		acosh(x) = log [ x + sqrt(x*x-1) ]
+ *	we have
+ *		acosh(x) := log(x)+ln2,	if x is large; else
+ *		acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x > 2; else
+ *		acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t = x-1.
+ *
+ * Special cases:
+ *	acosh(x) is NaN with signal if x < 1.
+ *	acosh(NaN) is NaN without signal.
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __acosh, __log, __log1p */
+#include "libm_protos.h"	/* _SVID_libm_error */
+#include "libm_macros.h"
+#include <math.h>
+
+static const double
+	one = 1.0,
+	ln2 = 6.93147180559945286227e-01;	/* 3FE62E42, FEFA39EF */
+
+double
+acosh(double x) {
+	double t;
+	int hx;
+
+	hx = ((int *) &x)[HIWORD];
+	if (hx < 0x3ff00000) {	/* x < 1 */
+		if (isnan(x))
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+			return (hx >= 0xfff80000 ? x : (x - x) / (x - x));
+			/* assumes sparc-like QNaN */
+#else
+			return (x - x) / (x - x);
+#endif
+		else
+			return (_SVID_libm_err(x, x, 29));
+	} else if (hx >= 0x41b00000) {
+		/* x > 2**28 */
+		if (hx >= 0x7ff00000) {	/* x is inf of NaN */
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+			return (hx >= 0x7ff80000 ? x : x + x);
+			/* assumes sparc-like QNaN */
+#else
+			return (x + x);
+#endif
+		} else	/* acosh(huge)=log(2x) */
+			return (log(x) + ln2);
+	} else if (((hx - 0x3ff00000) | ((int *) &x)[LOWORD]) == 0) {
+		return (0.0);	/* acosh(1) = 0 */
+	} else if (hx > 0x40000000) {
+		/* 2**28 > x > 2 */
+		t = x * x;
+		return (log(2.0 * x - one / (x + sqrt(t - one))));
+	} else {
+		/* 1 < x < 2 */
+		t = x - one;
+		return (log1p(t + sqrt(2.0 * t + t * t)));
+	}
+}
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/asin.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,158 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak asin = __asin
+
+/* INDENT OFF */
+/*
+ * asin(x)
+ * Method :
+ *	Since  asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
+ *	we approximate asin(x) on [0,0.5] by
+ *		asin(x) = x + x*x^2*R(x^2)
+ *	where
+ *		R(x^2) is a rational approximation of (asin(x)-x)/x^3
+ *	and its remez error is bounded by
+ *		|(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75)
+ *
+ *	For x in [0.5,1]
+ *		asin(x) = pi/2-2*asin(sqrt((1-x)/2))
+ *	Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
+ *	then for x>0.98
+ *		asin(x) = pi/2 - 2*(s+s*z*R(z))
+ *			= pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
+ *	For x<=0.98, let pio4_hi = pio2_hi/2, then
+ *		f = hi part of s;
+ *		c = sqrt(z) - f = (z-f*f)/(s+f) 	...f+c=sqrt(z)
+ *	and
+ *		asin(x) = pi/2 - 2*(s+s*z*R(z))
+ *			= pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
+ *			= pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
+ *
+ * Special cases:
+ *	if x is NaN, return x itself;
+ *	if |x|>1, return NaN with invalid signal.
+ *
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __asin, __sqrt, __isnan */
+#include "libm_protos.h"	/* _SVID_libm_error */
+#include "libm_macros.h"
+#include <math.h>
+
+/* INDENT OFF */
+static const double xxx[] = {
+/* one */	 1.00000000000000000000e+00,	/* 3FF00000, 00000000 */
+/* huge */	 1.000e+300,
+/* pio2_hi */	 1.57079632679489655800e+00,	/* 3FF921FB, 54442D18 */
+/* pio2_lo */	 6.12323399573676603587e-17,	/* 3C91A626, 33145C07 */
+/* pio4_hi */	 7.85398163397448278999e-01,	/* 3FE921FB, 54442D18 */
+/* coefficient for R(x^2) */
+/* pS0 */	 1.66666666666666657415e-01,	/* 3FC55555, 55555555 */
+/* pS1 */	-3.25565818622400915405e-01,	/* BFD4D612, 03EB6F7D */
+/* pS2 */	 2.01212532134862925881e-01,	/* 3FC9C155, 0E884455 */
+/* pS3 */	-4.00555345006794114027e-02,	/* BFA48228, B5688F3B */
+/* pS4 */	 7.91534994289814532176e-04,	/* 3F49EFE0, 7501B288 */
+/* pS5 */	 3.47933107596021167570e-05,	/* 3F023DE1, 0DFDF709 */
+/* qS1 */	-2.40339491173441421878e+00,	/* C0033A27, 1C8A2D4B */
+/* qS2 */	 2.02094576023350569471e+00,	/* 40002AE5, 9C598AC8 */
+/* qS3 */	-6.88283971605453293030e-01,	/* BFE6066C, 1B8D0159 */
+/* qS4 */	 7.70381505559019352791e-02	/* 3FB3B8C5, B12E9282 */
+};
+#define	one	xxx[0]
+#define	huge	xxx[1]
+#define	pio2_hi	xxx[2]
+#define	pio2_lo	xxx[3]
+#define	pio4_hi	xxx[4]
+#define	pS0	xxx[5]
+#define	pS1	xxx[6]
+#define	pS2	xxx[7]
+#define	pS3	xxx[8]
+#define	pS4	xxx[9]
+#define	pS5	xxx[10]
+#define	qS1	xxx[11]
+#define	qS2	xxx[12]
+#define	qS3	xxx[13]
+#define	qS4	xxx[14]
+/* INDENT ON */
+
+double
+asin(double x) {
+	double t, w, p, q, c, r, s;
+	int hx, ix, i;
+
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix >= 0x3ff00000) {	/* |x| >= 1 */
+		if (((ix - 0x3ff00000) | ((int *) &x)[LOWORD]) == 0)
+			/* asin(1)=+-pi/2 with inexact */
+			return (x * pio2_hi + x * pio2_lo);
+		else if (isnan(x))
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+			return (ix >= 0x7ff80000 ? x : (x - x) / (x - x));
+			/* assumes sparc-like QNaN */
+#else
+			return (x - x) / (x - x);	/* asin(|x|>1) is NaN */
+#endif
+		else
+			return (_SVID_libm_err(x, x, 2));
+	} else if (ix < 0x3fe00000) {	/* |x| < 0.5 */
+		if (ix < 0x3e400000) {	/* if |x| < 2**-27 */
+			if ((i = (int) x) == 0)
+				/* return x with inexact if x != 0 */
+				return (x);
+		}
+		t = x * x;
+		p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 +
+			t * (pS4 + t * pS5)))));
+		q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));
+		w = p / q;
+		return (x + x * w);
+	}
+	/* 1 > |x| >= 0.5 */
+	w = one - fabs(x);
+	t = w * 0.5;
+	p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5)))));
+	q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));
+	s = sqrt(t);
+	if (ix >= 0x3FEF3333) {	/* if |x| > 0.975 */
+		w = p / q;
+		t = pio2_hi - (2.0 * (s + s * w) - pio2_lo);
+	} else {
+		w = s;
+		((int *) &w)[LOWORD] = 0;
+		c = (t - w * w) / (s + w);
+		r = p / q;
+		p = 2.0 * s * r - (pio2_lo - 2.0 * c);
+		q = pio4_hi - 2.0 * w;
+		t = pio4_hi - (p - q);
+	}
+	return (hx > 0 ? t : -t);
+}
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/asinh.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,89 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak asinh = __asinh
+
+/* INDENT OFF */
+/*
+ * asinh(x)
+ * Method :
+ *	Based on
+ *		asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
+ *	we have
+ *	asinh(x) := x  if  1+x*x == 1,
+ *		 := sign(x)*(log(x)+ln2)) for large |x|, else
+ *		 := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x| > 2, else
+ *		 := sign(x)*log1p(|x|+x^2/(1+sqrt(1+x^2)))
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __asinh */
+#include "libm_macros.h"
+#include <math.h>
+
+static const double xxx[] = {
+/* one */	1.00000000000000000000e+00,	/* 3FF00000, 00000000 */
+/* ln2 */	6.93147180559945286227e-01,	/* 3FE62E42, FEFA39EF */
+/* huge */	1.00000000000000000000e+300
+};
+#define	one	xxx[0]
+#define	ln2	xxx[1]
+#define	huge	xxx[2]
+
+double
+asinh(double x) {
+	double t, w;
+	int hx, ix;
+
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix >= 0x7ff00000)
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+		return (ix >= 0x7ff80000 ? x : x + x);
+		/* assumes sparc-like QNaN */
+#else
+		return (x + x);	/* x is inf or NaN */
+#endif
+	if (ix < 0x3e300000) {	/* |x|<2**-28 */
+		if (huge + x > one)
+			return (x);	/* return x inexact except 0 */
+	}
+	if (ix > 0x41b00000) {	/* |x| > 2**28 */
+		w = log(fabs(x)) + ln2;
+	} else if (ix > 0x40000000) {
+		/* 2**28 > |x| > 2.0 */
+		t = fabs(x);
+		w = log(2.0 * t + one / (sqrt(x * x + one) + t));
+	} else {
+		/* 2.0 > |x| > 2**-28 */
+		t = x * x;
+		w = log1p(fabs(x) + t / (one + sqrt(one + t)));
+	}
+	return (hx > 0 ? w : -w);
+}
--- /dev/null	Thu Oct  9 19:48:52 2014
+++ new/usr/src/lib/libm/common/C/atanh.c	Thu Oct  9 19:48:52 2014
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak atanh = __atanh
+
+/* INDENT OFF */
+/*
+ * atanh(x)
+ * Code originated from 4.3bsd.
+ * Modified by K.C. Ng for SUN 4.0 libm.
+ * Method :
+ *                  1              2x                          x
+ *	atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ *                  2             1 - x                      1 - x
+ * Note: to guarantee atanh(-x) = -atanh(x), we use
+ *                 sign(x)             |x|
+ *	atanh(x) = ------- * log1p(2*-------).
+ *                    2              1 - |x|
+ *
+ * Special cases:
+ *	atanh(x) is NaN if |x| > 1 with signal;
+ *	atanh(NaN) is that NaN with no signal;
+ *	atanh(+-1) is +-INF with signal.
+ */
+/* INDENT ON */
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "libm_protos.h"
+#include <math.h>
+
+double
+atanh(double x) {
+	double t;
+
+	if (isnan(x))
+		return (x * x);		/* switched from x + x for Cheetah */
+	t = fabs(x);
+	if (t > 1.0)
+		return (_SVID_libm_err(x, x, 30));	/* sNaN */
+	if (t == 1.0)
+		return (_SVID_libm_err(x, x, 31));	/* x/0; */
+	t = t / (1.0 - t);
+	return (copysign(0.5, x) * log1p(t + t));
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/cosh.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,90 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak cosh = __cosh
+
+/* INDENT OFF */
+/*
+ * cosh(x)
+ * Code originated from 4.3bsd.
+ * Modified by K.C. Ng for SUN 4.0 libm.
+ * Method :
+ *	1. Replace x by |x| (cosh(x) = cosh(-x)).
+ *	2.
+ *                                       [ exp(x) - 1 ]^2
+ *  0        <= x <= 0.3465  :  cosh(x) := 1 + -------------------
+ *								      2*exp(x)
+ *
+ *		                                   exp(x) +  1/exp(x)
+ *  0.3465   <= x <= 22      :  cosh(x) := -------------------
+ *								           2
+ *  22       <= x <= lnovft  :  cosh(x) := exp(x)/2
+ *  lnovft   <= x <  INF     :  cosh(x) := scalbn(exp(x-1024*ln2),1023)
+ *
+ *	Note: .3465 is a number near one half of ln2.
+ *
+ * Special cases:
+ *	cosh(x) is |x| if x is +INF, -INF, or NaN.
+ *	only cosh(0)=1 is exact for finite x.
+ */
+/* INDENT ON */
+
+#include "libm.h"
+
+static const double
+	ln2 = 6.93147180559945286227e-01,
+	ln2hi = 6.93147180369123816490e-01,
+	ln2lo = 1.90821492927058770002e-10,
+	lnovft = 7.09782712893383973096e+02;
+
+double
+cosh(double x) {
+	double t, w;
+
+	w = fabs(x);
+	if (!finite(w))
+		return (w * w);
+	if (w < 0.3465) {
+		t = expm1(w);
+		w = 1.0 + t;
+		if (w != 1.0)
+			w = 1.0 + (t * t) / (w + w);
+		return (w);
+	} else if (w < 22.0) {
+		t = exp(w);
+		return (0.5 * (t + 1.0 / t));
+	} else if (w <= lnovft) {
+		return (0.5 * exp(w));
+	} else {
+		w = (w - 1024 * ln2hi) - 1024 * ln2lo;
+		if (w >= ln2)
+			return (_SVID_libm_err(x, x, 5));
+		else
+			return (scalbn(exp(w), 1023));
+	}
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/erf.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,427 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak erf = __erf
+#pragma weak erfc = __erfc
+
+/* INDENT OFF */
+/*
+ * double erf(double x)
+ * double erfc(double x)
+ *			     x
+ *		      2      |\
+ *     erf(x)  =  ---------  | exp(-t*t)dt
+ *		   sqrt(pi) \|
+ *			     0
+ *
+ *     erfc(x) =  1-erf(x)
+ *  Note that
+ *		erf(-x) = -erf(x)
+ *		erfc(-x) = 2 - erfc(x)
+ *
+ * Method:
+ *	1. For |x| in [0, 0.84375]
+ *	    erf(x)  = x + x*R(x^2)
+ *          erfc(x) = 1 - erf(x)           if x in [-.84375,0.25]
+ *                  = 0.5 + ((0.5-x)-x*R)  if x in [0.25,0.84375]
+ *	   where R = P/Q where P is an odd poly of degree 8 and
+ *	   Q is an odd poly of degree 10.
+ *						 -57.90
+ *			| R - (erf(x)-x)/x | <= 2
+ *
+ *
+ *	   Remark. The formula is derived by noting
+ *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
+ *	   and that
+ *          2/sqrt(pi) = 1.128379167095512573896158903121545171688
+ *	   is close to one. The interval is chosen because the fix
+ *	   point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is
+ *	   near 0.6174), and by some experiment, 0.84375 is chosen to
+ *	   guarantee the error is less than one ulp for erf.
+ *
+ *      2. For |x| in [0.84375,1.25], let s = |x| - 1, and
+ *         c = 0.84506291151 rounded to single (24 bits)
+ *         	erf(x)  = sign(x) * (c  + P1(s)/Q1(s))
+ *         	erfc(x) = (1-c)  - P1(s)/Q1(s) if x > 0
+ *			  1+(c+P1(s)/Q1(s))    if x < 0
+ *         	|P1/Q1 - (erf(|x|)-c)| <= 2**-59.06
+ *	   Remark: here we use the taylor series expansion at x=1.
+ *		erf(1+s) = erf(1) + s*Poly(s)
+ *			 = 0.845.. + P1(s)/Q1(s)
+ *	   That is, we use rational approximation to approximate
+ *			erf(1+s) - (c = (single)0.84506291151)
+ *	   Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
+ *	   where
+ *		P1(s) = degree 6 poly in s
+ *		Q1(s) = degree 6 poly in s
+ *
+ *      3. For x in [1.25,1/0.35(~2.857143)],
+ *         	erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)
+ *         	erf(x)  = 1 - erfc(x)
+ *	   where
+ *		R1(z) = degree 7 poly in z, (z=1/x^2)
+ *		S1(z) = degree 8 poly in z
+ *
+ *      4. For x in [1/0.35,28]
+ *         	erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0
+ *			= 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0
+ *			= 2.0 - tiny		(if x <= -6)
+ *         	erf(x)  = sign(x)*(1.0 - erfc(x)) if x < 6, else
+ *         	erf(x)  = sign(x)*(1.0 - tiny)
+ *	   where
+ *		R2(z) = degree 6 poly in z, (z=1/x^2)
+ *		S2(z) = degree 7 poly in z
+ *
+ *      Note1:
+ *	   To compute exp(-x*x-0.5625+R/S), let s be a single
+ *	   precision number and s := x; then
+ *		-x*x = -s*s + (s-x)*(s+x)
+ *	        exp(-x*x-0.5626+R/S) =
+ *			exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
+ *      Note2:
+ *	   Here 4 and 5 make use of the asymptotic series
+ *			  exp(-x*x)
+ *		erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
+ *			  x*sqrt(pi)
+ *	   We use rational approximation to approximate
+ *      	g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625
+ *	   Here is the error bound for R1/S1 and R2/S2
+ *      	|R1/S1 - f(x)|  < 2**(-62.57)
+ *      	|R2/S2 - f(x)|  < 2**(-61.52)
+ *
+ *      5. For inf > x >= 28
+ *         	erf(x)  = sign(x) *(1 - tiny)  (raise inexact)
+ *         	erfc(x) = tiny*tiny (raise underflow) if x > 0
+ *			= 2 - tiny if x<0
+ *
+ *      7. Special case:
+ *         	erf(0)  = 0, erf(inf)  = 1, erf(-inf) = -1,
+ *         	erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
+ *   	erfc/erf(NaN) is NaN
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __erf, __erfc, __exp */
+#include "libm_macros.h"
+#include <math.h>
+
+static const double xxx[] = {
+/* tiny */	1e-300,
+/* half */	5.00000000000000000000e-01,	/* 3FE00000, 00000000 */
+/* one */	1.00000000000000000000e+00,	/* 3FF00000, 00000000 */
+/* two */	2.00000000000000000000e+00,	/* 40000000, 00000000 */
+/* erx */	8.45062911510467529297e-01,	/* 3FEB0AC1, 60000000 */
+/*
+ * Coefficients for approximation to  erf on [0,0.84375]
+ */
+/* efx */	 1.28379167095512586316e-01,	/* 3FC06EBA, 8214DB69 */
+/* efx8 */	 1.02703333676410069053e+00,	/* 3FF06EBA, 8214DB69 */
+/* pp0 */	 1.28379167095512558561e-01,	/* 3FC06EBA, 8214DB68 */
+/* pp1 */	-3.25042107247001499370e-01,	/* BFD4CD7D, 691CB913 */
+/* pp2 */	-2.84817495755985104766e-02,	/* BF9D2A51, DBD7194F */
+/* pp3 */	-5.77027029648944159157e-03,	/* BF77A291, 236668E4 */
+/* pp4 */	-2.37630166566501626084e-05,	/* BEF8EAD6, 120016AC */
+/* qq1 */	 3.97917223959155352819e-01,	/* 3FD97779, CDDADC09 */
+/* qq2 */	 6.50222499887672944485e-02,	/* 3FB0A54C, 5536CEBA */
+/* qq3 */	 5.08130628187576562776e-03,	/* 3F74D022, C4D36B0F */
+/* qq4 */	 1.32494738004321644526e-04,	/* 3F215DC9, 221C1A10 */
+/* qq5 */	-3.96022827877536812320e-06,	/* BED09C43, 42A26120 */
+/*
+ * Coefficients for approximation to  erf  in [0.84375,1.25]
+ */
+/* pa0 */	-2.36211856075265944077e-03,	/* BF6359B8, BEF77538 */
+/* pa1 */	 4.14856118683748331666e-01,	/* 3FDA8D00, AD92B34D */
+/* pa2 */	-3.72207876035701323847e-01,	/* BFD7D240, FBB8C3F1 */
+/* pa3 */	 3.18346619901161753674e-01,	/* 3FD45FCA, 805120E4 */
+/* pa4 */	-1.10894694282396677476e-01,	/* BFBC6398, 3D3E28EC */
+/* pa5 */	 3.54783043256182359371e-02,	/* 3FA22A36, 599795EB */
+/* pa6 */	-2.16637559486879084300e-03,	/* BF61BF38, 0A96073F */
+/* qa1 */	 1.06420880400844228286e-01,	/* 3FBB3E66, 18EEE323 */
+/* qa2 */	 5.40397917702171048937e-01,	/* 3FE14AF0, 92EB6F33 */
+/* qa3 */	 7.18286544141962662868e-02,	/* 3FB2635C, D99FE9A7 */
+/* qa4 */	 1.26171219808761642112e-01,	/* 3FC02660, E763351F */
+/* qa5 */	 1.36370839120290507362e-02,	/* 3F8BEDC2, 6B51DD1C */
+/* qa6 */	 1.19844998467991074170e-02,	/* 3F888B54, 5735151D */
+/*
+ * Coefficients for approximation to  erfc in [1.25,1/0.35]
+ */
+/* ra0 */	-9.86494403484714822705e-03,	/* BF843412, 600D6435 */
+/* ra1 */	-6.93858572707181764372e-01,	/* BFE63416, E4BA7360 */
+/* ra2 */	-1.05586262253232909814e+01,	/* C0251E04, 41B0E726 */
+/* ra3 */	-6.23753324503260060396e+01,	/* C04F300A, E4CBA38D */
+/* ra4 */	-1.62396669462573470355e+02,	/* C0644CB1, 84282266 */
+/* ra5 */	-1.84605092906711035994e+02,	/* C067135C, EBCCABB2 */
+/* ra6 */	-8.12874355063065934246e+01,	/* C0545265, 57E4D2F2 */
+/* ra7 */	-9.81432934416914548592e+00,	/* C023A0EF, C69AC25C */
+/* sa1 */	 1.96512716674392571292e+01,	/* 4033A6B9, BD707687 */
+/* sa2 */	 1.37657754143519042600e+02,	/* 4061350C, 526AE721 */
+/* sa3 */	 4.34565877475229228821e+02,	/* 407B290D, D58A1A71 */
+/* sa4 */	 6.45387271733267880336e+02,	/* 40842B19, 21EC2868 */
+/* sa5 */	 4.29008140027567833386e+02,	/* 407AD021, 57700314 */
+/* sa6 */	 1.08635005541779435134e+02,	/* 405B28A3, EE48AE2C */
+/* sa7 */	 6.57024977031928170135e+00,	/* 401A47EF, 8E484A93 */
+/* sa8 */	-6.04244152148580987438e-02,	/* BFAEEFF2, EE749A62 */
+/*
+ * Coefficients for approximation to  erfc in [1/.35,28]
+ */
+/* rb0 */	-9.86494292470009928597e-03,	/* BF843412, 39E86F4A */
+/* rb1 */	-7.99283237680523006574e-01,	/* BFE993BA, 70C285DE */
+/* rb2 */	-1.77579549177547519889e+01,	/* C031C209, 555F995A */
+/* rb3 */	-1.60636384855821916062e+02,	/* C064145D, 43C5ED98 */
+/* rb4 */	-6.37566443368389627722e+02,	/* C083EC88, 1375F228 */
+/* rb5 */	-1.02509513161107724954e+03,	/* C0900461, 6A2E5992 */
+/* rb6 */	-4.83519191608651397019e+02,	/* C07E384E, 9BDC383F */
+/* sb1 */	 3.03380607434824582924e+01,	/* 403E568B, 261D5190 */
+/* sb2 */	 3.25792512996573918826e+02,	/* 40745CAE, 221B9F0A */
+/* sb3 */	 1.53672958608443695994e+03,	/* 409802EB, 189D5118 */
+/* sb4 */	 3.19985821950859553908e+03,	/* 40A8FFB7, 688C246A */
+/* sb5 */	 2.55305040643316442583e+03,	/* 40A3F219, CEDF3BE6 */
+/* sb6 */	 4.74528541206955367215e+02,	/* 407DA874, E79FE763 */
+/* sb7 */	-2.24409524465858183362e+01	/* C03670E2, 42712D62 */
+};
+
+#define	tiny	xxx[0]
+#define	half	xxx[1]
+#define	one	xxx[2]
+#define	two	xxx[3]
+#define	erx	xxx[4]
+/*
+ * Coefficients for approximation to  erf on [0,0.84375]
+ */
+#define	efx	xxx[5]
+#define	efx8	xxx[6]
+#define	pp0	xxx[7]
+#define	pp1	xxx[8]
+#define	pp2	xxx[9]
+#define	pp3	xxx[10]
+#define	pp4	xxx[11]
+#define	qq1	xxx[12]
+#define	qq2	xxx[13]
+#define	qq3	xxx[14]
+#define	qq4	xxx[15]
+#define	qq5	xxx[16]
+/*
+ * Coefficients for approximation to  erf  in [0.84375,1.25]
+ */
+#define	pa0	xxx[17]
+#define	pa1	xxx[18]
+#define	pa2	xxx[19]
+#define	pa3	xxx[20]
+#define	pa4	xxx[21]
+#define	pa5	xxx[22]
+#define	pa6	xxx[23]
+#define	qa1	xxx[24]
+#define	qa2	xxx[25]
+#define	qa3	xxx[26]
+#define	qa4	xxx[27]
+#define	qa5	xxx[28]
+#define	qa6	xxx[29]
+/*
+ * Coefficients for approximation to  erfc in [1.25,1/0.35]
+ */
+#define	ra0	xxx[30]
+#define	ra1	xxx[31]
+#define	ra2	xxx[32]
+#define	ra3	xxx[33]
+#define	ra4	xxx[34]
+#define	ra5	xxx[35]
+#define	ra6	xxx[36]
+#define	ra7	xxx[37]
+#define	sa1	xxx[38]
+#define	sa2	xxx[39]
+#define	sa3	xxx[40]
+#define	sa4	xxx[41]
+#define	sa5	xxx[42]
+#define	sa6	xxx[43]
+#define	sa7	xxx[44]
+#define	sa8	xxx[45]
+/*
+ * Coefficients for approximation to  erfc in [1/.35,28]
+ */
+#define	rb0	xxx[46]
+#define	rb1	xxx[47]
+#define	rb2	xxx[48]
+#define	rb3	xxx[49]
+#define	rb4	xxx[50]
+#define	rb5	xxx[51]
+#define	rb6	xxx[52]
+#define	sb1	xxx[53]
+#define	sb2	xxx[54]
+#define	sb3	xxx[55]
+#define	sb4	xxx[56]
+#define	sb5	xxx[57]
+#define	sb6	xxx[58]
+#define	sb7	xxx[59]
+
+double
+erf(double x) {
+	int hx, ix, i;
+	double R, S, P, Q, s, y, z, r;
+
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix >= 0x7ff00000) {	/* erf(nan)=nan */
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+		if (ix >= 0x7ff80000)		/* assumes sparc-like QNaN */
+			return (x);
+#endif
+		i = ((unsigned) hx >> 31) << 1;
+		return ((double) (1 - i) + one / x);	/* erf(+-inf)=+-1 */
+	}
+
+	if (ix < 0x3feb0000) {	/* |x|<0.84375 */
+		if (ix < 0x3e300000) {	/* |x|<2**-28 */
+			if (ix < 0x00800000)	/* avoid underflow */
+				return (0.125 * (8.0 * x + efx8 * x));
+			return (x + efx * x);
+		}
+		z = x * x;
+		r = pp0 + z * (pp1 + z * (pp2 + z * (pp3 + z * pp4)));
+		s = one +
+			z *(qq1 + z * (qq2 + z * (qq3 + z * (qq4 + z * qq5))));
+		y = r / s;
+		return (x + x * y);
+	}
+	if (ix < 0x3ff40000) {	/* 0.84375 <= |x| < 1.25 */
+		s = fabs(x) - one;
+		P = pa0 + s * (pa1 + s * (pa2 + s * (pa3 + s * (pa4 +
+			s * (pa5 + s * pa6)))));
+		Q = one + s * (qa1 + s * (qa2 + s * (qa3 + s * (qa4 +
+			s * (qa5 + s * qa6)))));
+		if (hx >= 0)
+			return (erx + P / Q);
+		else
+			return (-erx - P / Q);
+	}
+	if (ix >= 0x40180000) {	/* inf > |x| >= 6 */
+		if (hx >= 0)
+			return (one - tiny);
+		else
+			return (tiny - one);
+	}
+	x = fabs(x);
+	s = one / (x * x);
+	if (ix < 0x4006DB6E) {	/* |x| < 1/0.35 */
+		R = ra0 + s * (ra1 + s * (ra2 + s * (ra3 + s * (ra4 +
+			s * (ra5 + s * (ra6 + s * ra7))))));
+		S = one + s * (sa1 + s * (sa2 + s * (sa3 + s * (sa4 +
+			s * (sa5 + s * (sa6 + s * (sa7 + s * sa8)))))));
+	} else {			/* |x| >= 1/0.35 */
+		R = rb0 + s * (rb1 + s * (rb2 + s * (rb3 + s * (rb4 +
+			s * (rb5 + s * rb6)))));
+		S = one + s * (sb1 + s * (sb2 + s * (sb3 + s * (sb4 +
+			s * (sb5 + s * (sb6 + s * sb7))))));
+	}
+	z = x;
+	((int *) &z)[LOWORD] = 0;
+	r = exp(-z * z - 0.5625) * exp((z - x) * (z + x) + R / S);
+	if (hx >= 0)
+		return (one - r / x);
+	else
+		return (r / x - one);
+}
+
+double
+erfc(double x) {
+	int hx, ix;
+	double R, S, P, Q, s, y, z, r;
+
+	hx = ((int *) &x)[HIWORD];
+	ix = hx & 0x7fffffff;
+	if (ix >= 0x7ff00000) {	/* erfc(nan)=nan */
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+		if (ix >= 0x7ff80000)		/* assumes sparc-like QNaN */
+			return (x);
+#endif
+		/* erfc(+-inf)=0,2 */
+		return ((double) (((unsigned) hx >> 31) << 1) + one / x);
+	}
+
+	if (ix < 0x3feb0000) {	/* |x| < 0.84375 */
+		if (ix < 0x3c700000)	/* |x| < 2**-56 */
+			return (one - x);
+		z = x * x;
+		r = pp0 + z * (pp1 + z * (pp2 + z * (pp3 + z * pp4)));
+		s = one +
+			z * (qq1 + z * (qq2 + z * (qq3 + z * (qq4 + z * qq5))));
+		y = r / s;
+		if (hx < 0x3fd00000) {	/* x < 1/4 */
+			return (one - (x + x * y));
+		} else {
+			r = x * y;
+			r += (x - half);
+			return (half - r);
+		}
+	}
+	if (ix < 0x3ff40000) {	/* 0.84375 <= |x| < 1.25 */
+		s = fabs(x) - one;
+		P = pa0 + s * (pa1 + s * (pa2 + s * (pa3 + s * (pa4 +
+			s * (pa5 + s * pa6)))));
+		Q = one + s * (qa1 + s * (qa2 + s * (qa3 + s * (qa4 +
+			s * (qa5 + s * qa6)))));
+		if (hx >= 0) {
+			z = one - erx;
+			return (z - P / Q);
+		} else {
+			z = erx + P / Q;
+			return (one + z);
+		}
+	}
+	if (ix < 0x403c0000) {	/* |x|<28 */
+		x = fabs(x);
+		s = one / (x * x);
+		if (ix < 0x4006DB6D) {	/* |x| < 1/.35 ~ 2.857143 */
+			R = ra0 + s * (ra1 + s * (ra2 + s * (ra3 + s * (ra4 +
+				s * (ra5 + s * (ra6 + s * ra7))))));
+			S = one + s * (sa1 + s * (sa2 + s * (sa3 + s * (sa4 +
+				s * (sa5 + s * (sa6 + s * (sa7 + s * sa8)))))));
+		} else {
+			/* |x| >= 1/.35 ~ 2.857143 */
+			if (hx < 0 && ix >= 0x40180000)
+				return (two - tiny);	/* x < -6 */
+
+			R = rb0 + s * (rb1 + s * (rb2 + s * (rb3 + s * (rb4 +
+				s * (rb5 + s * rb6)))));
+			S = one + s * (sb1 + s * (sb2 + s * (sb3 + s * (sb4 +
+				s * (sb5 + s * (sb6 + s * sb7))))));
+		}
+		z = x;
+		((int *) &z)[LOWORD] = 0;
+		r = exp(-z * z - 0.5625) * exp((z - x) * (z + x) + R / S);
+		if (hx > 0)
+			return (r / x);
+		else
+			return (two - r / x);
+	} else {
+		if (hx > 0)
+			return (tiny * tiny);
+		else
+			return (two - tiny);
+	}
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/expm1.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,266 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak expm1 = __expm1
+
+/* INDENT OFF */
+/*
+ * expm1(x)
+ * Returns exp(x)-1, the exponential of x minus 1.
+ *
+ * Method
+ *   1. Arugment reduction:
+ *	Given x, find r and integer k such that
+ *
+ *               x = k*ln2 + r,  |r| <= 0.5*ln2 ~ 0.34658
+ *
+ *      Here a correction term c will be computed to compensate
+ *	the error in r when rounded to a floating-point number.
+ *
+ *   2. Approximating expm1(r) by a special rational function on
+ *	the interval [0,0.34658]:
+ *	Since
+ *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...
+ *	we define R1(r*r) by
+ *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)
+ *	That is,
+ *	    R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
+ *		     = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
+ *		     = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
+ *      We use a special Reme algorithm on [0,0.347] to generate
+ * 	a polynomial of degree 5 in r*r to approximate R1. The
+ *	maximum error of this polynomial approximation is bounded
+ *	by 2**-61. In other words,
+ *	    R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
+ *	where 	Q1  =  -1.6666666666666567384E-2,
+ * 		Q2  =   3.9682539681370365873E-4,
+ * 		Q3  =  -9.9206344733435987357E-6,
+ * 		Q4  =   2.5051361420808517002E-7,
+ * 		Q5  =  -6.2843505682382617102E-9;
+ *  	(where z=r*r, and the values of Q1 to Q5 are listed below)
+ *	with error bounded by
+ *	    |                  5           |     -61
+ *	    | 1.0+Q1*z+...+Q5*z   -  R1(z) | <= 2
+ *	    |                              |
+ *
+ *	expm1(r) = exp(r)-1 is then computed by the following
+ * 	specific way which minimize the accumulation rounding error:
+ *			       2     3
+ *			      r     r    [ 3 - (R1 + R1*r/2)  ]
+ *	      expm1(r) = r + --- + --- * [--------------------]
+ *		              2     2    [ 6 - r*(3 - R1*r/2) ]
+ *
+ *	To compensate the error in the argument reduction, we use
+ *		expm1(r+c) = expm1(r) + c + expm1(r)*c
+ *			   ~ expm1(r) + c + r*c
+ *	Thus c+r*c will be added in as the correction terms for
+ *	expm1(r+c). Now rearrange the term to avoid optimization
+ * 	screw up:
+ *		        (      2                                    2 )
+ *		        ({  ( r    [ R1 -  (3 - R1*r/2) ]  )  }    r  )
+ *	 expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
+ *	                ({  ( 2    [ 6 - r*(3 - R1*r/2) ]  )  }    2  )
+ *                      (                                             )
+ *
+ *		   = r - E
+ *   3. Scale back to obtain expm1(x):
+ *	From step 1, we have
+ *	   expm1(x) = either 2^k*[expm1(r)+1] - 1
+ *		    = or     2^k*[expm1(r) + (1-2^-k)]
+ *   4. Implementation notes:
+ *	(A). To save one multiplication, we scale the coefficient Qi
+ *	     to Qi*2^i, and replace z by (x^2)/2.
+ *	(B). To achieve maximum accuracy, we compute expm1(x) by
+ *	  (i)   if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
+ *	  (ii)  if k=0, return r-E
+ *	  (iii) if k=-1, return 0.5*(r-E)-0.5
+ *        (iv)	if k=1 if r < -0.25, return 2*((r+0.5)- E)
+ *					else	     return  1.0+2.0*(r-E);
+ *	  (v)   if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
+ *	  (vi)  if k <= 20, return 2^k((1-2^-k)-(E-r)), else
+ *	  (vii) return 2^k(1-((E+2^-k)-r))
+ *
+ * Special cases:
+ *	expm1(INF) is INF, expm1(NaN) is NaN;
+ *	expm1(-INF) is -1, and
+ *	for finite argument, only expm1(0)=0 is exact.
+ *
+ * Accuracy:
+ *	according to an error analysis, the error is always less than
+ *	1 ulp (unit in the last place).
+ *
+ * Misc. info.
+ *	For IEEE double
+ *	    if x >  7.09782712893383973096e+02 then expm1(x) overflow
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+/* INDENT ON */
+
+#include "libm_synonyms.h"	/* __expm1 */
+#include "libm_macros.h"
+#include <math.h>
+
+static const double xxx[] = {
+/* one */		 1.0,
+/* huge */		 1.0e+300,
+/* tiny */		 1.0e-300,
+/* o_threshold */	 7.09782712893383973096e+02,	/* 40862E42 FEFA39EF */
+/* ln2_hi */		 6.93147180369123816490e-01,	/* 3FE62E42 FEE00000 */
+/* ln2_lo */		 1.90821492927058770002e-10,	/* 3DEA39EF 35793C76 */
+/* invln2 */		 1.44269504088896338700e+00,	/* 3FF71547 652B82FE */
+/* scaled coefficients related to expm1 */
+/* Q1 */		-3.33333333333331316428e-02,	/* BFA11111 111110F4 */
+/* Q2 */		 1.58730158725481460165e-03,	/* 3F5A01A0 19FE5585 */
+/* Q3 */		-7.93650757867487942473e-05,	/* BF14CE19 9EAADBB7 */
+/* Q4 */		 4.00821782732936239552e-06,	/* 3ED0CFCA 86E65239 */
+/* Q5 */		-2.01099218183624371326e-07	/* BE8AFDB7 6E09C32D */
+};
+#define	one		xxx[0]
+#define	huge		xxx[1]
+#define	tiny		xxx[2]
+#define	o_threshold	xxx[3]
+#define	ln2_hi		xxx[4]
+#define	ln2_lo		xxx[5]
+#define	invln2		xxx[6]
+#define	Q1		xxx[7]
+#define	Q2		xxx[8]
+#define	Q3		xxx[9]
+#define	Q4		xxx[10]
+#define	Q5		xxx[11]
+
+double
+expm1(double x) {
+	double y, hi, lo, c = 0.0L, t, e, hxs, hfx, r1;
+	int k, xsb;
+	unsigned hx;
+
+	hx = ((unsigned *) &x)[HIWORD];		/* high word of x */
+	xsb = hx & 0x80000000;			/* sign bit of x */
+	if (xsb == 0)
+		y = x;
+	else
+		y = -x;				/* y = |x| */
+	hx &= 0x7fffffff;			/* high word of |x| */
+
+	/* filter out huge and non-finite argument */
+	/* for example exp(38)-1 is approximately 3.1855932e+16 */
+	if (hx >= 0x4043687A) {
+		/* if |x|>=56*ln2 (~38.8162...) */
+		if (hx >= 0x40862E42) {		/* if |x|>=709.78... -> inf */
+			if (hx >= 0x7ff00000) {
+				if (((hx & 0xfffff) | ((int *) &x)[LOWORD])
+					!= 0)
+					return (x * x);	/* + -> * for Cheetah */
+				else
+					/* exp(+-inf)={inf,-1} */
+					return (xsb == 0 ? x : -1.0);
+			}
+			if (x > o_threshold)
+				return (huge * huge);	/* overflow */
+		}
+		if (xsb != 0) {		/* x < -56*ln2, return -1.0 w/inexact */
+			if (x + tiny < 0.0)		/* raise inexact */
+				return (tiny - one);	/* return -1 */
+		}
+	}
+
+	/* argument reduction */
+	if (hx > 0x3fd62e42) {			/* if  |x| > 0.5 ln2 */
+		if (hx < 0x3FF0A2B2) {		/* and |x| < 1.5 ln2 */
+			if (xsb == 0) {		/* positive number */
+				hi = x - ln2_hi;
+				lo = ln2_lo;
+				k = 1;
+			} else {
+				/* negative number */
+				hi = x + ln2_hi;
+				lo = -ln2_lo;
+				k = -1;
+			}
+		} else {
+			/* |x| > 1.5 ln2 */
+			k = (int) (invln2 * x + (xsb == 0 ? 0.5 : -0.5));
+			t = k;
+			hi = x - t * ln2_hi;	/* t*ln2_hi is exact here */
+			lo = t * ln2_lo;
+		}
+		x = hi - lo;
+		c = (hi - x) - lo; /* still at |x| > 0.5 ln2 */
+	} else if (hx < 0x3c900000) {
+		/* when |x|<2**-54, return x */
+		t = huge + x;		/* return x w/inexact when x != 0 */
+		return (x - (t - (huge + x)));
+	} else
+		/* |x| <= 0.5 ln2 */
+		k = 0;
+
+	/* x is now in primary range */
+	hfx = 0.5 * x;
+	hxs = x * hfx;
+	r1 = one + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));
+	t = 3.0 - r1 * hfx;
+	e = hxs * ((r1 - t) / (6.0 - x * t));
+	if (k == 0) /* |x| <= 0.5 ln2 */
+		return (x - (x * e - hxs));
+	else {		/* |x| > 0.5 ln2 */
+		e = (x * (e - c) - c);
+		e -= hxs;
+		if (k == -1)
+			return (0.5 * (x - e) - 0.5);
+		if (k == 1) {
+			if (x < -0.25)
+				return (-2.0 * (e - (x + 0.5)));
+			else
+				return (one + 2.0 * (x - e));
+		}
+		if (k <= -2 || k > 56) {	/* suffice to return exp(x)-1 */
+			y = one - (e - x);
+			((int *) &y)[HIWORD] += k << 20;
+			return (y - one);
+		}
+		t = one;
+		if (k < 20) {
+			((int *) &t)[HIWORD] = 0x3ff00000 - (0x200000 >> k);
+							/* t = 1 - 2^-k */
+			y = t - (e - x);
+			((int *) &y)[HIWORD] += k << 20;
+		} else {
+			((int *) &t)[HIWORD] = (0x3ff - k) << 20; /* 2^-k */
+			y = x - (e + t);
+			y += one;
+			((int *) &y)[HIWORD] += k << 20;
+		}
+	}
+	return (y);
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/fabs.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak fabs = __fabs
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "libm_macros.h"
+#include <math.h>
+
+double
+fabs(double x) {
+	int *px = (int *) &x;
+
+	px[HIWORD] &= ~0x80000000;
+	return (x);
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/j0.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,322 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Floating point Bessel's function of the first and second kinds
+ * of order zero: j0(x),y0(x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ */
+
+#pragma weak j0 = __j0
+#pragma weak y0 = __y0
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "libm_protos.h"
+#include <math.h>
+#include <values.h>
+
+#define	GENERIC double
+static const GENERIC
+zero    = 0.0,
+small	= 1.0e-5,
+tiny	= 1.0e-18,
+one	= 1.0,
+eight   = 8.0,
+invsqrtpi = 5.641895835477562869480794515607725858441e-0001,
+tpi	= 0.636619772367581343075535053490057448;
+
+static GENERIC pzero(GENERIC), qzero(GENERIC);
+static const GENERIC r0[4] = {	/* [1.e-5, 1.28] */
+	-2.500000000000003622131880894830476755537e-0001,
+	1.095597547334830263234433855932375353303e-0002,
+	-1.819734750463320921799187258987098087697e-0004,
+	9.977001946806131657544212501069893930846e-0007,
+};
+static const GENERIC s0[4] = {	/* [1.e-5, 1.28] */
+	1.0,
+	1.867609810662950169966782360588199673741e-0002,
+	1.590389206181565490878430827706972074208e-0004,
+	6.520867386742583632375520147714499522721e-0007,
+};
+static const GENERIC r1[9] = {	/* [1.28,8] */
+	9.999999999999999942156495584397047660949e-0001,
+	-2.389887722731319130476839836908143731281e-0001,
+	1.293359476138939027791270393439493640570e-0002,
+	-2.770985642343140122168852400228563364082e-0004,
+	2.905241575772067678086738389169625218912e-0006,
+	-1.636846356264052597969042009265043251279e-0008,
+	5.072306160724884775085431059052611737827e-0011,
+	-8.187060730684066824228914775146536139112e-0014,
+	5.422219326959949863954297860723723423842e-0017,
+};
+static const GENERIC s1[9] = {	/* [1.28,8] */
+	1.0,
+	1.101122772686807702762104741932076228349e-0002,
+	6.140169310641649223411427764669143978228e-0005,
+	2.292035877515152097976946119293215705250e-0007,
+	6.356910426504644334558832036362219583789e-0010,
+	1.366626326900219555045096999553948891401e-0012,
+	2.280399586866739522891837985560481180088e-0015,
+	2.801559820648939665270492520004836611187e-0018,
+	2.073101088320349159764410261466350732968e-0021,
+};
+
+GENERIC
+j0(GENERIC x) {
+	GENERIC z, s, c, ss, cc, r, u, v, ox;
+	int i;
+
+	if (isnan(x))
+		return (x*x);	/* + -> * for Cheetah */
+	ox = x;
+	x = fabs(x);
+	if (x > 8.0) {
+		if (!finite(x))
+			return (zero);
+		s = sin(x);
+		c = cos(x);
+	/*
+	 * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+	 * where x0 = x-pi/4
+	 * 	Better formula:
+	 *		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.
+	 */
+		if (x > 8.9e307) {	/* x+x may overflow */
+			ss = s-c;
+			cc = s+c;
+		} else if (signbit(s) != signbit(c)) {
+			ss = s - c;
+			cc = -cos(x+x)/ss;
+		} else {
+			cc = s + c;
+			ss = -cos(x+x)/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 (x > 1.0e40) z = (invsqrtpi*cc)/sqrt(x);
+		else {
+		    u = pzero(x); v = qzero(x);
+		    z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
+		}
+	/* force to pass SVR4 even the result is wrong (sign) */
+		if (x > X_TLOSS)
+		    return (_SVID_libm_err(ox, z, 34));
+		else
+		    return (z);
+	}
+	if (x <= small) {
+	    if (x <= tiny)
+			return (one-x);
+	    else
+			return (one-x*x*0.25);
+	}
+	z = x*x;
+	if (x <= 1.28) {
+	    r =  r0[0]+z*(r0[1]+z*(r0[2]+z*r0[3]));
+	    s =  s0[0]+z*(s0[1]+z*(s0[2]+z*s0[3]));
+	    return (one + z*(r/s));
+	} else {
+	    for (r = r1[8], s = s1[8], i = 7; i >= 0; i--) {
+		r = r*z + r1[i];
+		s = s*z + s1[i];
+	    }
+	    return (r/s);
+	}
+}
+
+static const GENERIC u0[13] = {
+	-7.380429510868722526754723020704317641941e-0002,
+	1.772607102684869924301459663049874294814e-0001,
+	-1.524370666542713828604078090970799356306e-0002,
+	4.650819100693891757143771557629924591915e-0004,
+	-7.125768872339528975036316108718239946022e-0006,
+	6.411017001656104598327565004771515257146e-0008,
+	-3.694275157433032553021246812379258781665e-0010,
+	1.434364544206266624252820889648445263842e-0012,
+	-3.852064731859936455895036286874139896861e-0015,
+	7.182052899726138381739945881914874579696e-0018,
+	-9.060556574619677567323741194079797987200e-0021,
+	7.124435467408860515265552217131230511455e-0024,
+	-2.709726774636397615328813121715432044771e-0027,
+};
+static const GENERIC v0[5] = {
+	1.0,
+	4.678678931512549002587702477349214886475e-0003,
+	9.486828955529948534822800829497565178985e-0006,
+	1.001495929158861646659010844136682454906e-0008,
+	4.725338116256021660204443235685358593611e-0012,
+};
+
+GENERIC
+y0(GENERIC x) {
+	GENERIC z, /* d, */ s, c, ss, cc, u, v;
+	int i;
+
+	if (isnan(x))
+		return (x*x);	/* + -> * for Cheetah */
+	if (x <= zero) {
+		if (x == zero)
+		    /* d= -one/(x-x); */
+		    return (_SVID_libm_err(x, x, 8));
+		else
+		    /* d = zero/(x-x); */
+		    return (_SVID_libm_err(x, x, 9));
+	}
+	if (x > 8.0) {
+		if (!finite(x))
+			return (zero);
+		s = sin(x);
+		c = cos(x);
+	/*
+	 * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+	 * where x0 = x-pi/4
+	 * 	Better formula:
+	 *		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.
+	 */
+		if (x > 8.9e307) {	/* x+x may overflow */
+			ss = s-c;
+			cc = s+c;
+		} else if (signbit(s) != signbit(c)) {
+			ss = s - c;
+			cc = -cos(x+x)/ss;
+		} else {
+			cc = s + c;
+			ss = -cos(x+x)/cc;
+		}
+	/*
+	 * j0(x) = 1/sqrt(pi*x) * (P(0,x)*cc - Q(0,x)*ss)
+	 * y0(x) = 1/sqrt(pi*x) * (P(0,x)*ss + Q(0,x)*cc)
+	 */
+		if (x > 1.0e40)
+		    z = (invsqrtpi*ss)/sqrt(x);
+		else
+		    z =  invsqrtpi*(pzero(x)*ss+qzero(x)*cc)/sqrt(x);
+		if (x > X_TLOSS)
+		    return (_SVID_libm_err(x, z, 35));
+		else
+		    return (z);
+
+	}
+	if (x <= tiny) {
+	    return (u0[0] + tpi*log(x));
+	}
+	z = x*x;
+	for (u = u0[12], i = 11; i >= 0; i--) u = u*z + u0[i];
+	v = v0[0]+z*(v0[1]+z*(v0[2]+z*(v0[3]+z*v0[4])));
+	return (u/v + tpi*(j0(x)*log(x)));
+}
+
+static const GENERIC pr[7] = {	/* [8 -- inf]  pzero 6550 */
+	.4861344183386052721391238447e5,
+	.1377662549407112278133438945e6,
+	.1222466364088289731869114004e6,
+	.4107070084315176135583353374e5,
+	.5026073801860637125889039915e4,
+	.1783193659125479654541542419e3,
+	.88010344055383421691677564e0,
+};
+static const GENERIC ps[7] = {	/* [8 -- inf] pzero 6550 */
+	.4861344183386052721414037058e5,
+	.1378196632630384670477582699e6,
+	.1223967185341006542748936787e6,
+	.4120150243795353639995862617e5,
+	.5068271181053546392490184353e4,
+	.1829817905472769960535671664e3,
+	1.0,
+};
+static const GENERIC huge    = 1.0e10;
+
+static GENERIC
+pzero(GENERIC x) {
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (one);
+	t = eight/x; z = t*t;
+	r = pr[5]+z*pr[6];
+	s = ps[5]+z;
+	for (i = 4; i >= 0; i--) {
+	    r = r*z + pr[i];
+	    s = s*z + ps[i];
+	}
+	return (r/s);
+}
+
+static const GENERIC qr[7] = {	/* [8 -- inf]  qzero 6950 */
+	-.1731210995701068539185611951e3,
+	-.5522559165936166961235240613e3,
+	-.5604935606637346590614529613e3,
+	-.2200430300226009379477365011e3,
+	-.323869355375648849771296746e2,
+	-.14294979207907956223499258e1,
+	-.834690374102384988158918e-2,
+};
+static const GENERIC qs[7] = {	/* [8 -- inf] qzero 6950 */
+	.1107975037248683865326709645e5,
+	.3544581680627082674651471873e5,
+	.3619118937918394132179019059e5,
+	.1439895563565398007471485822e5,
+	.2190277023344363955930226234e4,
+	.106695157020407986137501682e3,
+	1.0,
+};
+
+static GENERIC
+qzero(GENERIC x) {
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (-0.125/x);
+	t = eight/x; z = t*t;
+	r = qr[5]+z*qr[6];
+	s = qs[5]+z;
+	for (i = 4; i >= 0; i--) {
+	    r = r*z + qr[i];
+	    s = s*z + qs[i];
+	}
+	return (t*(r/s));
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/j1.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,352 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * floating point Bessel's function of the first and second kinds
+ * of order zero: j1(x),y1(x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ */
+
+#pragma weak j1 = __j1
+#pragma weak y1 = __y1
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "libm_protos.h"
+#include <math.h>
+#include <values.h>
+
+#define	GENERIC double
+static const GENERIC
+zero    = 0.0,
+small	= 1.0e-5,
+tiny 	= 1.0e-20,
+one	= 1.0,
+invsqrtpi = 5.641895835477562869480794515607725858441e-0001,
+tpi	= 0.636619772367581343075535053490057448;
+
+static GENERIC pone(GENERIC), qone(GENERIC);
+static const GENERIC r0[4] = {
+	-6.250000000000002203053200981413218949548e-0002,
+	1.600998455640072901321605101981501263762e-0003,
+	-1.963888815948313758552511884390162864930e-0005,
+	8.263917341093549759781339713418201620998e-0008,
+};
+static const GENERIC s0[7] = {
+	1.0e0,
+	1.605069137643004242395356851797873766927e-0002,
+	1.149454623251299996428500249509098499383e-0004,
+	3.849701673735260970379681807910852327825e-0007,
+};
+static const GENERIC r1[12] = {
+	4.999999999999999995517408894340485471724e-0001,
+	-6.003825028120475684835384519945468075423e-0002,
+	2.301719899263321828388344461995355419832e-0003,
+	-4.208494869238892934859525221654040304068e-0005,
+	4.377745135188837783031540029700282443388e-0007,
+	-2.854106755678624335145364226735677754179e-0009,
+	1.234002865443952024332943901323798413689e-0011,
+	-3.645498437039791058951273508838177134310e-0014,
+	7.404320596071797459925377103787837414422e-0017,
+	-1.009457448277522275262808398517024439084e-0019,
+	8.520158355824819796968771418801019930585e-0023,
+	-3.458159926081163274483854614601091361424e-0026,
+};
+static const GENERIC s1[5] = {
+	1.0e0,
+	4.923499437590484879081138588998986303306e-0003,
+	1.054389489212184156499666953501976688452e-0005,
+	1.180768373106166527048240364872043816050e-0008,
+	5.942665743476099355323245707680648588540e-0012,
+};
+
+GENERIC
+j1(GENERIC x) {
+	GENERIC z, d, s, c, ss, cc, r;
+	int i, sgn;
+
+	if (!finite(x))
+		return (one/x);
+	sgn = signbit(x);
+	x = fabs(x);
+	if (x > 8.00) {
+		s = sin(x);
+		c = cos(x);
+	/*
+	 * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x0)-q1(x)*sin(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 (x > 8.9e307) {	/* x+x may overflow */
+			ss = -s-c;
+			cc =  s-c;
+		} else if (signbit(s) != signbit(c)) {
+			cc = s - c;
+			ss = cos(x+x)/cc;
+		} else {
+			ss = -s-c;
+			cc = cos(x+x)/ss;
+		}
+	/*
+	 * j1(x) = 1/sqrt(pi*x) * (P(1,x)*cc - Q(1,x)*ss)
+	 * y1(x) = 1/sqrt(pi*x) * (P(1,x)*ss + Q(1,x)*cc)
+	 */
+		if (x > 1.0e40)
+		    d = (invsqrtpi*cc)/sqrt(x);
+		else
+			d =  invsqrtpi*(pone(x)*cc-qone(x)*ss)/sqrt(x);
+
+		if (x > X_TLOSS) {
+		    if (sgn != 0) { d = -d; x = -x; }
+			return (_SVID_libm_err(x, d, 36));
+		} else
+		    if (sgn == 0)
+				return (d);
+			else
+				return (-d);
+	}
+	if (x <= small) {
+		if (x <= tiny)
+			d = 0.5*x;
+		else
+			d =  x*(0.5-x*x*0.125);
+		if (sgn == 0)
+			return (d);
+		else
+			return (-d);
+	}
+	z = x*x;
+	if (x < 1.28) {
+	    r = r0[3];
+	    s = s0[3];
+	    for (i = 2; i >= 0; i--) {
+		r = r*z + r0[i];
+		s = s*z + s0[i];
+	    }
+	    d = x*0.5+x*(z*(r/s));
+	} else {
+	    r = r1[11];
+	    for (i = 10; i >= 0; i--) r = r*z + r1[i];
+	    s = s1[0]+z*(s1[1]+z*(s1[2]+z*(s1[3]+z*s1[4])));
+	    d = x*(r/s);
+	}
+	if (sgn == 0)
+		return (d);
+	else
+		return (-d);
+}
+
+static const GENERIC u0[4] = {
+	-1.960570906462389461018983259589655961560e-0001,
+	4.931824118350661953459180060007970291139e-0002,
+	-1.626975871565393656845930125424683008677e-0003,
+	1.359657517926394132692884168082224258360e-0005,
+};
+static const GENERIC v0[5] = {
+	1.0e0,
+	2.565807214838390835108224713630901653793e-0002,
+	3.374175208978404268650522752520906231508e-0004,
+	2.840368571306070719539936935220728843177e-0006,
+	1.396387402048998277638900944415752207592e-0008,
+};
+static const GENERIC u1[12] = {
+	-1.960570906462389473336339614647555351626e-0001,
+	5.336268030335074494231369159933012844735e-0002,
+	-2.684137504382748094149184541866332033280e-0003,
+	5.737671618979185736981543498580051903060e-0005,
+	-6.642696350686335339171171785557663224892e-0007,
+	4.692417922568160354012347591960362101664e-0009,
+	-2.161728635907789319335231338621412258355e-0011,
+	6.727353419738316107197644431844194668702e-0014,
+	-1.427502986803861372125234355906790573422e-0016,
+	2.020392498726806769468143219616642940371e-0019,
+	-1.761371948595104156753045457888272716340e-0022,
+	7.352828391941157905175042420249225115816e-0026,
+};
+static const GENERIC v1[5] = {
+	1.0e0,
+	5.029187436727947764916247076102283399442e-0003,
+	1.102693095808242775074856548927801750627e-0005,
+	1.268035774543174837829534603830227216291e-0008,
+	6.579416271766610825192542295821308730206e-0012,
+};
+
+
+GENERIC
+y1(GENERIC x) {
+	GENERIC z, d, s, c, ss, cc, u, v;
+	int i;
+
+	if (isnan(x))
+		return (x*x);	/* + -> * for Cheetah */
+	if (x <= zero) {
+		if (x == zero)
+		    /* return -one/zero;  */
+		    return (_SVID_libm_err(x, x, 10));
+		else
+		    /* return zero/zero; */
+		    return (_SVID_libm_err(x, x, 11));
+	}
+	if (x > 8.0) {
+		if (!finite(x))
+			return (zero);
+		s = sin(x);
+		c = cos(x);
+	/*
+	 * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x0)-q1(x)*sin(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 (x > 8.9e307) {	/* x+x may overflow */
+			ss = -s-c;
+			cc =  s-c;
+		} else if (signbit(s) != signbit(c)) {
+			cc = s - c;
+			ss = cos(x+x)/cc;
+		} else {
+			ss = -s-c;
+			cc = cos(x+x)/ss;
+		}
+	/*
+	 * j1(x) = 1/sqrt(pi*x) * (P(1,x)*cc - Q(1,x)*ss)
+	 * y1(x) = 1/sqrt(pi*x) * (P(1,x)*ss + Q(1,x)*cc)
+	 */
+		if (x > 1.0e91)
+		    d =  (invsqrtpi*ss)/sqrt(x);
+		else
+			d = invsqrtpi*(pone(x)*ss+qone(x)*cc)/sqrt(x);
+
+		if (x > X_TLOSS)
+			return (_SVID_libm_err(x, d, 37));
+		else
+			return (d);
+	}
+		if (x <= tiny) {
+			return (-tpi/x);
+		}
+	z = x*x;
+	if (x < 1.28) {
+	    u = u0[3]; v = v0[3]+z*v0[4];
+	    for (i = 2; i >= 0; i--) {
+		u = u*z + u0[i];
+		v = v*z + v0[i];
+	    }
+	} else {
+	    for (u = u1[11], i = 10; i >= 0; i--) u = u*z+u1[i];
+	    v = v1[0]+z*(v1[1]+z*(v1[2]+z*(v1[3]+z*v1[4])));
+	}
+	return (x*(u/v) + tpi*(j1(x)*log(x)-one/x));
+}
+
+static const GENERIC pr0[6] = {
+	-.4435757816794127857114720794e7,
+	-.9942246505077641195658377899e7,
+	-.6603373248364939109255245434e7,
+	-.1523529351181137383255105722e7,
+	-.1098240554345934672737413139e6,
+	-.1611616644324610116477412898e4,
+};
+static const GENERIC ps0[6] = {
+	-.4435757816794127856828016962e7,
+	-.9934124389934585658967556309e7,
+	-.6585339479723087072826915069e7,
+	-.1511809506634160881644546358e7,
+	-.1072638599110382011903063867e6,
+	-.1455009440190496182453565068e4,
+};
+static const GENERIC huge    = 1.0e10;
+
+static GENERIC
+pone(GENERIC x) {
+	GENERIC s, r, t, z;
+	int i;
+		/* assume x > 8 */
+	if (x > huge)
+		return (one);
+
+	t = 8.0/x; z = t*t;
+	r = pr0[5]; s = ps0[5]+z;
+	for (i = 4; i >= 0; i--) {
+		r = z*r + pr0[i];
+		s = z*s + ps0[i];
+	}
+	return (r/s);
+}
+
+
+static const GENERIC qr0[6] = {
+	0.3322091340985722351859704442e5,
+	0.8514516067533570196555001171e5,
+	0.6617883658127083517939992166e5,
+	0.1849426287322386679652009819e5,
+	0.1706375429020768002061283546e4,
+	0.3526513384663603218592175580e2,
+};
+static const GENERIC qs0[6] = {
+	0.7087128194102874357377502472e6,
+	0.1819458042243997298924553839e7,
+	0.1419460669603720892855755253e7,
+	0.4002944358226697511708610813e6,
+	0.3789022974577220264142952256e5,
+	0.8638367769604990967475517183e3,
+};
+
+static GENERIC
+qone(GENERIC x) {
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (0.375/x);
+
+	t = 8.0/x; z = t*t;
+		/* assume x > 8 */
+	r = qr0[5]; s = qs0[5]+z;
+	for (i = 4; i >= 0; i--) {
+		r = z*r + qr0[i];
+		s = z*s + qs0[i];
+	}
+	return (t*(r/s));
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/jn.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,306 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak jn = __jn
+#pragma weak yn = __yn
+
+/*
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n: jn(n,x),yn(n,x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero 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 "libm.h"
+#include <float.h>	/* DBL_MIN */
+#include <values.h>	/* X_TLOSS */
+#include "xpg6.h"	/* __xpg6 */
+
+#define	GENERIC double
+
+static const GENERIC
+	invsqrtpi = 5.641895835477562869480794515607725858441e-0001,
+	two	= 2.0,
+	zero	= 0.0,
+	one	= 1.0;
+
+GENERIC
+jn(int n, GENERIC x) {
+	int i, sgn;
+	GENERIC a, b, temp = 0;
+	GENERIC z, w, ox, on;
+
+	/*
+	 * J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+	 * Thus, J(-n,x) = J(n,-x)
+	 */
+	ox = x; on = (GENERIC)n;
+	if (n < 0) {
+		n = -n;
+		x = -x;
+	}
+	if (isnan(x))
+		return (x*x);	/* + -> * for Cheetah */
+	if (!((int) _lib_version == libm_ieee ||
+		(__xpg6 & _C99SUSv3_math_errexcept) != 0)) {
+	    if (fabs(x) > X_TLOSS)
+			return (_SVID_libm_err(on, ox, 38));
+	}
+	if (n == 0)
+		return (j0(x));
+	if (n == 1)
+		return (j1(x));
+	if ((n&1) == 0)
+		sgn = 0; 			/* even n */
+	else
+		sgn = signbit(x);	/* old n  */
+	x = fabs(x);
+	if (x == zero||!finite(x)) b = zero;
+	else if ((GENERIC)n <= x) {
+					/*
+					 * Safe to use
+					 *  J(n+1,x)=2n/x *J(n,x)-J(n-1,x)
+					 */
+	    if (x > 1.0e91) {
+				/*
+				 * 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
+				 */
+		switch (n&3) {
+		    case 0: temp =  cos(x)+sin(x); break;
+		    case 1: temp = -cos(x)+sin(x); break;
+		    case 2: temp = -cos(x)-sin(x); break;
+		    case 3: temp =  cos(x)-sin(x); break;
+		}
+		b = invsqrtpi*temp/sqrt(x);
+	    } else {
+			a = j0(x);
+			b = j1(x);
+			for (i = 1; i < n; i++) {
+		    temp = b;
+		    b = b*((GENERIC)(i+i)/x) - a; /* avoid underflow */
+		    a = temp;
+			}
+	    }
+	} else {
+	    if (x < 1e-9) {	/* use J(n,x) = 1/n!*(x/2)^n */
+		b = pow(0.5*x, (GENERIC) n);
+		if (b != zero) {
+		    for (a = one, i = 1; i <= n; i++) a *= (GENERIC)i;
+		    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 quaduple
+		 */
+	    /* determin k */
+		GENERIC t, v;
+		double q0, q1, h, tmp; int k, m;
+		w  = (n+n)/(double)x; h = 2.0/(double)x;
+		q0 = w;  z = w + h; q1 = w*z - 1.0; k = 1;
+		while (q1 < 1.0e9) {
+			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*log(fabs(v*tmp));
+		if (tmp < 7.09782712893383973096e+02) {
+			    for (i = n-1; i > 0; i--) {
+				temp = b;
+				b = ((i+i)/x)*b - a;
+			    a = temp;
+				}
+		} else {
+				for (i = n-1; i > 0; i--) {
+				    temp = b;
+				    b = ((i+i)/x)*b - a;
+				    a = temp;
+					if (b > 1e100) {
+						a /= b;
+						t /= b;
+						b  = 1.0;
+					}
+				}
+		}
+			b = (t*j0(x)/b);
+	    }
+	}
+	if (sgn == 1)
+		return (-b);
+	else
+		return (b);
+}
+
+GENERIC
+yn(int n, GENERIC x) {
+	int i;
+	int sign;
+	GENERIC a, b, temp = 0, ox, on;
+
+	ox = x; on = (GENERIC)n;
+	if (isnan(x))
+		return (x*x);	/* + -> * for Cheetah */
+	if (x <= zero) {
+		if (x == zero) {
+			/* return -one/zero; */
+			return (_SVID_libm_err((GENERIC)n, x, 12));
+		} else {
+			/* return zero/zero; */
+			return (_SVID_libm_err((GENERIC)n, x, 13));
+		}
+	}
+	if (!((int) _lib_version == libm_ieee ||
+		(__xpg6 & _C99SUSv3_math_errexcept) != 0)) {
+	    if (x > X_TLOSS)
+			return (_SVID_libm_err(on, ox, 39));
+	}
+	sign = 1;
+	if (n < 0) {
+		n = -n;
+		if ((n&1) == 1) sign = -1;
+	}
+	if (n == 0)
+		return (y0(x));
+	if (n == 1)
+		return (sign*y1(x));
+	if (!finite(x))
+		return (zero);
+
+	if (x > 1.0e91) {
+				/*
+				 * 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
+				 */
+		switch (n&3) {
+		    case 0: temp =  sin(x)-cos(x); break;
+		    case 1: temp = -sin(x)-cos(x); break;
+		    case 2: temp = -sin(x)+cos(x); break;
+		    case 3: temp =  sin(x)+cos(x); break;
+		}
+		b = invsqrtpi*temp/sqrt(x);
+	} else {
+		a = y0(x);
+		b = y1(x);
+		/*
+		 * fix 1262058 and take care of non-default rounding
+		 */
+		for (i = 1; i < n; i++) {
+			temp = b;
+			b *= (GENERIC) (i + i) / x;
+			if (b <= -DBL_MAX)
+				break;
+			b -= a;
+			a = temp;
+		}
+	}
+	if (sign > 0)
+		return (b);
+	else
+		return (-b);
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/matherr.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak matherr = __matherr
+
+#include "libm.h"
+
+/* ARGSUSED0 */
+int
+__matherr(struct exception *x) {
+	return (0);
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/sinh.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,79 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak sinh = __sinh
+
+/* INDENT OFF */
+/*
+ * sinh(x)
+ * Code originated from 4.3bsd.
+ * Modified by K.C. Ng for SUN 4.0 libm.
+ * Method :
+ *	1. reduce x to non-negative by sinh(-x) = - sinh(x).
+ *	2.
+ *
+ *                                   expm1(x) + expm1(x)/(expm1(x)+1)
+ *   0 <= x <= lnovft   : sinh(x) := --------------------------------
+ *								       2
+ *  lnovft <= x <  INF  : sinh(x) := exp(x-1024*ln2)*2**1023
+ *
+ *
+ * Special cases:
+ *	sinh(x) is x if x is +INF, -INF, or NaN.
+ *	only sinh(0)=0 is exact for finite argument.
+ *
+ */
+/* INDENT ON */
+
+#include "libm.h"
+
+static const double
+	ln2hi = 6.93147180369123816490e-01,
+	ln2lo = 1.90821492927058770002e-10,
+	lnovft = 7.09782712893383973096e+02;
+
+double
+sinh(double x) {
+	double	ox, r, t;
+
+	ox = x;
+	r = fabs(x);
+	if (!finite(x))
+		return (x * r);
+	if (r < lnovft) {
+		t = expm1(r);
+		r = copysign((t + t / (1.0 + t)) * 0.5, x);
+	} else {
+		if (r < 1000.0)
+			x = copysign(exp((r - 1024 * ln2hi) - 1024 * ln2lo), x);
+		r = scalbn(x, 1023);
+	}
+	if (!finite(r))
+		r = _SVID_libm_err(ox, ox, 25);
+	return (r);
+}
--- /dev/null	Thu Oct  9 19:48:53 2014
+++ new/usr/src/lib/libm/common/C/tanh.c	Thu Oct  9 19:48:53 2014
@@ -0,0 +1,101 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma weak tanh = __tanh
+
+/* INDENT OFF */
+/*
+ * TANH(X)
+ * RETURN THE HYPERBOLIC TANGENT OF X
+ * code based on 4.3bsd
+ * Modified by K.C. Ng for sun 4.0, Jan 31, 1987
+ *
+ * Method :
+ *	1. reduce x to non-negative by tanh(-x) = - tanh(x).
+ *	2.
+ *	    0      <  x <=  1.e-10 :  tanh(x) := x
+ *					          -expm1(-2x)
+ *	    1.e-10 <  x <=  1      :  tanh(x) := --------------
+ *					         expm1(-2x) + 2
+ *							  2
+ *	    1      <= x <=  22.0   :  tanh(x) := 1 -  ---------------
+ *						      expm1(2x) + 2
+ *	    22.0   <  x <= INF     :  tanh(x) := 1.
+ *
+ *	Note: 22 was chosen so that fl(1.0+2/(expm1(2*22)+2)) == 1.
+ *
+ * Special cases:
+ *	tanh(NaN) is NaN;
+ *	only tanh(0)=0 is exact for finite argument.
+ */
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "libm_protos.h"
+#include <math.h>
+
+static const double
+	one = 1.0,
+	two = 2.0,
+	small = 1.0e-10,
+	big = 1.0e10;
+/* INDENT ON */
+
+double
+tanh(double x) {
+	double t, y, z;
+	int signx;
+	volatile double dummy;
+
+	if (isnan(x))
+		return (x * x);	/* + -> * for Cheetah */
+	signx = signbit(x);
+	t = fabs(x);
+	z = one;
+	if (t <= 22.0) {
+		if (t > one)
+			z = one - two / (expm1(t + t) + two);
+		else if (t > small) {
+			y = expm1(-t - t);
+			z = -y / (y + two);
+		} else {
+			/* raise the INEXACT flag for non-zero t */
+			dummy = t + big;
+#ifdef lint
+			dummy = dummy;
+#endif
+			return (x);
+		}
+	} else if (!finite(t))
+		return (copysign(1.0, x));
+	else
+		return (signx == 1 ? -z + small * small : z - small * small);
+
+	return (signx == 1 ? -z : z);
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/__lgammal.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,402 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * long double __k_lgammal(long double x, int *signgamlp);
+ * K.C. Ng, August, 1989.
+ *
+ * We choose [1.5,2.5] to be the primary interval. Our algorithms
+ * are mainly derived from
+ *
+ *
+ *                             zeta(2)-1    2    zeta(3)-1    3
+ * lgamma(2+s) = s*(1-euler) + --------- * s  -  --------- * s  + ...
+ *                                 2                 3
+ *
+ *
+ * Note 1. Since gamma(1+s)=s*gamma(s), hence
+ *		lgamma(1+s) = log(s) + lgamma(s), or
+ *		lgamma(s) = lgamma(1+s) - log(s).
+ *	   When s is really tiny (like roundoff), lgamma(1+s) ~ s(1-enler)
+ *	   Hence lgamma(s) ~ -log(s) for tiny s
+ *
+ */
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "longdouble.h"
+
+static long double neg(long double, int *);
+static long double poly(long double, const long double *, int);
+static long double polytail(long double);
+static long double primary(long double);
+
+static const long double
+c0 =	 0.0L,
+ch =	 0.5L,
+c1 =	 1.0L,
+c2 =	 2.0L,
+c3 =	 3.0L,
+c4 =	 4.0L,
+c5 =	 5.0L,
+c6 =	 6.0L,
+pi =	 3.1415926535897932384626433832795028841971L,
+tiny =   1.0e-40L;
+
+long double
+__k_lgammal(long double x, int *signgamlp) {
+	long double t, y;
+	int i;
+
+	/* purge off +-inf, NaN and negative arguments */
+	if (!finitel(x))
+		return (x*x);
+	*signgamlp = 1;
+	if (signbitl(x))
+		return (neg(x, signgamlp));
+
+	/* for x < 8.0 */
+	if (x < 8.0L) {
+	    y = anintl(x);
+	    i = (int) y;
+	    switch (i) {
+	    case 0:
+		if (x < 1.0e-40L)
+			return (-logl(x));
+		else
+			return (primary(x)-log1pl(x))-logl(x);
+	    case 1:
+		return (primary(x-y)-logl(x));
+	    case 2:
+		return (primary(x-y));
+	    case 3:
+		return (primary(x-y)+logl(x-c1));
+	    case 4:
+		return (primary(x-y)+logl((x-c1)*(x-c2)));
+	    case 5:
+		return (primary(x-y)+logl((x-c1)*(x-c2)*(x-c3)));
+	    case 6:
+		return (primary(x-y)+logl((x-c1)*(x-c2)*(x-c3)*(x-c4)));
+	    case 7:
+		return (primary(x-y)+logl((x-c1)*(x-c2)*(x-c3)*(x-c4)*(x-c5)));
+	    case 8:
+		return primary(x-y)+
+			logl((x-c1)*(x-c2)*(x-c3)*(x-c4)*(x-c5)*(x-c6));
+	    }
+	}
+
+	/* 8.0 <= x < 1.0e40 */
+	if (x < 1.0e40L) {
+	    t = logl(x);
+	    return (x*(t-c1)-(ch*t-polytail(c1/x)));
+	}
+
+	/* 1.0e40 <= x <= inf */
+	return (x*(logl(x)-c1));
+}
+
+static const long double an1[] = {		/* 20 terms */
+	-0.0772156649015328606065120900824024309741L,
+	3.224670334241132182362075833230130289059e-0001L,
+	-6.735230105319809513324605383668929964120e-0002L,
+	2.058080842778454787900092432928910226297e-0002L,
+	-7.385551028673985266273054086081102125704e-0003L,
+	2.890510330741523285758867304409628648727e-0003L,
+	-1.192753911703260976581414338096267498555e-0003L,
+	5.096695247430424562831956662855697824035e-0004L,
+	-2.231547584535777978926798502084300123638e-0004L,
+	9.945751278186384670278268034322157947635e-0005L,
+	-4.492623673665547726647838474125147631082e-0005L,
+	2.050721280617796810096993154281561168706e-0005L,
+	-9.439487785617396552092393234044767313568e-0006L,
+	4.374872903516051510689234173139793159340e-0006L,
+	-2.039156676413643091040459825776029327487e-0006L,
+	9.555777181318621470466563543806211523634e-0007L,
+	-4.468344919709630637558538313482398989638e-0007L,
+	2.216738086090045781773004477831059444178e-0007L,
+	-7.472783403418388455860445842543843485916e-0008L,
+	8.777317930927149922056782132706238921648e-0008L,
+};
+
+static const long double an2[] = {		/* 20 terms */
+  -.0772156649015328606062692723698127607018L,
+   3.224670334241132182635552349060279118047e-0001L,
+  -6.735230105319809367555642883133994818325e-0002L,
+   2.058080842778459676880822202762143671813e-0002L,
+  -7.385551028672828216011343150077846918930e-0003L,
+   2.890510330762060607399561536905727853178e-0003L,
+  -1.192753911419623262328187532759756368041e-0003L,
+   5.096695278636456678258091134532258618614e-0004L,
+  -2.231547306817535743052975194022893369135e-0004L,
+   9.945771461633313282744264853986643877087e-0005L,
+  -4.492503279458972037926876061257489481619e-0005L,
+   2.051311416812082875492678651369394595613e-0005L,
+  -9.415778282365955203915850761537462941165e-0006L,
+   4.452428829045147098722932981088650055919e-0006L,
+  -1.835024727987632579886951760650722695781e-0006L,
+   1.379783080658545009579060714946381462565e-0006L,
+   2.282637532109775156769736768748402175238e-0007L,
+   1.002577375515900191362119718128149880168e-0006L,
+   5.177028794262638311939991106423220002463e-0007L,
+   3.127947245174847104122426445937830555755e-0007L,
+};
+
+static const long double an3[] = {		/* 20 terms */
+  -.0772156649015328227870646417729220690875L,
+   3.224670334241156699881788955959915250365e-0001L,
+  -6.735230105312273571375431059744975563170e-0002L,
+   2.058080842924464587662846071337083809005e-0002L,
+  -7.385551008677271654723604653956131791619e-0003L,
+   2.890510536479782086197110272583833176602e-0003L,
+  -1.192752262076857692740571567808259138697e-0003L,
+   5.096800771149805289371135155128380707889e-0004L,
+  -2.231000836682831335505058492409860123647e-0004L,
+   9.968912171073936803871803966360595275047e-0005L,
+  -4.412020779327746243544387946167256187258e-0005L,
+   2.281374113541454151067016632998630209049e-0005L,
+  -4.028361291428629491824694655287954266830e-0006L,
+   1.470694920619518924598956849226530750139e-0005L,
+   1.381686137617987197975289545582377713772e-0005L,
+   2.012493539265777728944759982054970441601e-0005L,
+   1.723917864208965490251560644681933675799e-0005L,
+   1.202954035243788300138608765425123713395e-0005L,
+   5.079851887558623092776296577030850938146e-0006L,
+   1.220657945824153751555138592006604026282e-0006L,
+};
+
+static const long double an4[] = {		/* 21 terms */
+  -.0772156649015732285350261816697540392371L,
+   3.224670334221752060691751340365212226097e-0001L,
+  -6.735230109744009693977755991488196368279e-0002L,
+   2.058080778913037626909954141611580783216e-0002L,
+  -7.385557567931505621170483708950557506819e-0003L,
+   2.890459838416254326340844289785254883436e-0003L,
+  -1.193059036207136762877351596966718455737e-0003L,
+   5.081914708100372836613371356529568937869e-0004L,
+  -2.289855016133600313131553005982542045338e-0004L,
+   8.053454537980585879620331053833498511491e-0005L,
+  -9.574620532104845821243493405855672438998e-0005L,
+  -9.269085628207107155601445001196317715686e-0005L,
+  -2.183276779859490461716196344776208220180e-0004L,
+  -3.134834305597571096452454999737269668868e-0004L,
+  -3.973878894951937437018305986901392888619e-0004L,
+  -3.953352414899222799161275564386488057119e-0004L,
+  -3.136740932204038779362660900621212816511e-0004L,
+  -1.884502253819634073946130825196078627664e-0004L,
+  -8.192655799958926853585332542123631379301e-0005L,
+  -2.292183750010571062891605074281744854436e-0005L,
+  -3.223980628729716864927724265781406614294e-0006L,
+};
+
+static const long double ap1[] = {			/* 19 terms */
+  -0.0772156649015328606065120900824024296961L,
+   3.224670334241132182362075833230047956465e-0001L,
+  -6.735230105319809513324605382963943777301e-0002L,
+   2.058080842778454787900092126606252375465e-0002L,
+  -7.385551028673985266272518231365020063941e-0003L,
+   2.890510330741523285681704570797770736423e-0003L,
+  -1.192753911703260971285304221165990244515e-0003L,
+   5.096695247430420878696018188830886972245e-0004L,
+  -2.231547584535654004647639737841526025095e-0004L,
+   9.945751278137201960636098805852315982919e-0005L,
+  -4.492623672777606053587919463929044226280e-0005L,
+   2.050721258703289487603702670753053765201e-0005L,
+  -9.439485626565616989352750672499008021041e-0006L,
+   4.374838162403994645138200419356844574219e-0006L,
+  -2.038979492862555348577006944451002161496e-0006L,
+   9.536763152382263548086981191378885102802e-0007L,
+  -4.426111214332434049863595231916564014913e-0007L,
+   1.911148847512947464234633846270287546882e-0007L,
+  -5.788673944861923038157839080272303519671e-0008L,
+};
+
+static const long double ap2[] = {			/* 19 terms */
+  -0.077215664901532860606428624449354836087L,
+   3.224670334241132182271948744265855440139e-0001L,
+  -6.735230105319809467356126599005051676203e-0002L,
+   2.058080842778453315716389815213496002588e-0002L,
+  -7.385551028673653323064118422580096222959e-0003L,
+   2.890510330735923572088003424849289006039e-0003L,
+  -1.192753911629952368606185543945790688144e-0003L,
+   5.096695239806718875364547587043220998766e-0004L,
+  -2.231547520600616108991867127392089144886e-0004L,
+   9.945746913898151120612322833059416008973e-0005L,
+  -4.492599307461977003570224943054585729684e-0005L,
+   2.050609891889165453592046505651759999090e-0005L,
+  -9.435329866734193796540515247917165988579e-0006L,
+   4.362267138522223236241016136585565144581e-0006L,
+  -2.008556356653246579300491601497510230557e-0006L,
+   8.961498103387207161105347118042844354395e-0007L,
+  -3.614187228330216282235692806488341157741e-0007L,
+   1.136978988247816860500420915014777753153e-0007L,
+  -2.000532786387196664019286514899782691776e-0008L,
+};
+
+static const long double ap3[] = {			/* 19 terms */
+  -0.077215664901532859888521470795348856446L,
+   3.224670334241131733364048614484228443077e-0001L,
+  -6.735230105319676541660495145259038151576e-0002L,
+   2.058080842775975461837768839015444273830e-0002L,
+  -7.385551028347615729728618066663566606906e-0003L,
+   2.890510327517954083379032008643080256676e-0003L,
+  -1.192753886919470728001821137439430882603e-0003L,
+   5.096693728898932234814903769146577482912e-0004L,
+  -2.231540055048827662528594010961874258037e-0004L,
+   9.945446210018649311491619999438833843723e-0005L,
+  -4.491608206598064519190236245753867697750e-0005L,
+   2.047939071322271016498065052853746466669e-0005L,
+  -9.376824046522786006677541036631536790762e-0006L,
+   4.259329829498149111582277209189150127347e-0006L,
+  -1.866064770421594266702176289764212873428e-0006L,
+   7.462066721137579592928128104534957135669e-0007L,
+  -2.483546217529077735074007138457678727371e-0007L,
+   5.915166576378161473299324673649144297574e-0008L,
+  -7.334139641706988966966252333759604701905e-0009L,
+};
+
+static const long double ap4[] = {			/* 19 terms */
+  -0.0772156649015326785569313252637238673675L,
+   3.224670334241051435008842685722468344822e-0001L,
+  -6.735230105302832007479431772160948499254e-0002L,
+   2.058080842553481183648529360967441889912e-0002L,
+  -7.385551007602909242024706804659879199244e-0003L,
+   2.890510182473907253939821312248303471206e-0003L,
+  -1.192753098427856770847894497586825614450e-0003L,
+   5.096659636418811568063339214203693550804e-0004L,
+  -2.231421144004355691166194259675004483639e-0004L,
+   9.942073842343832132754332881883387625136e-0005L,
+  -4.483809261973204531263252655050701205397e-0005L,
+   2.033260142610284888319116654931994447173e-0005L,
+  -9.153539544026646699870528191410440585796e-0006L,
+   3.988460469925482725894144688699584997971e-0006L,
+  -1.609692980087029172567957221850825977621e-0006L,
+   5.634916377249975825399706694496688803488e-0007L,
+  -1.560065465929518563549083208482591437696e-0007L,
+   2.961350193868935325526962209019387821584e-0008L,
+  -2.834602215195368130104649234505033159842e-0009L,
+};
+
+static long double
+primary(long double s) {	/* assume |s|<=0.5 */
+	int i;
+
+	i = (int) (8.0L * (s + 0.5L));
+	switch (i) {
+	case 0:	return ch*s+s*poly(s, an4, 21);
+	case 1:	return ch*s+s*poly(s, an3, 20);
+	case 2:	return ch*s+s*poly(s, an2, 20);
+	case 3:	return ch*s+s*poly(s, an1, 20);
+	case 4:	return ch*s+s*poly(s, ap1, 19);
+	case 5:	return ch*s+s*poly(s, ap2, 19);
+	case 6:	return ch*s+s*poly(s, ap3, 19);
+	case 7:	return ch*s+s*poly(s, ap4, 19);
+	}
+	/* NOTREACHED */
+    return (0.0L);
+}
+
+static long double
+poly(long double s, const long double *p, int n) {
+	long double y;
+	int i;
+	y = p[n-1];
+	for (i = n-2; i >= 0; i--) y = p[i]+s*y;
+	return (y);
+}
+
+static const long double pt[] = {
+   9.189385332046727417803297364056176804663e-0001L,
+   8.333333333333333333333333333331286969123e-0002L,
+  -2.777777777777777777777777553194796036402e-0003L,
+   7.936507936507936507927283071433584248176e-0004L,
+  -5.952380952380952362351042163192634108297e-0004L,
+   8.417508417508395661774286645578379460131e-0004L,
+  -1.917526917525263651186066417934685675649e-0003L,
+   6.410256409395203164659292973142293199083e-0003L,
+  -2.955065327248303301763594514012418438188e-0002L,
+   1.796442830099067542945998615411893822886e-0001L,
+  -1.392413465829723742489974310411118662919e+0000L,
+   1.339984238037267658352656597960492029261e+0001L,
+  -1.564707657605373662425785904278645727813e+0002L,
+   2.156323807499211356127813962223067079300e+0003L,
+  -3.330486427626223184647299834137041307569e+0004L,
+   5.235535072011889213611369254140123518699e+0005L,
+  -7.258160984602220710491988573430212593080e+0006L,
+   7.316526934569686459641438882340322673357e+0007L,
+  -3.806450279064900548836571789284896711473e+0008L,
+};
+
+static long double
+polytail(long double s) {
+	long double t, z;
+	int i;
+	z = s*s;
+	t = pt[18];
+	for (i = 17; i >= 1; i--) t = pt[i]+z*t;
+	return (pt[0]+s*t);
+}
+
+static long double
+neg(long double z, int *signgamlp) {
+	long double t, p;
+
+	/*
+	 * written by K.C. Ng,  Feb 2, 1989.
+	 *
+	 * Since
+	 *		-z*G(-z)*G(z) = pi/sin(pi*z),
+	 * we have
+	 * 	G(-z) = -pi/(sin(pi*z)*G(z)*z)
+	 *		  =  pi/(sin(pi*(-z))*G(z)*z)
+	 * Algorithm
+	 *		z = |z|
+	 *		t = sinpi(z); ...note that when z>2**112, z is an int
+	 *		and hence t=0.
+	 *
+	 *		if(t==0.0) return 1.0/0.0;
+	 *		if(t< 0.0) *signgamlp = -1; else t= -t;
+	 *		if(z<1.0e-40)	...tiny z
+	 *		    return -log(z);
+	 *		else
+	 *		    return log(pi/(t*z))-lgamma(z);
+	 *
+	 */
+
+	t = sinpil(z);			/* t := sin(pi*z) */
+	if (t == c0)  			/* return   1.0/0.0 =  +INF */
+	    return (c1/c0);
+
+	z = -z;
+	if (z <= tiny)
+	    p = -logl(z);
+	else
+		p = logl(pi/(fabsl(t)*z)) - __k_lgammal(z, signgamlp);
+	if (t < c0) *signgamlp = -1;
+	return (p);
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/asinhl.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#if defined(ELFOBJ)
+#pragma weak asinhl = __asinhl
+#endif
+
+#include "libm.h"
+
+static const long double
+	ln2	= 6.931471805599453094172321214581765680755e-0001L,
+	one	= 1.0L,
+	big	= 1.0e+20L,
+	tiny	= 1.0e-20L;
+
+long double
+asinhl(long double x) {
+	long double t, w;
+#ifndef lint
+	volatile long double dummy;
+#endif
+
+	w = fabsl(x);
+	if (isnanl(x))
+		return (x + x);	/* x is NaN */
+	if (w < tiny) {
+#ifndef lint
+		dummy = x + big;	/* inexact if x != 0 */
+#endif
+		return (x);	/* tiny x */
+	} else if (w < big) {
+		t = one / w;
+		return (copysignl(log1pl(w + w / (t + sqrtl(one + t * t))), x));
+	} else
+		return (copysignl(logl(w) + ln2, x));
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/j0l.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,749 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Floating point Bessel's function of the first and second kinds
+ * of order zero: j0(x),y0(x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ */
+
+#pragma weak j0l = __j0l
+#pragma weak y0l = __y0l
+
+#include "libm.h"
+#include "libm_synonyms.h"
+
+#include "longdouble.h"
+
+#include <math.h>
+#if defined(__SUNPRO_C)
+#include <sunmath.h>
+#endif
+
+#define	GENERIC long double
+static GENERIC
+zero    = 0.0L,
+small	= 1.0e-9L,
+tiny	= 1.0e-38L,
+one	= 1.0L,
+five	= 5.0L,
+eight   = 8.0L,
+invsqrtpi = 5.641895835477562869480794515607725858441e-0001L,
+tpi	= 0.636619772367581343075535053490057448L;
+
+static GENERIC pzero(), qzero();
+static GENERIC r0[7] = {
+  -2.499999999999999999999999999999998934492e-0001L,
+   1.272657927360049786327618451133763714880e-0002L,
+  -2.694499763712963276900636693400659600898e-0004L,
+   2.724877475058977576903234070919616447883e-0006L,
+  -1.432617103214330236967477495393076320281e-0008L,
+   3.823248804080079168706683540513792224471e-0011L,
+  -4.183174277567983647337568504286313665065e-0014L,
+};
+static GENERIC s0[7] = {
+   1.0e0L,
+   1.159368290559800854689526195462884666395e-0002L,
+   6.629397597394973383009743876169946772559e-0005L,
+   2.426779981394054406305431142501735094340e-0007L,
+   6.097663491248511069094400469635449749883e-0010L,
+   1.017019133340929220238747413216052224036e-0012L,
+   9.012593179306197579518374581969371278481e-0016L,
+};
+
+GENERIC
+j0l(x) GENERIC x; {
+	GENERIC z, s, c, ss, cc, r, u, v;
+	int i;
+
+	if (isnanl(x))
+		return (x+x);
+	x = fabsl(x);
+	if (x > 1.28L) {
+		if (!finitel(x))
+			return (zero);
+		s = sinl(x);
+		c = cosl(x);
+	/*
+	 * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+	 * where x0 = x-pi/4
+	 * 	Better formula:
+	 *		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.
+	 */
+		if (x > 1.0e2450L) {	/* x+x may overflow */
+			ss = s-c;
+			cc = s+c;
+		} else if (signbitl(s) != signbitl(c)) {
+			ss = s - c;
+			cc = -cosl(x+x)/ss;
+		} else {
+			cc = s + c;
+			ss = -cosl(x+x)/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 (x > 1.0e120L)
+			return (invsqrtpi*cc)/sqrtl(x);
+		u = pzero(x); v = qzero(x);
+		return (invsqrtpi*(u*cc-v*ss)/sqrtl(x));
+	}
+	if (x <= small) {
+	    if (x <= tiny)
+			return (one-x);
+	    else
+			return (one-x*x*0.25L);
+	}
+	z = x*x;
+	r = r0[6]; s = s0[6];
+	for (i = 5; i >= 0; i--) {
+	    r = r*z + r0[i];
+	    s = s*z + s0[i];
+	}
+	return (one+z*(r/s));
+}
+
+static GENERIC u0[8] = {
+  -7.380429510868722527434392794848301631220e-0002L,
+   1.766855559625940791857536949301981816513e-0001L,
+  -1.386470722701047923235553251240162839408e-0002L,
+   3.520149242724811578636970811631224862615e-0004L,
+  -3.978599663243790049853642275624951870025e-0006L,
+   2.228801153263957224547222556806915479763e-0008L,
+  -6.121246764298785018658597179498837316177e-0011L,
+   6.677103629722678833475965810525587396596e-0014L,
+};
+static GENERIC v0[8] = {
+   1.0e0L,
+   1.247164416539111311571676766127767127970e-0002L,
+   7.829144749639791500052900281489367443576e-0005L,
+   3.247126540422245330511218321013360336606e-0007L,
+   9.750516724789499678567062572549568447869e-0010L,
+   2.156713223173591212250543390258458098776e-0012L,
+   3.322169561597890004231482431236452752624e-0015L,
+   2.821213295314000924252226486305726805093e-0018L,
+};
+
+GENERIC
+y0l(x) GENERIC x; {
+	GENERIC z, d, s, c, ss, cc, u, v;
+	int i;
+
+	if (isnanl(x))
+		return (x+x);
+	if (x <= zero) {
+		if (x == zero)
+		    d = -one/(x-x);
+		else
+		    d = zero/(x-x);
+	}
+	if (x > 1.28L) {
+		if (!finitel(x))
+			return (zero);
+		s = sinl(x);
+		c = cosl(x);
+	/*
+	 * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+	 * where x0 = x-pi/4
+	 * 	Better formula:
+	 *		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.
+	 */
+		if (x > 1.0e2450L) {	/* x+x may overflow */
+			ss = s-c;
+			cc = s+c;
+		} else if (signbitl(s) != signbitl(c)) {
+			ss = s - c;
+			cc = -cosl(x+x)/ss;
+		} else {
+			cc = s + c;
+			ss = -cosl(x+x)/cc;
+		}
+	/*
+	 * j0(x) = 1/sqrt(pi*x) * (P(0,x)*cc - Q(0,x)*ss)
+	 * y0(x) = 1/sqrt(pi*x) * (P(0,x)*ss + Q(0,x)*cc)
+	 */
+		if (x > 1.0e120L)
+			return (invsqrtpi*ss)/sqrtl(x);
+		return (invsqrtpi*(pzero(x)*ss+qzero(x)*cc)/sqrtl(x));
+
+	}
+	if (x <= tiny) {
+	    return (u0[0] + tpi*logl(x));
+	}
+	z = x*x;
+	u = u0[7]; v = v0[7];
+	for (i = 6; i >= 0; i--) {
+	    u = u*z + u0[i];
+	    v = v*z + v0[i];
+	}
+	return (u/v + tpi*(j0l(x)*logl(x)));
+}
+
+static GENERIC pr0[12] = {	/* [16 -- inf] */
+   9.999999999999999999999999999999999997515e-0001L,
+   1.065981615377273376425365823967550598358e+0003L,
+   4.390991200927588978306374718984240719130e+0005L,
+   9.072086218607986711847069407339321363103e+0007L,
+   1.022552886177375367408408501046461671528e+0010L,
+   6.420766912243658241570635854089597269031e+0011L,
+   2.206451725126933913591080211081242266908e+0013L,
+   3.928369596816895077363705478743346298368e+0014L,
+   3.258159928874124597286701119721482876596e+0015L,
+   1.025715808134188978860679130140685101348e+0016L,
+   7.537170874795721255796001687024031280685e+0015L,
+  -1.579413901450157332307745586004207687796e+0014L,
+};
+static GENERIC ps0[11] = {
+   1.0e0L,
+   1.066051927877273376425365823967550512687e+0003L,
+   4.391739647168381592399173804329266353038e+0005L,
+   9.075162261801343671805658294123888867884e+0007L,
+   1.023186118519904751819581912075985995058e+0010L,
+   6.427861860414223746340515376512730275061e+0011L,
+   2.210861503237823589735481303627993406235e+0013L,
+   3.943247335784292905915956840901818177989e+0014L,
+   3.283720976777545142150200110647270004481e+0015L,
+   1.045346918812754048903645641538728986759e+0016L,
+   8.043455468065618900750599584291193680463e+0015L,
+};
+static GENERIC pr1[12] = {	/* [8 -- 16] */
+   9.999999999999999999999784422701108683618e-0001L,
+   6.796098532948334207755488692777907062894e+0002L,
+   1.840036112605722168824530758797169836042e+0005L,
+   2.598490483191916637264894340635847598122e+0007L,
+   2.105774863242707025525730249472054578523e+0009L,
+   1.015822044230542426666314997796944979959e+0011L,
+   2.931557457008110436764077699944189071875e+0012L,
+   4.962885121125457633655259224179322808824e+0013L,
+   4.705424055148223269155430598563351566279e+0014L,
+   2.294439854910747229152056080910427001110e+0015L,
+   4.905531843137486691500950019322475458629e+0015L,
+   3.187543169710339218793442542845735994565e+0015L,
+};
+static GENERIC ps1[14] = {
+   1.0e0L,
+   6.796801657948334207754571576066758180288e+0002L,
+   1.840512891201300567325421059826676366447e+0005L,
+   2.599777028312918975306252167127695075221e+0007L,
+   2.107582572771047636846811284634244892537e+0009L,
+   1.017275794694156108975782763889979940348e+0011L,
+   2.938487645192463845428059755454762316011e+0012L,
+   4.982512164735557054521042916182317924466e+0013L,
+   4.737639900153703274792677468264564361437e+0014L,
+   2.323398719123742743524249528275097100646e+0015L,
+   5.033419107069210577868909797896984419391e+0015L,
+   3.409036105931068609601317076759804716059e+0015L,
+   7.505655364352679737585745147753521662166e+0013L,
+  -9.976837153983688250780198248297109118313e+0012L,
+};
+static GENERIC pr2[12] = {	/* [5 -- 8 ] */
+   9.999999999999999937857236789277366320220e-0001L,
+   3.692848765268649571651602420376358849214e+0002L,
+   5.373022067535476576926715900057760985410e+0004L,
+   4.038738891191314969971504035057219430725e+0006L,
+   1.728285706306940523397385566659762646999e+0008L,
+   4.375400819645889911158688737206054788534e+0009L,
+   6.598950418204912408375591217782088567076e+0010L,
+   5.827182039183238492480275401520072793783e+0011L,
+   2.884222642913492390887572414999490975844e+0012L,
+   7.373278873797767721932837830628688632775e+0012L,
+   8.338295457568973761205077964397969230489e+0012L,
+   2.911383183467288345772308817209806922143e+0012L,
+};
+static GENERIC ps2[14] = {
+   1.0e0L,
+   3.693551890268649477288896267171993213102e+0002L,
+   5.375607880998361502474715133828068514297e+0004L,
+   4.042477764024108249744998862572786367328e+0006L,
+   1.731069838737016956685839588670132939513e+0008L,
+   4.387147674049898778738226585935491417728e+0009L,
+   6.628058659620653765349556940567715258165e+0010L,
+   5.869659904164177740471685856367322160664e+0011L,
+   2.919839445622817017058977559638969436383e+0012L,
+   7.535314897696671402628203718612309253907e+0012L,
+   8.696355561452933775773309859748610658935e+0012L,
+   3.216155103141537221173601557697083216257e+0012L,
+   4.756857081068942248246880159213789086363e+0010L,
+  -3.496356619666608032231074866481472824067e+0009L,
+};
+static GENERIC pr3[13] = {	/* [3.5 -- 5 ] */
+   9.999999999999916693107285612398196588247e-0001L,
+   2.263975921282917721194425320484974336945e+0002L,
+   1.994358386744245848889492762781484199966e+0004L,
+   8.980067458430542243559962493831661323168e+0005L,
+   2.282213787521372663705567756420087553508e+0007L,
+   3.409784374889063618250288699908375135923e+0008L,
+   3.024380857401448589254343517589811711108e+0009L,
+   1.571110368046740246895071721443082286379e+0010L,
+   4.603187020243604632153685300463160593768e+0010L,
+   7.087196453409712719449549280664058793403e+0010L,
+   5.046196021776346356803687409644239065041e+0010L,
+   1.287758439080165765709154276618854799932e+0010L,
+   5.900679773415023433787846658096813590784e+0008L,
+};
+static GENERIC ps3[13] = {
+   1.0e0L,
+   2.264679046282855061328604619231774747116e+0002L,
+   1.995939523988944553755653255389812103448e+0004L,
+   8.993853144706348727038389967490183236820e+0005L,
+   2.288326099634588843906989983704795468773e+0007L,
+   3.424967100255240885169240956804790118282e+0008L,
+   3.046311797972463991368023759640028910016e+0009L,
+   1.589614961932826812790222479700797224003e+0010L,
+   4.692406624527744816497089139325073939927e+0010L,
+   7.320486495902008912866462849073108323948e+0010L,
+   5.345945972828978289935309597742981360994e+0010L,
+   1.444033091910423754121309915092247171008e+0010L,
+   7.987714685115314668378957273824383610525e+0008L,
+};
+static GENERIC pr4[13] = {	/* [2.5 , 3.5] */
+   9.999999999986736677961118722747757712260e-0001L,
+   1.453824980703800559037873123568378845663e+0002L,
+   8.097327216430682288267610447006508661032e+0003L,
+   2.273847252038264370231169686380192662135e+0005L,
+   3.561056728046211111354759998976985449622e+0006L,
+   3.244933588800096378434627029369680378599e+0007L,
+   1.740112392860717950376210038908476792588e+0008L,
+   5.426170187455893285197878563881579269524e+0008L,
+   9.490107486454362321004377336020526281371e+0008L,
+   8.688872439428470049801714121070005313806e+0008L,
+   3.673315853166437222811910656900123215515e+0008L,
+   5.577770470359303305164877446339693270239e+0007L,
+   1.540438642031689641308197880181291865714e+0006L,
+};
+static GENERIC ps4[13] = {	/* [2.5 , 3.5] */
+   1.0e0L,
+   1.454528105698159439773035951959131799816e+0002L,
+   8.107442215200392397172179900434987859618e+0003L,
+   2.279390393778242887574177096606328994140e+0005L,
+   3.576251625592252008424781111770934135844e+0006L,
+   3.267909499056932631405942058670933813863e+0007L,
+   1.760021515330805537499778238099704648805e+0008L,
+   5.525553787667353981242060222587465726729e+0008L,
+   9.769870295912820457889384082671269328511e+0008L,
+   9.110582071004774279226905629624018008454e+0008L,
+   3.981857678621955599371967680343918454345e+0008L,
+   6.482404686230769399073192961667697036706e+0007L,
+   2.210046943095878402443535460329391782298e+0006L,
+};
+static GENERIC pr5[13] = {	/* [1.777..., 2.5] */
+   9.999999999114986107951817871144655880699e-0001L,
+   9.252583736048588342568344570315435947614e+0001L,
+   3.218726757856078715214631502407386264637e+0003L,
+   5.554009964621111656479588505862577040831e+0004L,
+   5.269993115643664338253196944523510290175e+0005L,
+   2.874613773778430691192912190618220544575e+0006L,
+   9.133538151103658353874146919613442436035e+0006L,
+   1.673067041410338922825193013077354249193e+0007L,
+   1.706913873848398011744790289200151840498e+0007L,
+   9.067766583853288534551600235576747618679e+0006L,
+   2.216746733457884568532695355036338655872e+0006L,
+   1.945753880802872541235703812722344514405e+0005L,
+   3.132374412921948071539195638885330951749e+0003L,
+};
+static GENERIC ps5[13] = {	/* [1.777..., 2.5] */
+   1.0e0L,
+   9.259614983862181118883831670990340052982e+0001L,
+   3.225125275462903384842124075132609290304e+0003L,
+   5.575705362829101545292760055941855246492e+0004L,
+   5.306049863037087855496170121958448492522e+0005L,
+   2.907060758873509564309729903109018597215e+0006L,
+   9.298059206584995898298257827131208539289e+0006L,
+   1.720391071006963176836108026556547062980e+0007L,
+   1.782614812922865190479394509487941920612e+0007L,
+   9.708016389605273153536452032839879950155e+0006L,
+   2.476495084688170096480215640962175140027e+0006L,
+   2.363200660365585759668077790194604917187e+0005L,
+   4.803239569848196077121203575704356936731e+0003L,
+};
+static GENERIC pr6[13] = {	/* [1.28, 1.777...] */
+   9.999999969777095495998606925524322559556e-0001L,
+   5.825486719466194430503283824096872219216e+0001L,
+   1.248155491637757281915184824965379905380e+0003L,
+   1.302093199842358609321338417071710477615e+0004L,
+   7.353835804186292782840961999810543016039e+0004L,
+   2.356471661113686180549195092555751341757e+0005L,
+   4.350553267429009581632987060942780847101e+0005L,
+   4.588762661876600638719159826652389418235e+0005L,
+   2.675796398548523436544221045225290128611e+0005L,
+   8.077649557108971388298292919988449940464e+0004L,
+   1.117640459221306873519068741664054573776e+0004L,
+   5.544400072396814695175787511557757885585e+0002L,
+   5.072550541191480498431289089905822910718e+0000L,
+};
+static GENERIC ps6[13] = {	/* [1.28, 1.777...] */
+   1.0e0L,
+   5.832517925357165050639075848183613063291e+0001L,
+   1.252144364743592128171256104364976466898e+0003L,
+   1.310300234342216813579118022415585740772e+0004L,
+   7.434667697093812197817292154032863632923e+0004L,
+   2.398706595587719165726469002404004614711e+0005L,
+   4.472737517625103157004869372427480602511e+0005L,
+   4.786313523337761975294171429067037723611e+0005L,
+   2.851161872872731228472536061865365370192e+0005L,
+   8.891648269899148412331918021801385815586e+0004L,
+   1.297097489535351517572978123584751042287e+0004L,
+   7.096761640545975756202184143400469812618e+0002L,
+   8.378049338590233325977702401733340820351e+0000L,
+};
+static GENERIC sixteen = 16.0L;
+static GENERIC huge    = 1.0e30L;
+
+static GENERIC pzero(x)
+GENERIC x;
+{
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (one);
+	t = one/x; z = t*t;
+	if (x > sixteen) {
+	    r = z*pr0[11]+pr0[10]; s = ps0[10];
+	    for (i = 9; i >= 0; i--) {
+		r = z*r + pr0[i];
+		s = z*s + ps0[i];
+	    }
+	} else if (x > eight) {
+	    r = pr1[11]; s = ps1[11]+z*(ps1[12]+z*ps1[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + pr1[i];
+		s = z*s + ps1[i];
+	    }
+	} else if (x > five) { 	/* x > 5.0 */
+	    r = pr2[11]; s = ps2[11]+z*(ps2[12]+z*ps2[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + pr2[i];
+		s = z*s + ps2[i];
+	    }
+	} else if (x > 3.5L) {
+	    r = pr3[12]; s = ps3[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + pr3[i];
+		s = z*s + ps3[i];
+	    }
+	} else if (x > 2.5L) {
+	    r = pr4[12]; s = ps4[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + pr4[i];
+		s = z*s + ps4[i];
+	    }
+	} else if (x > (1.0L/0.5625L)) {
+	    r = pr5[12]; s = ps5[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + pr5[i];
+		s = z*s + ps5[i];
+	    }
+	} else {	/* assume x > 1.28 */
+	    r = pr6[12]; s = ps6[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + pr6[i];
+		s = z*s + ps6[i];
+	    }
+	}
+	return (r/s);
+}
+
+
+static GENERIC qr0[12] = {	/* [16, inf] */
+  -1.249999999999999999999999999999999972972e-0001L,
+  -1.425179595545670577414395762503991596897e+0002L,
+  -6.312499645625970845534460257936222407219e+0004L,
+  -1.411374326457208384315121243698814446848e+0007L,
+  -1.735034212758873581410984757860787252842e+0009L,
+  -1.199777647512789489421826342485055280680e+0011L,
+  -4.596025334081655714499860409699100373644e+0012L,
+  -9.262525628201284107792924477031653399187e+0013L,
+  -8.858394728685039245344398842180662867639e+0014L,
+  -3.267527953687534887623740622709505972113e+0015L,
+  -2.664222971186311967587129347029450062019e+0015L,
+   3.442464060723987869585180095344504100204e+0014L,
+};
+static GENERIC qs0[11] = {
+   1.0e0L,
+   1.140729613936536461931516610003185687881e+0003L,
+   5.056665510442299351009198186490085803580e+0005L,
+   1.132041763825642787943941650522718199115e+0008L,
+   1.394570111872581606392620678214246479767e+0010L,
+   9.677945218152264789534431079563744378421e+0011L,
+   3.731140327851536828225143058896348502096e+0013L,
+   7.612785951064869291722846681020881676410e+0014L,
+   7.476077016406764891730191004811863975940e+0015L,
+   2.951246482613592035421503427100393831709e+0016L,
+   3.108361803691811711136854587074302034901e+0016L,
+};
+static GENERIC qr1[12] = {	/* [8, 16 ] */
+  -1.249999999999999999997949010383433818157e-0001L,
+  -9.051215166393822640636752244895124126934e+0001L,
+  -2.620782703428148837671179031904208303947e+0004L,
+  -3.975571261553504457766177974508785790884e+0006L,
+  -3.479029330759311306270072218074074994090e+0008L,
+  -1.823955008124268573036216746186239829089e+0010L,
+  -5.765932697111801375765156029221568664435e+0011L,
+  -1.079843680798742592954002192417934779114e+0013L,
+  -1.146893630504592739082205764611581332897e+0014L,
+  -6.367016059683898464936104447282880704182e+0014L,
+  -1.583109041961213490464459111903484209098e+0015L,
+  -1.230149555764242473103128650135795639412e+0015L,
+};
+static GENERIC qs1[14] = {
+   1.0e0L,
+   7.246831508115058112438579847778014458432e+0002L,
+   2.100854184439168518399383786306927037611e+0005L,
+   3.192636418837951507430188285940994235122e+0007L,
+   2.801558443383354674538443461124434216152e+0009L,
+   1.475026997664373739293483927250653467487e+0011L,
+   4.694486824913954608552363821799927145318e+0012L,
+   8.890350100919200250838438709601547334021e+0013L,
+   9.626844429082905144874701068760469752067e+0014L,
+   5.541110744600460773528263862687521642140e+0015L,
+   1.486500494789452556727470329232123096563e+0016L,
+   1.415840104845959400365430773732093899210e+0016L,
+   1.780866095241517418081312567239682336483e+0015L,
+  -2.359230917384889357887631544079990129494e+0014L,
+};
+static GENERIC qr2[12] = {	/* [5, 8] */
+  -1.249999999999999531937744362527772181614e-0001L,
+  -4.944373897356969774839375977239241573966e+0001L,
+  -7.728449175433465285314261650078450473909e+0003L,
+  -6.262574329612752346336901434651220705903e+0005L,
+  -2.900948220220943306027235217424380672732e+0007L,
+  -7.988719647634192770463917157562874119535e+0008L,
+  -1.318228171927181389547760026626357012375e+0010L,
+  -1.282439773983029245309263271945424928196e+0011L,
+  -7.050925570827818040186149940257918845138e+0011L,
+  -2.021751882573871990004205616874202684429e+0012L,
+  -2.592939962400668552384333900573812635658e+0012L,
+  -1.038267109518891262840601514932972850326e+0012L,
+};
+static GENERIC qs2[14] = {
+   1.0e0L,
+   3.961358492885570003202784022894248952116e+0002L,
+   6.205788738864701882828752634586510926968e+0004L,
+   5.045715603932670286550673813011764406749e+0006L,
+   2.349248611362658323353343389430968751429e+0008L,
+   6.520244524415828635917683553721880063911e+0009L,
+   1.089111211223507719337067159886281887722e+0011L,
+   1.080406000905359867958779409414903018610e+0012L,
+   6.135645280895514703514154680623769562148e+0012L,
+   1.862433040246625874245867151368643668215e+0013L,
+   2.667780805786648888840777888702193708994e+0013L,
+   1.394401107289087774765300711809313112824e+0013L,
+   1.093247500616320375562898297156722445484e+0012L,
+  -7.228875530378928722826604216491493780775e+0010L,
+};
+static GENERIC qr3[13] = {	/* [3.5 5] */
+  -1.249999999999473067748420379578481661075e-0001L,
+  -3.044549048635289351913574324803250977998e+0001L,
+  -2.890081140649769078496693003524681440869e+0003L,
+  -1.404922456817202235879343275330529107684e+0005L,
+  -3.862746614385573443518177403617349281869e+0006L,
+  -6.257517309110249049201133708911155047689e+0007L,
+  -6.031451330920839916987079782727323477520e+0008L,
+  -3.411542405173830611454025765755854382346e+0009L,
+  -1.089392478149726672133014498723021526099e+0010L,
+  -1.824934078420210941290140903415956782726e+0010L,
+  -1.400780278304358710423481070486939531139e+0010L,
+  -3.716484136064917363926635716743771092093e+0009L,
+  -1.397591075296425529970434890954904331580e+0008L,
+};
+static GENERIC qs3[13] = {
+   1.0e0L,
+   2.441498613904962049391000187014945858042e+0002L,
+   2.326188882072370711500164222341514337043e+0004L,
+   1.137138213121231338494977104659239578165e+0006L,
+   3.152918070735662728722998452605364253517e+0007L,
+   5.172877993426507259314270488444013595108e+0008L,
+   5.083086439731669807455961078856470774115e+0009L,
+   2.961842732066434123119325521139476909941e+0010L,
+   9.912185866862440735829781856081353151390e+0010L,
+   1.793560561251622234430564181567297983598e+0011L,
+   1.577090119341228122525265108497940403073e+0011L,
+   5.509910306780166194333889999985463681636e+0010L,
+   4.761691134078874491202320181517936758141e+0009L,
+};
+static GENERIC qr4[13] = {	/* [2.5 3.5] */
+  -1.249999999928567734339745043490705340835e-0001L,
+  -1.967201748731419063051601624435565528481e+0001L,
+  -1.186329146714562236407099740615528170707e+0003L,
+  -3.607736959222941810356301491152457934060e+0004L,
+  -6.119200717978104904932828468575194267125e+0005L,
+  -6.037847781158358226670305078652205586384e+0006L,
+  -3.503558153336140359700536720393565984740e+0007L,
+  -1.180196478268225718757218523746787309773e+0008L,
+  -2.221860232085134915841426363505169680528e+0008L,
+  -2.173372505452747585296176761701746236760e+0008L,
+  -9.649364865061237558517730539506568013963e+0007L,
+  -1.465429227847933034546039640094862650385e+0007L,
+  -3.083003197920262085170581866246663380607e+0005L,
+};
+static GENERIC qs4[13] = {	/* [2.5 3.5] */
+   1.0e0L,
+   1.579620773732259142752614142139986854055e+0002L,
+   9.581372220329138733203879503753685054968e+0003L,
+   2.939598672379108095776114131010825885308e+0005L,
+   5.052183049314542218630341818692588448168e+0006L,
+   5.083497695595206639433839326338971980149e+0007L,
+   3.036385361800553388049719014005099206516e+0008L,
+   1.067826481452753409910563785161661492137e+0009L,
+   2.145644125557118044720741775125319669272e+0009L,
+   2.324115615959719949363946673491552216799e+0009L,
+   1.223262962112070757966959855619847011146e+0009L,
+   2.569765553318495423738478585947110270709e+0008L,
+   1.354744744299227127897905787732636565504e+0007L,
+};
+static GENERIC qr5[13] = {	/* [1.777.., 2.5] */
+  -1.249999995936639697637680428174576069971e-0001L,
+  -1.260846055371311453485891923426489068315e+0001L,
+  -4.772398467544467480801174330290141578895e+0002L,
+  -8.939852599990298486613760833996490599724e+0003L,
+  -9.184070787149542050979542226446134243197e+0004L,
+  -5.406038945018274458362637897739280435171e+0005L,
+  -1.845896544705190261018653728678171084418e+0006L,
+  -3.613616990680809501878667570653308071547e+0006L,
+  -3.908782978135693252252557720414348623779e+0006L,
+  -2.173711022517323927109138170588442768176e+0006L,
+  -5.431253130679918485836408549007856244495e+0005L,
+  -4.591098546452684510082591587275940765959e+0004L,
+  -5.244711364168207806835520057792229646578e+0002L,
+};
+static GENERIC qs5[13] = {	/* [1.777.., 2.5] */
+   1.0e0L,
+   1.014536210851290878350892750972474861447e+0002L,
+   3.875547510687135314064434160096139681076e+0003L,
+   7.361913122670079814955259281995617732580e+0004L,
+   7.720288944218771126581086539585529314636e+0005L,
+   4.681529554446752496404431433608306558038e+0006L,
+   1.667882621940503925455031252308367745820e+0007L,
+   3.469403153761399881888272620855305156241e+0007L,
+   4.096992047964210711867089384719947863019e+0007L,
+   2.596804755829217449311530735959560630554e+0007L,
+   7.983933774697889238154465064019410763845e+0006L,
+   9.818133816979900819087242425280757938152e+0005L,
+   3.061083930868694396013541535670745443560e+0004L,
+};
+
+static GENERIC qr6[13] = {	/* [1.28, 1.777..] */
+  -1.249999881577289001807137282824929082771e-0001L,
+  -7.998273510053110759610810594119533619282e+0000L,
+  -1.872481955335172543369089617771565632719e+0002L,
+  -2.122116786726300805079874003303799646812e+0003L,
+  -1.293850285839529282503178263484773478457e+0004L,
+  -4.445024742266316181033354192262529356093e+0004L,
+  -8.730161378334357767668344467356505347070e+0004L,
+  -9.706222895172078442801444972505315054736e+0004L,
+  -5.896325518259858270165531513618195321041e+0004L,
+  -1.823172034368108822276420827074668832233e+0004L,
+  -2.509304178635055926638833040337472387175e+0003L,
+  -1.156608965715779237316769828941729964099e+0002L,
+  -7.028005789650731396887346826397785210442e-0001L,
+};
+static GENERIC qs6[13] = {	/* [1.28, 1.777..] */
+   1.0e0L,
+   6.457211085058064845601261321277721075900e+0001L,
+   1.534005216588011210342824555136008682950e+0003L,
+   1.777217999176441782593357660462379097171e+0004L,
+   1.118372652642469468091084810263231199696e+0005L,
+   4.015242433858461813142365748386473605294e+0005L,
+   8.377081045517098645448616514388280497673e+0005L,
+   1.011495020008010352575398009604164287337e+0006L,
+   6.886722075290430568652227875200208955970e+0005L,
+   2.504735189948021472047157148613171956537e+0005L,
+   4.408138920171044846941001844352009817062e+0004L,
+   3.105572178072115145673058722853640854884e+0003L,
+   5.588294821118916113437396504573817033678e+0001L,
+};
+static GENERIC qzero(x)
+GENERIC x;
+{
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (-0.125L/x);
+	t = one/x; z = t*t;
+	if (x > sixteen) {
+	    r = z*qr0[11]+qr0[10]; s = qs0[10];
+	    for (i = 9; i >= 0; i--) {
+		r = z*r + qr0[i];
+		s = z*s + qs0[i];
+	    }
+	} else if (x > eight) {
+	    r = qr1[11]; s = qs1[11]+z*(qs1[12]+z*qs1[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + qr1[i];
+		s = z*s + qs1[i];
+	    }
+	} else if (x > five) {  /* assume x > 5.0 */
+	    r = qr2[11]; s = qs2[11]+z*(qs2[12]+z*qs2[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + qr2[i];
+		s = z*s + qs2[i];
+	    }
+	} else if (x > 3.5L) {
+	    r = qr3[12]; s = qs3[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + qr3[i];
+		s = z*s + qs3[i];
+	    }
+	} else if (x > 2.5L) {
+	    r = qr4[12]; s = qs4[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + qr4[i];
+		s = z*s + qs4[i];
+	    }
+	} else if (x > (1.0L/0.5625L)) {
+	    r = qr5[12]; s = qs5[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + qr5[i];
+		s = z*s + qs5[i];
+	    }
+	} else {	/* assume x > 1.28 */
+	    r = qr6[12]; s = qs6[12];
+	    for (i = 11; i >= 0; i--) {
+		r = z*r + qr6[i];
+		s = z*s + qs6[i];
+	    }
+	}
+	return (t*(r/s));
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/j1l.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,753 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * floating point Bessel's function of the first and second kinds
+ * of order zero: j1(x),y1(x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ */
+
+#pragma weak j1l = __j1l
+#pragma weak y1l = __y1l
+
+#include "libm.h"
+#include "libm_synonyms.h"
+#include "longdouble.h"
+#include <math.h>
+#if defined(__SUNPRO_C)
+#include <sunmath.h>
+#endif
+
+#define	GENERIC long double
+static GENERIC
+zero    = 0.0L,
+small	= 1.0e-9L,
+tiny 	= 1.0e-38L,
+one	= 1.0L,
+five   	= 5.0L,
+invsqrtpi = 5.641895835477562869480794515607725858441e-0001L,
+tpi	= 0.636619772367581343075535053490057448L;
+
+static GENERIC pone(), qone();
+static GENERIC r0[7] = {
+  -6.249999999999999999999999999999999627320e-0002L,
+   1.940606727194041716205384618494641565464e-0003L,
+  -3.005630423155733701856481469986459043883e-0005L,
+   2.345586219403918667468341047369572169358e-0007L,
+  -9.976809285885253587529010109133336669724e-0010L,
+   2.218743258363623946078958783775107473381e-0012L,
+  -2.071079656218700604767650924103578046280e-0015L,
+};
+static GENERIC s0[7] = {
+   1.0e0L,
+   1.061695903156199920738051277075003059555e-0002L,
+   5.521860513111180371566951179398862692060e-0005L,
+   1.824214367413754193524107877084979441407e-0007L,
+   4.098957778439576834818838198039029353925e-0010L,
+   6.047735079699666389853240090925264056197e-0013L,
+   4.679044728878836197247923279512047035041e-0016L,
+};
+
+GENERIC
+j1l(x) GENERIC x; {
+	GENERIC z, d, s, c, ss, cc, r;
+	int i, sgn;
+
+	if (!finitel(x))
+		return (one/x);
+	sgn = signbitl(x);
+	x = fabsl(x);
+	if (x > 1.28L) {
+		s = sinl(x);
+		c = cosl(x);
+	/*
+	 * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x0)-q1(x)*sin(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 (x > 1.0e2450L) {	/* x+x may overflow */
+			ss = -s-c;
+			cc =  s-c;
+		} else if (signbitl(s) != signbitl(c)) {
+			cc = s - c;
+			ss = cosl(x+x)/cc;
+		} else {
+			ss = -s-c;
+			cc = cosl(x+x)/ss;
+		}
+	/*
+	 * j1(x) = 1/sqrt(pi*x) * (P(1,x)*cc - Q(1,x)*ss)
+	 * y1(x) = 1/sqrt(pi*x) * (P(1,x)*ss + Q(1,x)*cc)
+	 */
+                if (x > 1.0e120L)
+					return (invsqrtpi*cc)/sqrtl(x);
+                d =  invsqrtpi*(pone(x)*cc-qone(x)*ss)/sqrtl(x);
+		if (sgn == 0)
+			return (d);
+		else
+			return (-d);
+	}
+	if (x <= small) {
+            if (x <= tiny) d = 0.5L*x;
+            else d =  x*(0.5L-x*x*0.125L);
+	    if (sgn == 0)
+			return (d);
+		else
+			return (-d);
+        }
+	z = x*x;
+	    r = r0[6];
+	    s = s0[6];
+	    for (i = 5; i >= 0; i--) {
+		r = r*z + r0[i];
+		s = s*z + s0[i];
+	    }
+	d = x*0.5L+x*(z*(r/s));
+	if (sgn == 0)
+		return (d);
+	else
+		return (-d);
+}
+
+static GENERIC u0[7] = {
+  -1.960570906462389484060557273467558703503e-0001L,
+   5.166389353148318460304315890665450006495e-0002L,
+  -2.229699464105910913337190798743451115604e-0003L,
+   3.625437034548863342715657067759078267158e-0005L,
+  -2.689902826993117212255524537353883987171e-0007L,
+   9.304570592456930912969387719010256018466e-0010L,
+  -1.234878126794286643318321347997500346131e-0012L,
+};
+static GENERIC v0[8] = {
+   1.0e0L,
+   1.369394302535807332517110204820556695644e-0002L,
+   9.508438148097659501433367062605935379588e-0005L,
+   4.399007309420092056052714797296467565655e-0007L,
+   1.488083087443756398305819693177715000787e-0009L,
+   3.751609832625793536245746965768587624922e-0012L,
+   6.680926434086257291872903276124244131448e-0015L,
+   6.676602383908906988160099057991121446058e-0018L,
+};
+
+GENERIC
+y1l(x) GENERIC x; {
+	GENERIC z, s, c, ss, cc, u, v;
+	int i;
+
+	if (isnanl(x))
+		return (x+x);
+	if (x <= zero) {
+		if (x == zero)
+		    return (-one/zero);
+		else
+		    return (zero/zero);
+	}
+	if (x > 1.28L) {
+		if (!finitel(x))
+			return (zero);
+		s = sinl(x);
+		c = cosl(x);
+	/*
+	 * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x0)-q1(x)*sin(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 (x > 1.0e2450L) {	/* x+x may overflow */
+			ss = -s-c;
+			cc =  s-c;
+		} else if (signbitl(s) != signbitl(c)) {
+			cc = s - c;
+			ss = cosl(x+x)/cc;
+		} else {
+			ss = -s-c;
+			cc = cosl(x+x)/ss;
+		}
+	/*
+	 * j1(x) = 1/sqrt(pi*x) * (P(1,x)*cc - Q(1,x)*ss)
+	 * y1(x) = 1/sqrt(pi*x) * (P(1,x)*ss + Q(1,x)*cc)
+	 */
+		if (x > 1.0e91L)
+			return (invsqrtpi*ss)/sqrtl(x);
+        return (invsqrtpi*(pone(x)*ss+qone(x)*cc)/sqrtl(x));
+	}
+        if (x <= tiny) {
+            return (-tpi/x);
+        }
+	z = x*x;
+	    u = u0[6]; v = v0[6]+z*v0[7];
+	    for (i = 5; i >= 0; i--) {
+		u = u*z + u0[i];
+		v = v*z + v0[i];
+	    }
+	return (x*(u/v) + tpi*(j1l(x)*logl(x)-one/x));
+}
+
+static GENERIC pr0[12] = {
+   1.000000000000000000000000000000000000267e+0000L,
+   1.060717875045891455602180843276758003035e+0003L,
+   4.344347542892127024446687712181105852335e+0005L,
+   8.915680220724007016377924252717410457094e+0007L,
+   9.969502259938406062809873257569171272819e+0009L,
+   6.200290193138613035646510338707386316595e+0011L,
+   2.105978548788015119851815854422247330118e+0013L,
+   3.696635772784601239371730810311998368948e+0014L,
+   3.015913097920694682057958412534134515156e+0015L,
+   9.370298471339353098123277427328592725921e+0015L,
+   7.190349005196335967340799265074029443057e+0015L,
+   2.736097786240689996880391074927552517982e+0014L,
+};
+static GENERIC ps0[11] = {
+   1.0e0L,
+   1.060600687545891455602180843276758095107e+0003L,
+   4.343106093416975589147153906505338900961e+0005L,
+   8.910605869002176566582072242244353399059e+0007L,
+   9.959122058635087888690713917622056540190e+0009L,
+   6.188744967234948231792482949171041843894e+0011L,
+   2.098863976953783506401759873801990304907e+0013L,
+   3.672870357018063196746729751479938908450e+0014L,
+   2.975538419246824921049011529574385888420e+0015L,
+   9.063657659995043205018686029284479837091e+0015L,
+   6.401953344314747916729366441508892711691e+0015L,
+};
+static GENERIC pr1[12] = {
+   1.000000000000000000000023667524130660984e+0000L,
+   6.746154419979618754354803488126452971204e+0002L,
+   1.811210781083390154857018330296145970502e+0005L,
+   2.533098390379924268038005329095287842244e+0007L,
+   2.029683619805342145252338570875424600729e+0009L,
+   9.660859662192711465301069401598929980319e+0010L,
+   2.743396238644831519934098967716621316316e+0012L,
+   4.553097354140854377931023170263455246288e+0013L,
+   4.210245069852219757476169864974870720374e+0014L,
+   1.987334056229596485076645967176169801727e+0015L,
+   4.067120052787096893838970455751338930462e+0015L,
+   2.486539606380406398310845264910691398133e+0015L,
+};
+static GENERIC ps1[14] = {
+   1.0e0L,
+   6.744982544979618754355808680196859521782e+0002L,
+   1.810421795396966762032155290441364740350e+0005L,
+   2.530986460644310651529583759699988435573e+0007L,
+   2.026743276048023121360249288818290224145e+0009L,
+   9.637461924407405935245269407052641341836e+0010L,
+   2.732378628423766417402292797028314160831e+0012L,
+   4.522345274960527124354844364012184278488e+0013L,
+   4.160650668341743132685335758415469856545e+0014L,
+   1.943730242988858208243492424892435901211e+0015L,
+   3.880228532692127989901131618598067450001e+0015L,
+   2.178020816161154615841000173683302999728e+0015L,
+  -8.994062666842225551554346698171600634173e+0013L,
+   1.368520368508851253495764806934619574990e+0013L,
+};
+static GENERIC pr2[12] = {
+   1.000000000000000006938651621840396237282e+0000L,
+   3.658416291850404981407101077037948144698e+0002L,
+   5.267073772170356547709794670602812447537e+0004L,
+   3.912012101226837463014925210735894620442e+0006L,
+   1.651295648974103957193874928714180765625e+0008L,
+   4.114901144480797609972484998142146783499e+0009L,
+   6.092524309766036681542980572526335147672e+0010L,
+   5.263913178071282616719249969074134570577e+0011L,
+   2.538408581124324223367341020538081330994e+0012L,
+   6.288607929360291027895126983015365677648e+0012L,
+   6.848330048211148419047055075386525945280e+0012L,
+   2.290309646838867941423178163991423244690e+0012L,
+};
+static GENERIC ps2[14] = {
+   1.0e0L,
+   3.657244416850405086459410165762319861856e+0002L,
+   5.262802358425023243992387075861237306312e+0004L,
+   3.905896813959919648136295861661483848364e+0006L,
+   1.646791907791461220742694842108202772763e+0008L,
+   4.096132803064256022224954120208201437344e+0009L,
+   6.046665195915950447544429445730680236759e+0010L,
+   5.198061739781991313414052212328653295168e+0011L,
+   2.484233851814333966401527626421254279796e+0012L,
+   6.047868806925315879339651539434315255940e+0012L,
+   6.333103831254091652501642567294101813354e+0012L,
+   1.875143098754284994467609936924685024968e+0012L,
+  -5.238330920563392692965412762508813601534e+0010L,
+   4.656888609439364725427789198383779259957e+0009L,
+};
+static GENERIC pr3[13] = {
+   1.000000000000009336887318068056137842897e+0000L,
+   2.242719942728459588488051572002835729183e+0002L,
+   1.955450611382026550266257737331095691092e+0004L,
+   8.707143293993619899395400562409175590739e+0005L,
+   2.186267894487004565948324289010954505316e+0007L,
+   3.224328510541957792360691585667502864688e+0008L,
+   2.821057355151380597331792896882741364897e+0009L,
+   1.445371387295422404365584793796028979840e+0010L,
+   4.181743160669891357783011002656658107864e+0010L,
+   6.387371088767993119325536137794535513922e+0010L,
+   4.575619999412716078064070587767416436396e+0010L,
+   1.228415651211639160620284441690503550842e+0010L,
+   7.242170349875563053436050532153112882072e+0008L,
+};
+static GENERIC ps3[13] = {
+   1.0e0L,
+   2.241548067728529551049804610486061401070e+0002L,
+   1.952838216795552145132137932931237181307e+0004L,
+   8.684574926493185744628127341069974575526e+0005L,
+   2.176357771067037962940853412819852189164e+0007L,
+   3.199958682356132977319258783167122100567e+0008L,
+   2.786218931525334687844675219914201872570e+0009L,
+   1.416283776951741549631417572317916039767e+0010L,
+   4.042962659271567948735676834609348842922e+0010L,
+   6.028168462646694510083847222968444402161e+0010L,
+   4.118410226794641413833887606580085281111e+0010L,
+   9.918735736297038430744161253338202230263e+0009L,
+   4.092967198238098023219124487437130332038e+0008L,
+};
+static GENERIC pr4[13] = {
+   1.000000000001509220978157399042059553390e+0000L,
+   1.437551868378147851133499996323782607787e+0002L,
+   7.911335537418177296041518061404505428004e+0003L,
+   2.193710939115317214716518908935756104804e+0005L,
+   3.390662495136730962513489796538274984382e+0006L,
+   3.048655347929348891006070609293884274789e+0007L,
+   1.613781633489496606354045161527450975195e+0008L,
+   4.975089835037230277110156150038482159988e+0008L,
+   8.636047087015115403880904418339566323264e+0008L,
+   7.918202912328366140110671223076949101509e+0008L,
+   3.423294665798984733439650311722794853294e+0008L,
+   5.621904953441963961040503934782662613621e+0007L,
+   2.086303543310240260758670404509484499793e+0006L,
+};
+static GENERIC ps4[13] = {
+   1.0e0L,
+   1.436379993384532371670493319591847362304e+0002L,
+   7.894647154785430678061053848847436659499e+0003L,
+   2.184659753392097529008981741550878586174e+0005L,
+   3.366109083305465176803513738147049499361e+0006L,
+   3.011911545968996817697665866587226343186e+0007L,
+   1.582262913779689851316760148459414895301e+0008L,
+   4.819268809494937919217938589530138201770e+0008L,
+   8.201355762990450679702837123432527154830e+0008L,
+   7.268232093982510937417446421282341425212e+0008L,
+   2.950911909015572933262131323934036480462e+0008L,
+   4.242839924305934423010858966540621219396e+0007L,
+   1.064387620445090779182117666330405186866e+0006L,
+};
+static GENERIC pr5[13] = {
+   1.000000000102434805241171427253847353861e+0000L,
+   9.129332257083629259060502249025963234821e+0001L,
+   3.132238483586953037576119377504557191413e+0003L,
+   5.329782528269307971278943122454171107861e+0004L,
+   4.988460157184117790692873002103052944145e+0005L,
+   2.686602071615786816147010334256047469378e+0006L,
+   8.445418526028961197703799808701268301831e+0006L,
+   1.536575358646141157475725889907900827390e+0007L,
+   1.568405818236523821796862770586544811945e+0007L,
+   8.450876239888770102387618667362302173547e+0006L,
+   2.154414900139567328424026827163203446077e+0006L,
+   2.105656926565043898888460254808062352205e+0005L,
+   4.739165011023396507022134303736862812975e+0003L,
+};
+static GENERIC ps5[13] = {
+   1.0e0L,
+   9.117613509595327476509152673394703847793e+0001L,
+   3.121697972484015639301279229281770795147e+0003L,
+   5.294447222735893568040911873834576440255e+0004L,
+   4.930368882192772335798256684110887882807e+0005L,
+   2.634854685641165298302167435798357437768e+0006L,
+   8.185462775400326393555896157031818280918e+0006L,
+   1.462417423080215192609668642663030667086e+0007L,
+   1.450624993985851675982860844153954896015e+0007L,
+   7.460467647561995283219086567162006113864e+0006L,
+   1.754210981405612478869227142579056338965e+0006L,
+   1.463286721155271971526264914524746699596e+0005L,
+   2.155894725796702015341211116579827039459e+0003L,
+};
+static GENERIC pr6[13] = {
+   1.000000003564855546741735920315743157129e+0000L,
+   5.734003934862540458119423509909510288366e+0001L,
+   1.209572491935850486086559692291796887976e+0003L,
+   1.243398391422281247933674779163660286838e+0004L,
+   6.930996755181437937258220998601708278787e+0004L,
+   2.198067659532757598646722249966767620099e+0005L,
+   4.033659432712058633933179115820576858455e+0005L,
+   4.257759657219008027016047206574574358678e+0005L,
+   2.511917395876004349480721277445763916389e+0005L,
+   7.813756153070623654178731651381881953552e+0004L,
+   1.152069173381127881385588092905864352891e+0004L,
+   6.548580782804088553777816037551523398082e+0002L,
+   8.668725370116906132327542766127938496880e+0000L,
+};
+static GENERIC ps6[13] = {
+   1.0e0L,
+   5.722285236357114566499221525736286205184e+0001L,
+   1.203010842878317935444582950620339570506e+0003L,
+   1.230058335378583550155825502172435371208e+0004L,
+   6.800998550607861288865300438648089894412e+0004L,
+   2.130767829599304262987769347536850885921e+0005L,
+   3.840483466643916681759936972992155310026e+0005L,
+   3.947432373459225542861819148108081160393e+0005L,
+   2.237816239393081111481588434457838526738e+0005L,
+   6.545820495124419723398946273790921540774e+0004L,
+   8.729563630320892741500726213278834737196e+0003L,
+   4.130762660291894753450174794196998813709e+0002L,
+   3.480368898672684645130335786015075595598e+0000L,
+};
+static GENERIC sixteen = 16.0L;
+static GENERIC eight   = 8.0L;
+static GENERIC huge    = 1.0e30L;
+
+static GENERIC pone(x)
+GENERIC x;
+{
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (one);
+	t = one/x; z = t*t;
+	if (x > sixteen) {
+	    r = z*pr0[11]+pr0[10]; s = ps0[10];
+	    for (i = 9; i >= 0; i--) {
+		r = z*r + pr0[i];
+		s = z*s + ps0[i];
+	    }
+	} else if (x > eight) {
+	    r = pr1[11]; s = ps1[11]+z*(ps1[12]+z*ps1[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + pr1[i];
+		s = z*s + ps1[i];
+	    }
+	} else if (x > five) {
+	    r = pr2[11]; s = ps2[11]+z*(ps2[12]+z*ps2[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + pr2[i];
+		s = z*s + ps2[i];
+	    }
+        } else if (x > 3.5L) {
+            r = pr3[12]; s = ps3[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + pr3[i];
+                s = z*s + ps3[i];
+            }
+        } else if (x > 2.5L) {
+            r = pr4[12]; s = ps4[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + pr4[i];
+                s = z*s + ps4[i];
+            }
+        } else if (x > (1.0L/0.5625L)) {
+            r = pr5[12]; s = ps5[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + pr5[i];
+                s = z*s + ps5[i];
+            }
+        } else {		/* assume x > 1.28 */
+            r = pr6[12]; s = ps6[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + pr6[i];
+                s = z*s + ps6[i];
+            }
+        }
+	return (r/s);
+}
+
+
+static GENERIC qr0[12] = {
+   3.749999999999999999999999999999999971033e-0001L,
+   4.256726035237050601607682277433094262226e+0002L,
+   1.875976490812878489192409978945401066066e+0005L,
+   4.170314268048041914273603680317745592790e+0007L,
+   5.092750132543855817293451118974555746551e+0009L,
+   3.494749676278488654103505795794139483404e+0011L,
+   1.327062148257437316997667817096694173709e+0013L,
+   2.648993138273427226907503742066551150490e+0014L,
+   2.511695665909547412222430494473998127684e+0015L,
+   9.274694506662289043224310499164702306096e+0015L,
+   8.150904170663663829331320302911792892002e+0015L,
+  -5.001918733707662355772037829620388765122e+0014L,
+};
+static GENERIC qs0[11] = {
+   1.0e0L,
+   1.135400380229880160428715273982155760093e+0003L,
+   5.005701183877126164326765545516590744360e+0005L,
+   1.113444200113712167984337603933040102987e+0008L,
+   1.361074819925223062778717565699039471124e+0010L,
+   9.355750985802849484438933905325982809653e+0011L,
+   3.563462786008988825003965543857998084828e+0013L,
+   7.155145113900094163648726863803802910454e+0014L,
+   6.871266835834472758055559013851843654113e+0015L,
+   2.622030899226736712644974988157345234092e+0016L,
+   2.602912729172876330650077021706139707746e+0016L,
+};
+static GENERIC qr1[12] = {
+   3.749999999999999999997762458207284405806e-0001L,
+   2.697883998881706839929255517498189980485e+0002L,
+   7.755195925781028489386938870473834411019e+0004L,
+   1.166777762104017777198211072895528968355e+0007L,
+   1.011504772984321168320010084520261069362e+0009L,
+   5.246007703574156853577754571720205550010e+0010L,
+   1.637692549885592683166116551691266537647e+0012L,
+   3.022303623698185669912990310925039382495e+0013L,
+   3.154769927290655684846107030265909987946e+0014L,
+   1.715819913441554770089730934808123360921e+0015L,
+   4.165044355759732622273534445131736188510e+0015L,
+   3.151381420874174705643100381708086287596e+0015L,
+};
+static GENERIC qs1[14] = {
+   1.0e0L,
+   7.197091705351218239785633172408276982828e+0002L,
+   2.070012799599548685544883041297609861055e+0005L,
+   3.117014815317656221871840152778458754516e+0007L,
+   2.705719678902554974863325877025902971727e+0009L,
+   1.406113614727345726925060648750867264098e+0011L,
+   4.403777536067131320363005978631674817359e+0012L,
+   8.170725690209322283061499386703167242894e+0013L,
+   8.609458844975495289227794126964431210566e+0014L,
+   4.766766367015473481257280600694952920204e+0015L,
+   1.202286587943342194863557940888115641650e+0016L,
+   1.012474328306200909525063936061756024120e+0016L,
+   6.183552022678917858273222879615824070703e+0014L,
+  -9.756731548558226997573737400988225722740e+0013L,
+};
+static GENERIC qr2[12] = {
+   3.749999999999999481245647262226994293189e-0001L,
+   1.471366807289771354491181140167359026735e+0002L,
+   2.279432486768448220142080962843526951250e+0004L,
+   1.828943048523771225163804043356958285893e+0006L,
+   8.379828388647823135832220596417725010837e+0007L,
+   2.279814029335044024585393671278378022053e+0009L,
+   3.711653952257118120832817785271466441420e+0010L,
+   3.557650914518554549916730572553105048068e+0011L,
+   1.924583483146095896259774329498934160650e+0012L,
+   5.424386256063736390759567088291887140278e+0012L,
+   6.839325621241776786206509704671746841737e+0012L,
+   2.702169563144001166291686452305436313971e+0012L,
+};
+static GENERIC qs2[14] = {
+   1.0e0L,
+   3.926379194439388135703211933895203191089e+0002L,
+   6.089148804106598297488336063007609312276e+0004L,
+   4.893546162973278583711376356041614150645e+0006L,
+   2.247571119114497845046388801813832219404e+0008L,
+   6.137635663350177751290469334200757872645e+0009L,
+   1.005115019784102856424493519524998953678e+0011L,
+   9.725664462014503832860151384604677240620e+0011L,
+   5.345525100485511116148634192844434636072e+0012L,
+   1.549944007398946691720862738173956994779e+0013L,
+   2.067148441178952625710302124163264760362e+0013L,
+   9.401565402641963611295119487242595462301e+0012L,
+   3.548217088622398274748837287769709374385e+0011L,
+  -2.934470341719047120076509938432417352365e+0010L,
+};
+static GENERIC qr3[13] = {
+   3.749999999999412724084579833297451472091e-0001L,
+   9.058478580291706212422978492938435582527e+0001L,
+   8.524056033161038750461083666711724381171e+0003L,
+   4.105967158629109427753434569223631014730e+0005L,
+   1.118326603378531348259783091972623333657e+0007L,
+   1.794636683403578918528064904714132329343e+0008L,
+   1.714314157463635959556133236004368896724e+0009L,
+   9.622092032236084846572067257267661456030e+0009L,
+   3.057759524485859159957762858780768355020e+0010L,
+   5.129306780754798531609621454415938890020e+0010L,
+   3.999122002794961070680636194346316041352e+0010L,
+   1.122298454643493485989721564358100345388e+0010L,
+   5.603981987645989709668830968522362582221e+0008L,
+};
+static GENERIC qs3[13] = {
+   1.0e0L,
+   2.418328663076578169836155170053634419922e+0002L,
+   2.279620205900121042587523541281272875520e+0004L,
+   1.100984222585729521470129014992217092794e+0006L,
+   3.010743223679247091004262516286654516282e+0007L,
+   4.860925542827367817289619265215599433996e+0008L,
+   4.686668111035348691982715864307839581243e+0009L,
+   2.668701788405102017427214705946730894074e+0010L,
+   8.677395746106802640390580944836650584903e+0010L,
+   1.511936455574951790658498795945106643036e+0011L,
+   1.260845604432623478002018696873608353093e+0011L,
+   4.052692278419853853911440231600864589805e+0010L,
+   2.965516519212226064983267822243329694729e+0009L,
+};
+static GENERIC qr4[13] = {
+   3.749999999919234164154669754440123072618e-0001L,
+   5.844218580776819864791168253485055101858e+0001L,
+   3.489273514092912982675669411371435670220e+0003L,
+   1.050523637774575684509663430018995479594e+0005L,
+   1.764549172059701565500717319792780115289e+0006L,
+   1.725532438844133795028063102681497371154e+0007L,
+   9.938114847359778539965140247590176334874e+0007L,
+   3.331710808184595545396883770200772842314e+0008L,
+   6.271970557641881511609560444872797282698e+0008L,
+   6.188529798677357075020774923903737913285e+0008L,
+   2.821905302742849974509982167877885011629e+0008L,
+   4.615467358646911976773290256984329814896e+0007L,
+   1.348140608731546467396685802693380693275e+0006L,
+};
+static GENERIC qs4[13] = {
+   1.0e0L,
+   1.561192663112345185261418296389902133372e+0002L,
+   9.346678031144098270547225423124213083072e+0003L,
+   2.825851246482293547838023847601704751590e+0005L,
+   4.776572711622156091710902891124911556293e+0006L,
+   4.715106953717135402977938048006267859302e+0007L,
+   2.753962350894311316439652227611209035193e+0008L,
+   9.428501434615463207768964787500411575223e+0008L,
+   1.832650858775206787088236896454141572617e+0009L,
+   1.901697378939743226948920874296595242257e+0009L,
+   9.433322226854293780627188599226380812725e+0008L,
+   1.808520540608671608680284520798858587370e+0008L,
+   7.983342331736662753157217446919462398008e+0006L,
+};
+static GENERIC qr5[13] = {
+      3.749999995331364437028988850515190446719e-0001L,
+      3.739356381766559882677514593041627547911e+0001L,
+      1.399562500629413529355265462912819802551e+0003L,
+      2.594154053098947925345332218062210111753e+0004L,
+      2.640149879297408640394163979394594318371e+0005L,
+      1.542471854873199142031889093591449397995e+0006L,
+      5.242272868972053374067572098992335425895e+0006L,
+      1.025834487769410221329633071426044839935e+0007L,
+      1.116553924239448940142230579060124209622e+0007L,
+      6.318076065595910176374916303525884653514e+0006L,
+      1.641218086168640408527639735915512881785e+0006L,
+      1.522369793529178644168813882912134706444e+0005L,
+      2.526530541062297200914180060208669584055e+0003L,
+};
+static GENERIC qs5[13] = {
+      1.0e0L,
+      9.998960735935075380397545659016287506660e+0001L,
+      3.758767417842043742686475060540416737562e+0003L,
+      7.013652806952306520121959742519780781653e+0004L,
+      7.208949808818615099246529616211730446850e+0005L,
+      4.272753927109614455417836186072202009252e+0006L,
+      1.482524411356470699336129814111025434703e+0007L,
+      2.988750366665678233425279237627700803473e+0007L,
+      3.396957890261080492694709150553619185065e+0007L,
+      2.050652487738593004111578091156304540386e+0007L,
+      5.900504120811732547616511555946279451316e+0006L,
+      6.563391409260160897024498082273183468347e+0005L,
+      1.692629845012790205348966731477187041419e+0004L,
+};
+static GENERIC qr6[13] = {
+    3.749999861516664133157566870858975421296e-0001L,
+    2.367863756747764863120797431599473468918e+0001L,
+    5.476715802114976248882067325630793143777e+0002L,
+    6.143190357869842894025012945444096170251e+0003L,
+    3.716250534677997850513733595140463851730e+0004L,
+    1.270883463823876752138326905022875657430e+0005L,
+    2.495301449636814481646371665429083801388e+0005L,
+    2.789578988212952248340486296254398601942e+0005L,
+    1.718247946911109055931819087137397324634e+0005L,
+    5.458973214011665714330326732204106364229e+0004L,
+    7.912102686687948786048943339759596652813e+0003L,
+    4.077961006160866935722030715149087938091e+0002L,
+    3.765206972770245085551057237882528510428e+0000L,
+};
+static GENERIC qs6[13] = {
+    1.0e0L,
+    6.341646532940517305641893852673926809601e+0001L,
+    1.477058277414040790932597537920671025359e+0003L,
+    1.674406564031044491436044253393536487604e+0004L,
+    1.028516501369755949895050806908994650768e+0005L,
+    3.593620042532885295087463507733285434207e+0005L,
+    7.267924991381020915185873399453724799625e+0005L,
+    8.462277510768818399961191426205006083088e+0005L,
+    5.514399892230892163373611895645500250514e+0005L,
+    1.898084241009259353540620272932188102299e+0005L,
+    3.102941242117739015721984123081026253068e+0004L,
+    1.958971184431466907681440650181421086143e+0003L,
+    2.878853357310495087181721613889455121867e+0001L,
+};
+static GENERIC qone(x)
+GENERIC x;
+{
+	GENERIC s, r, t, z;
+	int i;
+	if (x > huge)
+		return (0.375L/x);
+	t = one/x; z = t*t;
+	if (x > sixteen) {
+	    r = z*qr0[11]+qr0[10]; s = qs0[10];
+	    for (i = 9; i >= 0; i--) {
+		r = z*r + qr0[i];
+		s = z*s + qs0[i];
+	    }
+	} else if (x > eight) {
+	    r = qr1[11]; s = qs1[11]+z*(qs1[12]+z*qs1[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + qr1[i];
+		s = z*s + qs1[i];
+	    }
+	} else if (x > five) {	/* x > 5.0 */
+	    r = qr2[11]; s = qs2[11]+z*(qs2[12]+z*qs2[13]);
+	    for (i = 10; i >= 0; i--) {
+		r = z*r + qr2[i];
+		s = z*s + qs2[i];
+	    }
+        } else if (x > 3.5L) {
+            r = qr3[12]; s = qs3[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + qr3[i];
+                s = z*s + qs3[i];
+            }
+        } else if (x > 2.5L) {
+            r = qr4[12]; s = qs4[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + qr4[i];
+                s = z*s + qs4[i];
+            }
+        } else if (x > (1.0L/0.5625L)) {
+            r = qr5[12]; s = qs5[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + qr5[i];
+                s = z*s + qs5[i];
+            }
+        } else {		/* assume x > 1.28 */
+            r = qr6[12]; s = qs6[12];
+            for (i = 11; i >= 0; i--) {
+                r = z*r + qr6[i];
+                s = z*s + qs6[i];
+            }
+        }
+	return (t*(r/s));
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/jnl.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,285 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#if defined(ELFOBJ)
+#pragma weak jnl = __jnl
+#pragma weak ynl = __ynl
+#endif
+
+/*
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n: jn(n,x),yn(n,x);
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero 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 "libm.h"
+#include "longdouble.h"
+#include <float.h>	/* LDBL_MAX */
+
+#define	GENERIC long double
+
+static const GENERIC
+invsqrtpi = 5.641895835477562869480794515607725858441e-0001L,
+two  = 2.0L,
+zero = 0.0L,
+one  = 1.0L;
+
+GENERIC
+jnl(n, x) int n; GENERIC x; {
+	int i, sgn;
+	GENERIC a, b, temp = 0, 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)
+	 */
+	if (n < 0) {
+		n = -n;
+		x = -x;
+	}
+	if (n == 0) return (j0l(x));
+	if (n == 1) return (j1l(x));
+	if (x != x) return x+x;
+	if ((n&1) == 0)
+		sgn = 0; 			/* even n */
+	else
+		sgn = signbitl(x);	/* old n  */
+	x = fabsl(x);
+	if (x == zero || !finitel(x)) b = zero;
+	else if ((GENERIC)n <= x) {
+			/*
+			 * Safe to use
+			 * J(n+1,x)=2n/x *J(n,x)-J(n-1,x)
+			 */
+	    if (x > 1.0e91L) {
+				/*
+				 * 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
+				 */
+		switch (n&3) {
+		    case 0: temp =  cosl(x)+sinl(x); break;
+		    case 1: temp = -cosl(x)+sinl(x); break;
+		    case 2: temp = -cosl(x)-sinl(x); break;
+		    case 3: temp =  cosl(x)-sinl(x); break;
+		}
+		b = invsqrtpi*temp/sqrtl(x);
+	    } else {
+			a = j0l(x);
+			b = j1l(x);
+			for (i = 1; i < n; i++) {
+		    temp = b;
+		    b = b*((GENERIC)(i+i)/x) - a; /* avoid underflow */
+		    a = temp;
+			}
+	    }
+	} else {
+	    if (x < 1e-17L) {	/* use J(n,x) = 1/n!*(x/2)^n */
+		b = powl(0.5L*x, (GENERIC) n);
+		if (b != zero) {
+		    for (a = one, i = 1; i <= n; i++) a *= (GENERIC)i;
+		    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 quaduple
+		 */
+	    /* determin k */
+		GENERIC t, v;
+		double q0, q1, h, tmp; int k, m;
+		w  = (n+n)/(double)x; h = 2.0/(double)x;
+		q0 = w;  z = w+h; q1 = w*z - 1.0; k = 1;
+		while (q1 < 1.0e17) {
+			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*logl(fabsl(v*tmp));
+		if (tmp < 1.1356523406294143949491931077970765e+04L) {
+				for (i = n-1; i > 0; i--) {
+				temp = b;
+				b = ((i+i)/x)*b - a;
+				a = temp;
+				}
+		} else {
+				for (i = n-1; i > 0; i--) {
+				temp = b;
+				b = ((i+i)/x)*b - a;
+				a = temp;
+			if (b > 1e1000L) {
+						a /= b;
+						t /= b;
+						b  = 1.0;
+					}
+				}
+		}
+			b = (t*j0l(x)/b);
+	    }
+	}
+	if (sgn == 1)
+		return -b;
+	else
+		return b;
+}
+
+GENERIC
+ynl(n, x) int n; GENERIC x; {
+	int i;
+	int sign;
+	GENERIC a, b, temp = 0;
+
+	if (x != x)
+		return x+x;
+	if (x <= zero) {
+		if (x == zero)
+			return -one/zero;
+		else
+			return zero/zero;
+	}
+	sign = 1;
+	if (n < 0) {
+		n = -n;
+		if ((n&1) == 1) sign = -1;
+	}
+	if (n == 0) return (y0l(x));
+	if (n == 1) return (sign*y1l(x));
+	if (!finitel(x)) return zero;
+
+	if (x > 1.0e91L) {
+				/*
+				 * 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
+				 */
+		switch (n&3) {
+		    case 0: temp =  sinl(x)-cosl(x); break;
+		    case 1: temp = -sinl(x)-cosl(x); break;
+		    case 2: temp = -sinl(x)+cosl(x); break;
+		    case 3: temp =  sinl(x)+cosl(x); break;
+		}
+		b = invsqrtpi*temp/sqrtl(x);
+	} else {
+		a = y0l(x);
+		b = y1l(x);
+		/*
+		 * fix 1262058 and take care of non-default rounding
+		 */
+		for (i = 1; i < n; i++) {
+			temp = b;
+			b *= (GENERIC) (i + i) / x;
+			if (b <= -LDBL_MAX)
+				break;
+			b -= a;
+			a = temp;
+		}
+	}
+	if (sign > 0)
+		return b;
+	else
+		return -b;
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/LD/tanhl.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,102 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#if defined(ELFOBJ)
+#pragma weak tanhl = __tanhl
+#endif
+
+/*
+ * tanhl(x) returns the hyperbolic tangent of x
+ *
+ * Method :
+ *	1. reduce x to non-negative:  tanhl(-x) = - tanhl(x).
+ *	2.
+ *	  0      <  x <=  small    :  tanhl(x) := x
+ *					          -expm1l(-2x)
+ *	  small  <  x <=  1        :  tanhl(x) := --------------
+ *					         expm1l(-2x) + 2
+ *							  2
+ *	  1      <= x <= threshold :  tanhl(x) := 1 -  ---------------
+ *						      expm1l(2x) + 2
+ *     threshold <  x <= INF       :  tanhl(x) := 1.
+ *
+ * where
+ *	single : 	small = 1.e-5		threshold = 11.0
+ *	double : 	small = 1.e-10		threshold = 22.0
+ *	quad   : 	small = 1.e-20		threshold = 45.0
+ *
+ * Note: threshold was chosen so that
+ *		fl(1.0+2/(expm1(2*threshold)+2)) == 1.
+ *
+ * Special cases:
+ *	tanhl(NaN) is NaN;
+ *	only tanhl(0.0)=0.0 is exact for finite argument.
+ */
+
+#include "libm.h"
+#include "longdouble.h"
+
+static const long double small = 1.0e-20L, one = 1.0, two = 2.0,
+#ifndef lint
+	big = 1.0e+20L,
+#endif
+	threshold = 45.0L;
+
+long double
+tanhl(long double x) {
+	long double t, y, z;
+	int signx;
+#ifndef lint
+	volatile long double dummy;
+#endif
+
+	if (isnanl(x))
+		return (x + x);		/* x is NaN */
+	signx = signbitl(x);
+	t = fabsl(x);
+	z = one;
+	if (t <= threshold) {
+		if (t > one)
+			z = one - two / (expm1l(t + t) + two);
+		else if (t > small) {
+			y = expm1l(-t - t);
+			z = -y / (y + two);
+		} else {
+#ifndef lint
+			dummy = t + big;
+							/* inexact if t != 0 */
+#endif
+			return (x);
+		}
+	} else if (!finitel(t))
+		return (copysignl(one, x));
+	else
+		return (signx ? -z + small * small : z - small * small);
+	return (signx ? -z : z);
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/m9x/fenv_inlines.h	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,687 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2011, Richard Lowe
+ */
+
+#ifndef _FENV_INLINES_H
+#define	_FENV_INLINES_H
+
+#ifdef __GNUC__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#if defined(__x86)
+
+/*
+ * Floating point Control Word and Status Word
+ * Definition should actually be shared with x86
+ * (much of this 'amd64' code can be, in fact.)
+ */
+union fp_cwsw {
+	uint32_t cwsw;
+	struct {
+		uint16_t cw;
+		uint16_t sw;
+	} words;
+};
+
+extern __inline__ void
+__fenv_getcwsw(unsigned int *value)
+{
+	union fp_cwsw *u = (union fp_cwsw *)value;
+
+	__asm__ __volatile__(
+	    "fstsw %0\n\t"
+	    "fstcw %1\n\t"
+	    : "=m" (u->words.cw), "=m" (u->words.sw));
+}
+
+extern __inline__ void
+__fenv_setcwsw(const unsigned int *value)
+{
+	union fp_cwsw cwsw;
+	short fenv[16];
+
+	cwsw.cwsw = *value;
+
+	__asm__ __volatile__(
+	    "fstenv %0\n\t"
+	    "movw   %4,%1\n\t"
+	    "movw   %3,%2\n\t"
+	    "fldenv %0\n\t"
+	    "fwait\n\t"
+	    : "=m" (fenv), "=m" (fenv[0]), "=m" (fenv[2])
+	    : "r" (cwsw.words.cw), "r" (cwsw.words.sw)
+	    /* For practical purposes, we clobber the whole FPU */
+	    : "cc", "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)",
+	      "st(6)", "st(7)");
+}
+
+extern __inline__ void
+__fenv_getmxcsr(unsigned int *value)
+{
+	__asm__ __volatile__("stmxcsr %0" : "=m" (*value));
+}
+
+extern __inline__ void
+__fenv_setmxcsr(const unsigned int *value)
+{
+	__asm__ __volatile__("ldmxcsr %0" : : "m" (*value));
+}
+
+extern __inline__ long double
+f2xm1(long double x)
+{
+	long double ret;
+
+	__asm__ __volatile__("f2xm1" : "=t" (ret) : "0" (x) : "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fyl2x(long double y, long double x)
+{
+	long double ret;
+
+	__asm__ __volatile__("fyl2x"
+	    : "=t" (ret)
+	    : "0" (x), "u" (y)
+	    : "st(1)", "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fptan(long double x)
+{
+	/*
+	 * fptan pushes 1.0 then the result on completion, so we want to pop
+	 * the FP stack twice, so we need a dummy value into which to pop it.
+	 */
+	long double ret;
+	long double dummy;
+
+	__asm__ __volatile__("fptan"
+	    : "=t" (dummy), "=u" (ret)
+	    : "0" (x)
+	    : "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fpatan(long double x, long double y)
+{
+	long double ret;
+
+	__asm__ __volatile__("fpatan"
+	    : "=t" (ret)
+	    : "0" (y), "u" (x)
+	    : "st(1)", "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fxtract(long double x)
+{
+	__asm__ __volatile__("fxtract" : "+t" (x) : : "cc");
+	return (x);
+}
+
+extern __inline__ long double
+fprem1(long double idend, long double div)
+{
+	__asm__ __volatile__("fprem1" : "+t" (div) : "u" (idend) : "cc");
+	return (div);
+}
+
+extern __inline__ long double
+fprem(long double idend, long double div)
+{
+	__asm__ __volatile__("fprem" : "+t" (div) : "u" (idend) : "cc");
+	return (div);
+}
+
+extern __inline__ long double
+fyl2xp1(long double y, long double x)
+{
+	long double ret;
+
+	__asm__ __volatile__("fyl2xp1"
+	    : "=t" (ret)
+	    : "0" (x), "u" (y)
+	    : "st(1)", "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fsqrt(long double x)
+{
+	__asm__ __volatile__("fsqrt" : "+t" (x) : : "cc");
+	return (x);
+}
+
+extern __inline__ long double
+fsincos(long double x)
+{
+	long double dummy;
+
+	__asm__ __volatile__("fsincos" : "+t" (x), "=u" (dummy) : : "cc");
+	return (x);
+}
+
+extern __inline__ long double
+frndint(long double x)
+{
+	__asm__ __volatile__("frndint" : "+t" (x) : : "cc");
+	return (x);
+}
+
+extern __inline__ long double
+fscale(long double x, long double y)
+{
+	long double ret;
+
+	__asm__ __volatile__("fscale" : "=t" (ret) : "0" (y), "u" (x) : "cc");
+	return (ret);
+}
+
+extern __inline__ long double
+fsin(long double x)
+{
+	__asm__ __volatile__("fsin" : "+t" (x) : : "cc");
+	return (x);
+}
+
+extern __inline__ long double
+fcos(long double x)
+{
+	__asm__ __volatile__("fcos" : "+t" (x) : : "cc");
+	return (x);
+}
+
+extern __inline__ void
+sse_cmpeqss(float *f1, float *f2, int *i1)
+{
+	__asm__ __volatile__(
+	    "cmpeqss %2, %1\n\t"
+	    "movss   %1, %0"
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
+}
+
+extern __inline__ void
+sse_cmpltss(float *f1, float *f2, int *i1)
+{
+	__asm__ __volatile__(
+	    "cmpltss %2, %1\n\t"
+	    "movss   %1, %0"
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
+}
+
+extern __inline__ void
+sse_cmpless(float *f1, float *f2, int *i1)
+{
+	__asm__ __volatile__(
+	    "cmpless %2, %1\n\t"
+	    "movss   %1, %0"
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
+}
+
+extern __inline__ void
+sse_cmpunordss(float *f1, float *f2, int *i1)
+{
+	__asm__ __volatile__(
+	    "cmpunordss %2, %1\n\t"
+	    "movss      %1, %0"
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
+}
+
+extern __inline__ void
+sse_minss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "minss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_maxss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "maxss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_addss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "addss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_subss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "subss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_mulss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "mulss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_divss(float *f1, float *f2, float *f3)
+{
+	__asm__ __volatile__(
+	    "divss %2, %1\n\t"
+	    "movss %1, %0"
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
+}
+
+extern __inline__ void
+sse_sqrtss(float *f1, float *f2)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "sqrtss %2, %1\n\t"
+	    "movss  %1, %0"
+	    : "=m" (*f2), "=x" (tmp)
+	    : "m" (*f1));
+}
+
+extern __inline__ void
+sse_ucomiss(float *f1, float *f2)
+{
+	__asm__ __volatile__("ucomiss %1, %0" : : "x" (*f1), "x" (*f2));
+
+}
+
+extern __inline__ void
+sse_comiss(float *f1, float *f2)
+{
+	__asm__ __volatile__("comiss %1, %0" : : "x" (*f1), "x" (*f2));
+}
+
+extern __inline__ void
+sse_cvtss2sd(float *f1, double *d1)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "cvtss2sd %2, %1\n\t"
+	    "movsd    %1, %0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*f1));
+}
+
+extern __inline__ void
+sse_cvtsi2ss(int *i1, float *f1)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "cvtsi2ss %2, %1\n\t"
+	    "movss    %1, %0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*i1));
+}
+
+extern __inline__ void
+sse_cvttss2si(float *f1, int *i1)
+{
+	int tmp;
+
+	__asm__ __volatile__(
+	    "cvttss2si %2, %1\n\t"
+	    "movl      %1, %0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*f1));
+}
+
+extern __inline__ void
+sse_cvtss2si(float *f1, int *i1)
+{
+	int tmp;
+
+	__asm__ __volatile__(
+	    "cvtss2si %2, %1\n\t"
+	    "movl     %1, %0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*f1));
+}
+
+#if defined(__amd64)
+extern __inline__ void
+sse_cvtsi2ssq(long long *ll1, float *f1)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "cvtsi2ssq %2, %1\n\t"
+	    "movss     %1, %0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*ll1));
+}
+
+extern __inline__ void
+sse_cvttss2siq(float *f1, long long *ll1)
+{
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "cvttss2siq %2, %1\n\t"
+	    "movq       %1, %0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*f1));
+}
+
+extern __inline__ void
+sse_cvtss2siq(float *f1, long long *ll1)
+{
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "cvtss2siq %2, %1\n\t"
+	    "movq      %1, %0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*f1));
+}
+
+#endif
+
+extern __inline__ void
+sse_cmpeqsd(double *d1, double *d2, long long *ll1)
+{
+	__asm__ __volatile__(
+	    "cmpeqsd %2,%1\n\t"
+	    "movsd   %1,%0"
+	    : "=m" (*ll1), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_cmpltsd(double *d1, double *d2, long long *ll1)
+{
+	__asm__ __volatile__(
+	    "cmpltsd %2,%1\n\t"
+	    "movsd   %1,%0"
+	    : "=m" (*ll1), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_cmplesd(double *d1, double *d2, long long *ll1)
+{
+	__asm__ __volatile__(
+	    "cmplesd %2,%1\n\t"
+	    "movsd   %1,%0"
+	    : "=m" (*ll1), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_cmpunordsd(double *d1, double *d2, long long *ll1)
+{
+	__asm__ __volatile__(
+	    "cmpunordsd %2,%1\n\t"
+	    "movsd      %1,%0"
+	    : "=m" (*ll1), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+
+extern __inline__ void
+sse_minsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "minsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_maxsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "maxsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_addsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "addsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_subsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "subsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_mulsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "mulsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_divsd(double *d1, double *d2, double *d3)
+{
+	__asm__ __volatile__(
+	    "divsd %2,%1\n\t"
+	    "movsd %1,%0"
+	    : "=m" (*d3), "+x" (*d1)
+	    : "x" (*d2));
+}
+
+extern __inline__ void
+sse_sqrtsd(double *d1, double *d2)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "sqrtsd %2, %1\n\t"
+	    "movsd %1, %0"
+	    : "=m" (*d2), "=x" (tmp)
+	    : "m" (*d1));
+}
+
+extern __inline__ void
+sse_ucomisd(double *d1, double *d2)
+{
+	__asm__ __volatile__("ucomisd %1, %0" : : "x" (*d1), "x" (*d2));
+}
+
+extern __inline__ void
+sse_comisd(double *d1, double *d2)
+{
+	__asm__ __volatile__("comisd %1, %0" : : "x" (*d1), "x" (*d2));
+}
+
+extern __inline__ void
+sse_cvtsd2ss(double *d1, float *f1)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "cvtsd2ss %2,%1\n\t"
+	    "movss    %1,%0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*d1));
+}
+
+extern __inline__ void
+sse_cvtsi2sd(int *i1, double *d1)
+{
+	double tmp;
+	__asm__ __volatile__(
+	    "cvtsi2sd %2,%1\n\t"
+	    "movsd    %1,%0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*i1));
+}
+
+extern __inline__ void
+sse_cvttsd2si(double *d1, int *i1)
+{
+	int tmp;
+
+	__asm__ __volatile__(
+	    "cvttsd2si %2,%1\n\t"
+	    "movl      %1,%0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*d1));
+}
+
+extern __inline__ void
+sse_cvtsd2si(double *d1, int *i1)
+{
+	int tmp;
+
+	__asm__ __volatile__(
+	    "cvtsd2si %2,%1\n\t"
+	    "movl     %1,%0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*d1));
+}
+
+#if defined(__amd64)
+extern __inline__ void
+sse_cvtsi2sdq(long long *ll1, double *d1)
+{
+	double tmp;
+
+	__asm__ __volatile__(
+	    "cvtsi2sdq %2,%1\n\t"
+	    "movsd     %1,%0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*ll1));
+}
+
+extern __inline__ void
+sse_cvttsd2siq(double *d1, long long *ll1)
+{
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "cvttsd2siq %2,%1\n\t"
+	    "movq       %1,%0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*d1));
+}
+
+extern __inline__ void
+sse_cvtsd2siq(double *d1, long long *ll1)
+{
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "cvtsd2siq %2,%1\n\t"
+	    "movq      %1,%0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*d1));
+}
+#endif
+
+#elif defined(__sparc)
+extern __inline__ void
+__fenv_getfsr(unsigned long *l)
+{
+	__asm__ __volatile__(
+#if defined(__sparcv9)
+		"stx %%fsr,%0\n\t"
+#else
+		"st  %%fsr,%0\n\t"
+#endif
+		: "=m" (*l));
+}
+
+extern __inline__ void
+__fenv_setfsr(const unsigned long *l)
+{
+	__asm__ __volatile__(
+#if defined(__sparcv9)
+		"ldx %0,%%fsr\n\t"
+#else
+		"ld %0,%%fsr\n\t"
+#endif
+		: : "m" (*l) : "cc");
+}
+
+extern __inline__ void
+__fenv_getfsr32(unsigned int *l)
+{
+	__asm__ __volatile__("st %%fsr,%0\n\t" : "=m" (*l));
+}
+
+extern __inline__ void
+__fenv_setfsr32(const unsigned int *l)
+{
+	__asm__ __volatile__("ld %0,%%fsr\n\t" : : "m" (*l));
+}
+#else
+#error "GCC FENV inlines not implemented for this platform"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __GNUC__ */
+
+#endif /* _FENV_INLINES_H */
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/m9x/nearbyint.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,122 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#if defined(ELFOBJ)
+#pragma weak nearbyint = __nearbyint
+#endif
+
+/*
+ * nearbyint(x) returns the nearest fp integer to x in the direction
+ * corresponding to the current rounding direction without raising
+ * the inexact exception.
+ *
+ * nearbyint(x) is x unchanged if x is +/-0 or +/-inf.  If x is NaN,
+ * nearbyint(x) is also NaN.
+ */
+
+#include "libm.h"
+#include "fenv_synonyms.h"
+#include <fenv.h>
+
+double
+__nearbyint(double x) {
+	union {
+		unsigned i[2];
+		double d;
+	} xx;
+	unsigned hx, sx, i, frac;
+	int rm, j;
+
+	xx.d = x;
+	sx = xx.i[HIWORD] & 0x80000000;
+	hx = xx.i[HIWORD] & ~0x80000000;
+
+	/* handle trivial cases */
+	if (hx >= 0x43300000) {	/* x is nan, inf, or already integral */
+		if (hx >= 0x7ff00000)	/* x is inf or nan */
+#if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
+			return (hx >= 0x7ff80000 ? x : x + x);
+			/* assumes sparc-like QNaN */
+#else
+			return (x + x);
+#endif
+		return (x);
+	} else if ((hx | xx.i[LOWORD]) == 0)	/* x is zero */
+		return (x);
+
+	/* get the rounding mode */
+	rm = fegetround();
+
+	/* flip the sense of directed roundings if x is negative */
+	if (sx && (rm == FE_UPWARD || rm == FE_DOWNWARD))
+		rm = (FE_UPWARD + FE_DOWNWARD) - rm;
+
+	/* handle |x| < 1 */
+	if (hx < 0x3ff00000) {
+		if (rm == FE_UPWARD || (rm == FE_TONEAREST &&
+			(hx >= 0x3fe00000 && ((hx & 0xfffff) | xx.i[LOWORD]))))
+			xx.i[HIWORD] = sx | 0x3ff00000;
+		else
+			xx.i[HIWORD] = sx;
+		xx.i[LOWORD] = 0;
+		return (xx.d);
+	}
+
+	/* round x at the integer bit */
+	j = 0x433 - (hx >> 20);
+	if (j >= 32) {
+		i = 1 << (j - 32);
+		frac = ((xx.i[HIWORD] << 1) << (63 - j)) |
+			(xx.i[LOWORD] >> (j - 32));
+		if (xx.i[LOWORD] & (i - 1))
+			frac |= 1;
+		if (!frac)
+			return (x);
+		xx.i[LOWORD] = 0;
+		xx.i[HIWORD] &= ~(i - 1);
+		if ((rm == FE_UPWARD) || ((rm == FE_TONEAREST) &&
+			((frac > 0x80000000u) || ((frac == 0x80000000) &&
+			(xx.i[HIWORD] & i)))))
+			xx.i[HIWORD] += i;
+	} else {
+		i = 1 << j;
+		frac = (xx.i[LOWORD] << 1) << (31 - j);
+		if (!frac)
+			return (x);
+		xx.i[LOWORD] &= ~(i - 1);
+		if ((rm == FE_UPWARD) || ((rm == FE_TONEAREST) &&
+			(frac > 0x80000000u || ((frac == 0x80000000) &&
+			(xx.i[LOWORD] & i))))) {
+			xx.i[LOWORD] += i;
+			if (xx.i[LOWORD] == 0)
+				xx.i[HIWORD]++;
+		}
+	}
+	return (xx.d);
+}
--- /dev/null	Thu Oct  9 19:48:54 2014
+++ new/usr/src/lib/libm/common/m9x/scalblnl.c	Thu Oct  9 19:48:54 2014
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#if defined(ELFOBJ)
+#pragma weak scalblnl = __scalblnl
+#endif
+
+#include "libm.h"
+#include <float.h>		/* LDBL_MAX, LDBL_MIN */
+
+#if defined(__sparc)
+#define	XSET_EXP(k, x)	((int *) &x)[0] = (((int *) &x)[0] & ~0x7fff0000) | \
+				(k << 16)
+#define	ISINFNANL(k, x)	(k == 0x7fff)
+#define	XTWOT_OFFSET	113
+static const long double xtwot = 10384593717069655257060992658440192.0L,
+								/* 2^113 */
+	twomtm1 = 4.814824860968089632639944856462318296E-35L;	/* 2^-114 */
+#elif defined(__x86)
+#define	XSET_EXP(k, x)	((int *) &x)[2] = (((int *) &x)[2] & ~0x7fff) | k
+#if defined(HANDLE_UNSUPPORTED)
+#define      ISINFNANL(k, x) (k == 0x7fff || \
+                        (k != 0 && (((int *) &x)[1] & 0x80000000) == 0))
+#else
+#define	ISINFNANL(k, x)	(k == 0x7fff)
+#endif
+#define	XTWOT_OFFSET	64
+static const long double xtwot = 18446744073709551616.0L,	/* 2^64 */
+	twomtm1 = 2.7105054312137610850186E-20L;		/* 2^-65 */
+#endif
+
+long double
+scalblnl(long double x, long n) {
+	int k = XBIASED_EXP(x);
+
+	if (ISINFNANL(k, x))
+		return (x + x);
+	if (ISZEROL(x) || n == 0)
+		return (x);
+	if (k == 0) {
+		x *= xtwot;
+		k = XBIASED_EXP(x) - XTWOT_OFFSET;
+	}
+	k += (int) n;
+	if (n > 50000 || k > 0x7ffe)
+		return (LDBL_MAX * copysignl(LDBL_MAX, x));
+	if (n < -50000 || k <= -XTWOT_OFFSET - 1)
+		return (LDBL_MIN * copysignl(LDBL_MIN, x));
+	if (k > 0) {
+		XSET_EXP(k, x);
+		return (x);
+	}
+	k += XTWOT_OFFSET + 1;
+	XSET_EXP(k, x);
+	return (x * twomtm1);
+}
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libm/i386/src/libm_inlines.h	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,351 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright 2011, Richard Lowe
+ */
+
+/* Functions in this file are duplicated in locallibm.il.  Keep them in sync */
+
+#ifndef _LIBM_INLINES_H
+#define	_LIBM_INLINES_H
+
+#ifdef __GNUC__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <sys/ieeefp.h>
+
+#define	_LO_WORD(x)	((uint32_t *)&x)[0]
+#define	_HI_WORD(x)	((uint32_t *)&x)[1]
+#define	_HIER_WORD(x)	((uint32_t *)&x)[2]
+
+extern __inline__ double
+__inline_sqrt(double a)
+{
+	double ret;
+
+	__asm__ __volatile__("fsqrt\n\t" : "=t" (ret) : "0" (a) : "cc");
+	return (ret);
+}
+
+extern __inline__ double
+__ieee754_sqrt(double a)
+{
+	return (__inline_sqrt(a));
+}
+
+extern __inline__ float
+__inline_sqrtf(float a)
+{
+	float ret;
+
+	__asm__ __volatile__("fsqrt\n\t" : "=t" (ret) : "0" (a) : "cc");
+	return (ret);
+}
+
+extern __inline__ double
+__inline_rint(double a)
+{
+	__asm__ __volatile__(
+	    "andl $0x7fffffff,%1\n\t"
+	    "cmpl $0x43300000,%1\n\t"
+	    "jae  1f\n\t"
+	    "frndint\n\t"
+	    "1: fwait\n\t"
+	    : "+t" (a), "+&r" (_HI_WORD(a))
+	    :
+	    : "cc");
+
+	return (a);
+}
+
+/*
+ * 00 - 24 bits
+ * 01 - reserved
+ * 10 - 53 bits
+ * 11 - 64 bits
+ */
+extern __inline__ int
+__swapRP(int i)
+{
+	int ret;
+	uint16_t cw;
+
+	__asm__ __volatile__("fstcw %0\n\t" : "=m" (cw));
+
+	ret = (cw >> 8) & 0x3;
+	cw = (cw & 0xfcff) | ((i & 0x3) << 8);
+
+	__asm__ __volatile__("fldcw %0\n\t" : : "m" (cw));
+
+	return (ret);
+}
+
+/*
+ * 00 - Round to nearest, with even preferred
+ * 01 - Round down
+ * 10 - Round up
+ * 11 - Chop
+ */
+extern __inline__ enum fp_direction_type
+__swap87RD(enum fp_direction_type i)
+{
+	int ret;
+	uint16_t cw;
+
+	__asm__ __volatile__("fstcw %0\n\t" : "=m" (cw));
+
+	ret = (cw >> 10) & 0x3;
+	cw = (cw & 0xf3ff) | ((i & 0x3) << 10);
+
+	__asm__ __volatile__("fldcw %0\n\t" : : "m" (cw));
+
+	return (ret);
+}
+
+extern __inline__ double
+ceil(double d)
+{
+	/*
+	 * Let's set a Rounding Control (RC) bits from x87 FPU Control Word
+	 * to fp_positive and save old bits in rd.
+	 */
+	short rd = __swap87RD(fp_positive);
+
+	/*
+	 * The FRNDINT instruction returns a floating-point value that is the
+	 * integral value closest to the source value in the direction of the
+	 * rounding mode specified in the RC field of the x87 FPU control word.
+	 *
+	 * Rounds the source value in the ST(0) register to the nearest
+	 * integral value, depending on the current rounding mode
+	 * (setting of the RC field of the FPU control word),
+	 * and stores the result in ST(0).
+	 */
+	__asm__ __volatile__("frndint" : "+t" (d) : : "cc");
+
+	/* restore old RC bits */
+	__swap87RD(rd);
+
+	return (d);
+}
+
+extern __inline__ double
+copysign(double d1, double d2)
+{
+	__asm__ __volatile__(
+	    "andl $0x7fffffff,%0\n\t"	/* %0 <-- hi_32(abs(d)) */
+	    "andl $0x80000000,%1\n\t"	/* %1[31] <-- sign_bit(d2) */
+	    "orl  %1,%0\n\t"		/* %0 <-- hi_32(copysign(x,y)) */
+	    : "+&r" (_HI_WORD(d1)), "+r" (_HI_WORD(d2))
+	    :
+	    : "cc");
+
+	return (d1);
+}
+
+extern __inline__ double
+fabs(double d)
+{
+	__asm__ __volatile__("fabs\n\t" : "+t" (d) : : "cc");
+	return (d);
+}
+
+extern __inline__ float
+fabsf(float d)
+{
+	__asm__ __volatile__("fabs\n\t" : "+t" (d) : : "cc");
+	return (d);
+}
+
+extern __inline__ long double
+fabsl(long double d)
+{
+	__asm__ __volatile__("fabs\n\t" : "+t" (d) : : "cc");
+	return (d);
+}
+
+extern __inline__ int
+finite(double d)
+{
+	int ret = _HI_WORD(d);
+
+	__asm__ __volatile__(
+	    "notl %0\n\t"
+	    "andl $0x7ff00000,%0\n\t"
+	    "negl %0\n\t"
+	    "shrl $31,%0\n\t"
+	    : "+r" (ret)
+	    :
+	    : "cc");
+	return (ret);
+}
+
+extern __inline__ double
+floor(double d)
+{
+	short rd = __swap87RD(fp_negative);
+
+	__asm__ __volatile__("frndint" : "+t" (d), "+r" (rd) : : "cc");
+	__swap87RD(rd);
+
+	return (d);
+}
+
+/*
+ *      branchless __isnan
+ *      ((0x7ff00000-[((lx|-lx)>>31)&1]|ahx)>>31)&1 = 1 iff x is NaN
+ */
+extern __inline__ int
+isnan(double d)
+{
+	int ret;
+
+	__asm__ __volatile__(
+		"movl %1,%%ecx\n\t"
+		"negl %%ecx\n\t"			/* ecx <-- -lo_32(x) */
+		"orl  %%ecx,%1\n\t"
+		"shrl $31,%1\n\t"			/* 1 iff lx != 0 */
+		"andl $0x7fffffff,%2\n\t"	/* ecx <-- hi_32(abs(x)) */
+		"orl  %2,%1\n\t"
+		"subl $0x7ff00000,%1\n\t"
+		"negl %1\n\t"
+		"shrl $31,%1\n\t"
+		: "=r" (ret)
+		: "0" (_HI_WORD(d)), "r" (_LO_WORD(d))
+		: "ecx");
+
+	return (ret);
+}
+
+extern __inline__ int
+isnanf(float f)
+{
+	__asm__ __volatile__(
+	    "andl $0x7fffffff,%0\n\t"
+	    "negl %0\n\t"
+	    "addl $0x7f800000,%0\n\t"
+	    "shrl $31,%0\n\t"
+	    : "+r" (f)
+	    :
+	    : "cc");
+
+	return (f);
+}
+
+extern __inline__ double
+rint(double a) {
+    return (__inline_rint(a));
+}
+
+extern __inline__ double
+scalbn(double d, int n)
+{
+	double dummy;
+
+	__asm__ __volatile__(
+	    "fildl %2\n\t"	/* Convert N to extended */
+	    "fxch\n\t"
+	    "fscale\n\t"
+	    : "+t" (d), "=u" (dummy)
+	    : "m" (n)
+	    : "cc");
+
+	return (d);
+}
+
+extern __inline__ int
+signbit(double d)
+{
+	return (_HI_WORD(d) >> 31);
+}
+
+extern __inline__ int
+signbitf(float f)
+{
+	return ((*(uint32_t *)&f) >> 31);
+}
+
+extern __inline__ double
+sqrt(double d)
+{
+	return (__inline_sqrt(d));
+}
+
+extern __inline__ float
+sqrtf(float f)
+{
+	return (__inline_sqrtf(f));
+}
+
+extern __inline__ long double
+sqrtl(long double ld)
+{
+	__asm__ __volatile__("fsqrt" : "+t" (ld) : : "cc");
+	return (ld);
+}
+
+extern __inline__ int
+isnanl(long double ld)
+{
+	int ret = _HIER_WORD(ld);
+
+	__asm__ __volatile__(
+	    "andl  $0x00007fff,%0\n\t"
+	    "jz	   1f\n\t"		/* jump if exp is all 0 */
+	    "xorl  $0x00007fff,%0\n\t"
+	    "jz	   2f\n\t"		/* jump if exp is all 1 */
+	    "testl $0x80000000,%1\n\t"
+	    "jz	   3f\n\t"		/* jump if leading bit is 0 */
+	    "xorl  %0,%0\n\t"
+	    "jmp   1f\n\t"
+	    "2:\n\t"			/* note that %0 = 0 from before */
+	    "cmpl  $0x80000000,%1\n\t"	/* what is first half of significand? */
+	    "jnz   3f\n\t"		/* jump if not equal to 0x80000000 */
+	    "testl $0xffffffff,%2\n\t"	/* is second half of significand 0? */
+	    "jnz   3f\n\t"		/* jump if not equal to 0 */
+	    "jmp   1f\n\t"
+	    "3:\n\t"
+	    "movl  $1,%0\n\t"
+	    "1:\n\t"
+	    : "+&r" (ret)
+	    : "r" (_HI_WORD(ld)), "r" (_LO_WORD(ld))
+	    : "cc");
+
+	return (ret);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __GNUC__ */
+
+#endif /* _LIBM_INLINES_H */
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libm/sparc/src/libm_inlines.h	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,301 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright 2011, Richard Lowe.
+ */
+
+/* Functions in this file are duplicated in locallibm.il.  Keep them in sync */
+
+#ifndef _LIBM_INLINES_H
+#define	_LIBM_INLINES_H
+
+#ifdef __GNUC__
+
+#include <sys/types.h>
+#include <sys/ieeefp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern __inline__ double
+__inline_sqrt(double d)
+{
+	double ret;
+
+	__asm__ __volatile__("fsqrtd %1,%0\n\t" : "=e" (ret) : "e" (d));
+	return (ret);
+}
+
+extern __inline__ float
+__inline_sqrtf(float f)
+{
+	float ret;
+
+	__asm__ __volatile__("fsqrts %1,%0\n\t" : "=f" (ret) : "f" (f));
+	return (ret);
+}
+
+extern __inline__ enum fp_class_type
+fp_classf(float f)
+{
+	enum fp_class_type ret;
+	uint32_t tmp;
+
+	/* XXX: Separate input and output */
+	__asm__ __volatile__(
+	    "sethi  %%hi(0x80000000),%1\n\t"
+	    "andncc %2,%1,%0\n\t"
+	    "bne    1f\n\t"
+	    "nop\n\t"
+	    "mov    0,%0\n\t"
+	    "ba	2f\n\t"		/* x is 0 */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi  %%hi(0x7f800000),%1\n\t"
+	    "andcc  %0,%1,%%g0\n\t"
+	    "bne    1f\n\t"
+	    "nop\n\t"
+	    "mov    1,%0\n\t"
+	    "ba	    2f\n\t"	/* x is subnormal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "cmp    %0,%1\n\t"
+	    "bge    1f\n\t"
+	    "nop\n\t"
+	    "mov    2,%0\n\t"
+	    "ba	    2f\n\t"	/* x is normal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "bg	    1f\n\t"
+	    "nop\n\t"
+	    "mov    3,%0\n\t"
+	    "ba	    2f\n\t"	/* x is __infinity */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi  %%hi(0x00400000),%1\n\t"
+	    "andcc  %0,%1,%%g0\n\t"
+	    "mov    4,%0\n\t"	/* x is quiet NaN */
+	    "bne    2f\n\t"
+	    "nop\n\t"
+	    "mov    5,%0\n\t"	/* x is signaling NaN */
+	    "2:\n\t"
+	    : "=r" (ret), "=&r" (tmp)
+	    : "r" (f)
+	    : "cc");
+	return (ret);
+}
+
+#define	_HI_WORD(x)	((uint32_t *)&x)[0]
+#define	_LO_WORD(x)	((uint32_t *)&x)[1]
+
+extern __inline__ enum fp_class_type
+fp_class(double d)
+{
+	enum fp_class_type ret;
+	uint32_t tmp;
+
+	__asm__ __volatile__(
+	    "sethi %%hi(0x80000000),%1\n\t"	/* %1 gets 80000000 */
+	    "andn  %2,%1,%0\n\t"		/* %2-%0 gets abs(x) */
+	    "orcc  %0,%3,%%g0\n\t"		/* set cc as x is zero/nonzero */
+	    "bne   1f\n\t"			/* branch if x is nonzero */
+	    "nop\n\t"
+	    "mov   0,%0\n\t"
+	    "ba	   2f\n\t"			/* x is 0 */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi %%hi(0x7ff00000),%1\n\t"	/* %1 gets 7ff00000 */
+	    "andcc %0,%1,%%g0\n\t"		/* cc set by __exp field of x */
+	    "bne   1f\n\t"			/* branch if normal or max __exp */
+	    "nop\n\t"
+	    "mov   1,%0\n\t"
+	    "ba	   2f\n\t"			/* x is subnormal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "cmp   %0,%1\n\t"
+	    "bge   1f\n\t"			/* branch if x is max __exp */
+	    "nop\n\t"
+	    "mov   2,%0\n\t"
+	    "ba	   2f\n\t"			/* x is normal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "andn  %0,%1,%0\n\t"		/* o0 gets msw __significand field */
+	    "orcc  %0,%3,%%g0\n\t"		/* set cc by OR __significand */
+	    "bne   1f\n\t"			/* Branch if __nan */
+	    "nop\n\t"
+	    "mov   3,%0\n\t"
+	    "ba	   2f\n\t"			/* x is __infinity */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi %%hi(0x00080000),%1\n\t"
+	    "andcc %0,%1,%%g0\n\t"		/* set cc by quiet/sig bit */
+	    "be	   1f\n\t"			/* Branch if signaling */
+	    "nop\n\t"
+	    "mov   4,%0\n\t"			/* x is quiet NaN */
+	    "ba	   2f\n\t"
+	    "nop\n\t"
+	    "1:\n\t"
+	    "mov   5,%0\n\t"			/* x is signaling NaN */
+	    "2:\n\t"
+	    : "=&r" (ret), "=&r" (tmp)
+	    : "r" (_HI_WORD(d)), "r" (_LO_WORD(d))
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ int
+__swapEX(int i)
+{
+	int ret;
+	uint32_t fsr;
+	uint32_t tmp1, tmp2;
+
+	__asm__ __volatile__(
+	    "and  %4,0x1f,%2\n\t" /* tmp1 = %2 = %o1 */
+	    "sll  %2,5,%2\n\t"	/* shift input to aexc bit location */
+	    ".volatile\n\t"
+	    "st   %%fsr,%1\n\t"
+	    "ld   %1,%0\n\t"	/* %0 = fsr */
+	    "andn %0,0x3e0,%3\n\t" /* tmp2 = %3 = %o2 */
+	    "or   %2,%3,%2\n\t"	/* %2 = new fsr */
+	    "st	  %2,%1\n\t"
+	    "ld	  %1,%%fsr\n\t"
+	    "srl  %0,5,%0\n\t"
+	    "and  %0,0x1f,%0\n\t" /* %0 = ret = %o0 */
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2)
+	    : "r" (i)
+	    : "cc");
+
+	return (ret);
+}
+
+/*
+ * On the SPARC, __swapRP is a no-op; always return 0 for backward
+ * compatibility
+ */
+/* ARGSUSED */
+extern __inline__ enum fp_precision_type
+__swapRP(enum fp_precision_type i)
+{
+	return (0);
+}
+
+extern __inline__ enum fp_direction_type
+__swapRD(enum fp_direction_type d)
+{
+	enum fp_direction_type ret;
+	uint32_t fsr;
+	uint32_t tmp1, tmp2, tmp3;
+
+	__asm__ __volatile__(
+	    "and  %5,0x3,%0\n\t"
+	    "sll  %0,30,%2\n\t"		/* shift input to RD bit location */
+	    ".volatile\n\t"
+	    "st   %%fsr,%1\n\t"
+	    "ld	  %1,%0\n\t"		/* %0 = fsr */
+	    "set  0xc0000000,%4\n\t"	/* mask of rounding direction bits */
+	    "andn %0,%4,%3\n\t"
+	    "or   %2,%3,%2\n\t"		/* %2 = new fsr */
+	    "st	  %2,%1\n\t"
+	    "ld	  %1,%%fsr\n\t"
+	    "srl  %0,30,%0\n\t"
+	    "and  %0,0x3,%0\n\t"
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
+	    : "r" (d)
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ int
+__swapTE(int i)
+{
+	int ret;
+	uint32_t fsr, tmp1, tmp2;
+
+	__asm__ __volatile__(
+	    "and  %4,0x1f,%0\n\t"
+	    "sll  %0,23,%2\n\t"		/* shift input to TEM bit location */
+	    ".volatile\n\t"
+	    "st   %%fsr,%1\n\t"
+	    "ld	  %1,%0\n\t"		/* %0 = fsr */
+	    "set  0x0f800000,%3\n\t"	/* mask of TEM (Trap Enable Mode bits) */
+	    "andn %0,%3,%3\n\t"
+	    "or   %2,%3,%2\n\t"		/* %2 = new fsr */
+	    "st	  %2,%1\n\t"
+	    "ld	  %1,%%fsr\n\t"
+	    "srl  %0,23,%0\n\t"
+	    "and  %0,0x1f,%0\n\t"
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2)
+	    : "r" (i)
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ double
+sqrt(double d)
+{
+	return (__inline_sqrt(d));
+}
+
+extern __inline__ float
+sqrtf(float f)
+{
+	return (__inline_sqrtf(f));
+}
+
+extern __inline__ double
+fabs(double d)
+{
+	double ret;
+
+	__asm__ __volatile__("fabsd %1,%0\n\t" : "=e" (ret) : "e" (d));
+	return (ret);
+}
+
+extern __inline__ float
+fabsf(float f)
+{
+	float ret;
+
+	__asm__ __volatile__("fabss %1,%0\n\t" : "=f" (ret) : "f" (f));
+	return (ret);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* __GNUC */
+
+#endif /* _LIBM_INLINES_H */
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libm/sparcv9/src/libm_inlines.h	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,298 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright 2011, Richard Lowe.
+ */
+
+/* Functions in this file are duplicated in locallibm.il.  Keep them in sync */
+
+#ifndef _LIBM_INLINES_H
+#define	_LIBM_INLINES_H
+
+#ifdef __GNUC__
+
+#include <sys/types.h>
+#include <sys/ieeefp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern __inline__ enum fp_class_type
+fp_classf(float f)
+{
+	enum fp_class_type ret;
+	int fint;		/* scratch for f as int */
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "fabss  %3,%3\n\t"
+	    "st	    %3,%1\n\t"
+	    "ld	    %1,%0\n\t"
+	    "orcc   %%g0,%0,%%g0\n\t"
+	    "be,pn  %%icc,2f\n\t"
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi  %%hi(0x7f800000),%2\n\t"
+	    "andcc  %0,%2,%%g0\n\t"
+	    "bne,pt %%icc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,1,%0\n\t"
+	    "ba	    2f\n\t"	/* subnormal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "subcc  %0,%2,%%g0\n\t"
+	    "bge,pn %%icc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,2,%0\n\t"
+	    "ba	    2f\n\t"	/* normal */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "bg,pn  %%icc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,3,%0\n\t"
+	    "ba	    2f\n\t"	/* infinity */
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi  %%hi(0x00400000),%2\n\t"
+	    "andcc  %0,%2,%%g0\n\t"
+	    "or	    %%g0,4,%0\n\t"
+	    "bne,pt %%icc,2f\n\t" /* quiet NaN */
+	    "nop\n\t"
+	    "or	    %%g0,5,%0\n\t" /* signalling NaN */
+	    "2:\n\t"
+	    : "=r" (ret), "=m" (fint), "=r" (tmp), "+f" (f)
+	    :
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ enum fp_class_type
+fp_class(double d)
+{
+	enum fp_class_type ret;
+	uint64_t dint;		/* Scratch for d-as-long */
+	uint64_t tmp;
+
+	__asm__ __volatile__(
+	    "fabsd  %3,%3\n\t"
+	    "std    %3,%1\n\t"
+	    "ldx    %1,%0\n\t"
+	    "orcc   %%g0,%0,%%g0\n\t"
+	    "be,pn  %%xcc,2f\n\t"
+	    "nop\n\t"
+	    "sethi  %%hi(0x7ff00000),%2\n\t"
+	    "sllx   %2,32,%2\n\t"
+	    "andcc  %0,%2,%%g0\n\t"
+	    "bne,pt %%xcc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,1,%0\n\t"
+	    "ba	    2f\n\t"
+	    "nop\n\t"
+	    "1:\n\t"
+	    "subcc  %0,%2,%%g0\n\t"
+	    "bge,pn %%xcc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,2,%0\n\t"
+	    "ba	    2f\n\t"
+	    "nop\n\t"
+	    "1:\n\t"
+	    "andncc %0,%2,%0\n\t"
+	    "bne,pn %%xcc,1f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,3,%0\n\t"
+	    "ba	    2f\n\t"
+	    "nop\n\t"
+	    "1:\n\t"
+	    "sethi  %%hi(0x00080000),%2\n\t"
+	    "sllx   %2,32,%2\n\t"
+	    "andcc  %0,%2,%%g0\n\t"
+	    "or	    %%g0,4,%0\n\t"
+	    "bne,pt %%xcc,2f\n\t"
+	    "nop\n\t"
+	    "or	    %%g0,5,%0\n\t"
+	    "2:\n\t"
+	    : "=r" (ret), "=m" (dint), "=r" (tmp), "+e" (d)
+	    :
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ float
+__inline_sqrtf(float f)
+{
+	float ret;
+
+	__asm__ __volatile__("fsqrts %1,%0\n\t" : "=f" (ret) : "f" (f));
+	return (ret);
+}
+
+extern __inline__ double
+__inline_sqrt(double d)
+{
+	double ret;
+
+	__asm__ __volatile__("fsqrtd %1,%0\n\t" : "=f" (ret) : "f" (d));
+	return (ret);
+}
+
+extern __inline__ int
+__swapEX(int i)
+{
+	int ret;
+	uint32_t fsr;
+	uint64_t tmp1, tmp2;
+
+	__asm__ __volatile__(
+	    "and  %4,0x1f,%2\n\t"
+	    "sll  %2,5,%2\n\t"	/* shift input to aexc bit location */
+	    ".volatile\n\t"
+	    "st   %%fsr,%1\n\t"
+	    "ld	  %1,%0\n\t"	/* %0 = fsr */
+	    "andn %0,0x3e0,%3\n\t"
+	    "or   %2,%3,%2\n\t"	/* %2 = new fsr */
+	    "st	  %2,%1\n\t"
+	    "ld	  %1,%%fsr\n\t"
+	    "srl  %0,5,%0\n\t"
+	    "and  %0,0x1f,%0\n\t"
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2)
+	    : "r" (i)
+	    : "cc");
+
+	return (ret);
+}
+
+/*
+ * On the SPARC, __swapRP is a no-op; always return 0 for backward
+ * compatibility
+ */
+/* ARGSUSED */
+extern __inline__ enum fp_precision_type
+__swapRP(enum fp_precision_type i)
+{
+	return (0);
+}
+
+extern __inline__ enum fp_direction_type
+__swapRD(enum fp_direction_type d)
+{
+	enum fp_direction_type ret;
+	uint32_t fsr;
+	uint64_t tmp1, tmp2, tmp3;
+
+	__asm__ __volatile__(
+	    "and   %5,0x3,%0\n\t"
+	    "sll   %0,30,%2\n\t"	/* shift input to RD bit location */
+	    ".volatile\n\t"
+	    "st    %%fsr,%1\n\t"
+	    "ld	   %1,%0\n\t"		/* %0 = fsr */
+	    /* mask of rounding direction bits */
+	    "sethi %%hi(0xc0000000),%4\n\t"
+	    "andn  %0,%4,%3\n\t"
+	    "or    %2,%3,%2\n\t"	/* %2 = new fsr */
+	    "st	   %2,%1\n\t"
+	    "ld	   %1,%%fsr\n\t"
+	    "srl   %0,30,%0\n\t"
+	    "and   %0,0x3,%0\n\t"
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
+	    : "r" (d)
+	    : "cc");
+
+	return (ret);
+}
+
+extern __inline__ int
+__swapTE(int i)
+{
+	int ret;
+	uint32_t fsr;
+	uint64_t tmp1, tmp2, tmp3;
+
+	__asm__ __volatile__(
+	    "and   %5,0x1f,%0\n\t"
+	    "sll   %0,23,%2\n\t"	/* shift input to TEM bit location */
+	    ".volatile\n\t"
+	    "st    %%fsr,%1\n\t"
+	    "ld	   %1,%0\n\t"		/* %0 = fsr */
+	    /* mask of TEM (Trap Enable Mode bits) */
+	    "sethi %%hi(0x0f800000),%4\n\t"
+	    "andn  %0,%4,%3\n\t"
+	    "or    %2,%3,%2\n\t"	/* %2 = new fsr */
+	    "st	   %2,%1\n\t"
+	    "ld	   %1,%%fsr\n\t"
+	    "srl   %0,23,%0\n\t"
+	    "and   %0,0x1f,%0\n\t"
+	    ".nonvolatile\n\t"
+	    : "=r" (ret), "=m" (fsr), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
+	    : "r" (i)
+	    : "cc");
+
+	return (ret);
+}
+
+
+extern __inline__ double
+sqrt(double d)
+{
+	return (__inline_sqrt(d));
+}
+
+extern __inline__ float
+sqrtf(float f)
+{
+	return (__inline_sqrtf(f));
+}
+
+extern __inline__ double
+fabs(double d)
+{
+	double ret;
+
+	__asm__ __volatile__("fabsd %1,%0\n\t" : "=e" (ret) : "e" (d));
+	return (ret);
+}
+
+extern __inline__ float
+fabsf(float f)
+{
+	float ret;
+
+	__asm__ __volatile__("fabss %1,%0\n\t" : "=f" (ret) : "f" (f));
+	return (ret);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __GNUC__ */
+
+#endif /* _LIBM_INLINES_H */
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libmvec/Makefile.com	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,296 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+#
+
+LIBMDIR		= $(SRC)/lib/libm
+
+mvecOBJS	= \
+		__vTBL_atan1.o \
+		__vTBL_atan2.o \
+		__vTBL_rsqrt.o \
+		__vTBL_sincos.o \
+		__vTBL_sincos2.o \
+		__vTBL_sqrtf.o \
+		__vatan.o \
+		__vatan2.o \
+		__vatan2f.o \
+		__vatanf.o \
+		__vc_abs.o \
+		__vc_exp.o \
+		__vc_log.o \
+		__vc_pow.o \
+		__vcos.o \
+		__vcosbig.o \
+		__vcosbigf.o \
+		__vcosf.o \
+		__vexp.o \
+		__vexpf.o \
+		__vhypot.o \
+		__vhypotf.o \
+		__vlog.o \
+		__vlogf.o \
+		__vpow.o \
+		__vpowf.o \
+		__vrem_pio2m.o \
+		__vrhypot.o \
+		__vrhypotf.o \
+		__vrsqrt.o \
+		__vrsqrtf.o \
+		__vsin.o \
+		__vsinbig.o \
+		__vsinbigf.o \
+		__vsincos.o \
+		__vsincosbig.o \
+		__vsincosbigf.o \
+		__vsincosf.o \
+		__vsinf.o \
+		__vsqrt.o \
+		__vsqrtf.o \
+		__vz_abs.o \
+		__vz_exp.o \
+		__vz_log.o \
+		__vz_pow.o \
+		vatan2_.o \
+		vatan2f_.o \
+		vatan_.o \
+		vatanf_.o \
+		vc_abs_.o \
+		vc_exp_.o \
+		vc_log_.o \
+		vc_pow_.o \
+		vcos_.o \
+		vcosf_.o \
+		vexp_.o \
+		vexpf_.o \
+		vhypot_.o \
+		vhypotf_.o \
+		vlog_.o \
+		vlogf_.o \
+		vpow_.o \
+		vpowf_.o \
+		vrhypot_.o \
+		vrhypotf_.o \
+		vrsqrt_.o \
+		vrsqrtf_.o \
+		vsin_.o \
+		vsincos_.o \
+		vsincosf_.o \
+		vsinf_.o \
+		vsqrt_.o \
+		vsqrtf_.o \
+		vz_abs_.o \
+		vz_exp_.o \
+		vz_log_.o \
+		vz_pow_.o \
+		#end
+
+mvecvisCOBJS	= \
+		__vTBL_atan1.o \
+		__vTBL_atan2.o \
+		__vTBL_rsqrt.o \
+		__vTBL_sincos.o \
+		__vTBL_sincos2.o \
+		__vTBL_sqrtf.o \
+		__vcosbig.o \
+		__vcosbigf.o \
+		__vrem_pio2m.o \
+		__vsinbig.o \
+		__vsinbigf.o \
+		__vsincosbig.o \
+		__vsincosbigf.o \
+		#end
+
+mvecvisSOBJS	= \
+		__vatan.o \
+		__vatan2.o \
+		__vatan2f.o \
+		__vatanf.o \
+		__vcos.o \
+		__vcosf.o \
+		__vexp.o \
+		__vexpf.o \
+		__vhypot.o \
+		__vhypotf.o \
+		__vlog.o \
+		__vlogf.o \
+		__vpow.o \
+		__vpowf.o \
+		__vrhypot.o \
+		__vrhypotf.o \
+		__vrsqrt.o \
+		__vrsqrtf.o \
+		__vsin.o \
+		__vsincos.o \
+		__vsincosf.o \
+		__vsinf.o \
+		__vsqrt.o \
+		__vsqrtf.o \
+		#end
+
+mvecvis2COBJS	= \
+		__vTBL_sincos.o \
+		__vTBL_sincos2.o \
+		__vTBL_sqrtf.o \
+		__vcosbig.o \
+		__vcosbig_ultra3.o \
+		__vrem_pio2m.o \
+		__vsinbig.o \
+		__vsinbig_ultra3.o \
+		#end
+
+mvecvis2SOBJS	= \
+		__vcos_ultra3.o \
+		__vlog_ultra3.o \
+		__vsin_ultra3.o \
+		__vsqrtf_ultra3.o \
+		#end
+
+include		$(SRC)/lib/Makefile.lib
+include		$(SRC)/lib/Makefile.rootfs
+include		$(LIBMDIR)/Makefile.libm.com
+
+LIBS		= $(DYNLIB)
+SRCDIR		= ../common/
+DYNFLAGS	+= -zignore
+
+LINTERROFF	= -erroff=E_FP_DIVISION_BY_ZERO 
+LINTERROFF	+= -erroff=E_FP_INVALID
+LINTERROFF	+= -erroff=E_BAD_PTR_CAST_ALIGN
+LINTERROFF	+= -erroff=E_ASSIGMENT_CAUSE_LOSS_PREC
+LINTERROFF	+= -erroff=E_FUNC_SET_NOT_USED
+
+LINTFLAGS	+= $(LINTERROFF)
+LINTFLAGS64	+= $(LINTERROFF)
+LINTFLAGS64     += -errchk=longptr64
+
+CLAGS		+= $(LINTERROFF)
+CFLAGS64	+= $(LINTERROFF)
+
+ASDEF		+= -DLIBMVEC_SO_BUILD
+
+FLTRPATH_sparc		= $$ORIGIN/cpu/$$ISALIST/libmvec_isa.so.1
+FLTRPATH_sparcv9	= $$ORIGIN/../cpu/$$ISALIST/sparcv9/libmvec_isa.so.1
+FLTRPATH_i386		= $$ORIGIN/libmvec/$$HWCAP
+FLTRPATH		= $(FLTRPATH_$(TARGET_ARCH))
+
+sparc_CFLAGS += -_cc=-W0,-xintrinsic
+sparcv9_CFLAGS += -_cc=-W0,-xintrinsic
+CPPFLAGS_i386	+= -Dfabs=__fabs
+
+CPPFLAGS	+= -DLIBMVEC_SO_BUILD
+
+SRCS_mvec_i386 = \
+	../common/__vsqrtf.c \
+	#end
+
+SRCS_mvec_sparc = \
+	$(SRCS_mvec_i386) \
+	#end
+SRCS_mvec_sparcv9 = \
+	$(SRCS_mvec_i386) \
+	#end
+
+SRCS_mvec = \
+	$(SRCS_mvec_$(TARGETMACH)) \
+	../common/__vTBL_atan1.c \
+	../common/__vTBL_atan2.c \
+	../common/__vTBL_rsqrt.c \
+	../common/__vTBL_sincos.c \
+	../common/__vTBL_sincos2.c \
+	../common/__vTBL_sqrtf.c \
+	../common/__vatan.c \
+	../common/__vatan2.c \
+	../common/__vatan2f.c \
+	../common/__vatanf.c \
+	../common/__vc_abs.c \
+	../common/__vc_exp.c \
+	../common/__vc_log.c \
+	../common/__vc_pow.c \
+	../common/__vcos.c \
+	../common/__vcosbig.c \
+	../common/__vcosbigf.c \
+	../common/__vcosf.c \
+	../common/__vexp.c \
+	../common/__vexpf.c \
+	../common/__vhypot.c \
+	../common/__vhypotf.c \
+	../common/__vlog.c \
+	../common/__vlogf.c \
+	../common/__vpow.c \
+	../common/__vpowf.c \
+	../common/__vrem_pio2m.c \
+	../common/__vrhypot.c \
+	../common/__vrhypotf.c \
+	../common/__vrsqrt.c \
+	../common/__vrsqrtf.c \
+	../common/__vsin.c \
+	../common/__vsinbig.c \
+	../common/__vsinbigf.c \
+	../common/__vsincos.c \
+	../common/__vsincosbig.c \
+	../common/__vsincosbigf.c \
+	../common/__vsincosf.c \
+	../common/__vsinf.c \
+	../common/__vsqrt.c \
+	../common/__vz_abs.c \
+	../common/__vz_exp.c \
+	../common/__vz_log.c \
+	../common/__vz_pow.c \
+	../common/vatan2_.c \
+	../common/vatan2f_.c \
+	../common/vatan_.c \
+	../common/vatanf_.c \
+	../common/vc_abs_.c \
+	../common/vc_exp_.c \
+	../common/vc_log_.c \
+	../common/vc_pow_.c \
+	../common/vcos_.c \
+	../common/vcosf_.c \
+	../common/vexp_.c \
+	../common/vexpf_.c \
+	../common/vhypot_.c \
+	../common/vhypotf_.c \
+	../common/vlog_.c \
+	../common/vlogf_.c \
+	../common/vpow_.c \
+	../common/vpowf_.c \
+	../common/vrhypot_.c \
+	../common/vrhypotf_.c \
+	../common/vrsqrt_.c \
+	../common/vrsqrtf_.c \
+	../common/vsin_.c \
+	../common/vsincos_.c \
+	../common/vsincosf_.c \
+	../common/vsinf_.c \
+	../common/vsqrt_.c \
+	../common/vsqrtf_.c \
+	../common/vz_abs_.c \
+	../common/vz_exp_.c \
+	../common/vz_log_.c \
+	../common/vz_pow_.c \
+	#end
+
+.KEEP_STATE:
+
+all:	$(LIBS)
+
+lint:	lintcheck
+
+pics/%.o: ../$(TARGET_ARCH)/src/%.S
+	$(COMPILE.s) -o $@ $<
+	$(POST_PROCESS_O)
+
+pics/%.o: ../common/$$(CHIP)/%.S
+	$(COMPILE.s) -o $@ $<
+	$(POST_PROCESS_O)
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libmvec/common/__vcos.c	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,1100 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/isa_defs.h>
+#include <sys/ccompile.h>
+
+#ifdef _LITTLE_ENDIAN
+#define HI(x)	*(1+(int*)x)
+#define LO(x)	*(unsigned*)x
+#else
+#define HI(x)	*(int*)x
+#define LO(x)	*(1+(unsigned*)x)
+#endif
+
+#ifdef __RESTRICT
+#define restrict _Restrict
+#else
+#define restrict
+#endif
+
+/*
+ * vcos.1.c
+ *
+ * Vector cosine function.  Just slight modifications to vsin.8.c, mainly
+ * in the primary range part.
+ *
+ * Modification to primary range processing.  If an argument that does not
+ * fall in the primary range is encountered, then processing is continued
+ * in the medium range.
+ *
+ */
+
+extern const double __vlibm_TBL_sincos_hi[], __vlibm_TBL_sincos_lo[];
+
+static const double
+	half[2]	= { 0.5, -0.5 },
+	one		= 1.0,
+	invpio2 = 0.636619772367581343075535,  /* 53 bits of pi/2 */
+	pio2_1	= 1.570796326734125614166,	/* first 33 bits of pi/2 */
+	pio2_2	= 6.077100506303965976596e-11, /* second 33 bits of pi/2 */
+	pio2_3	= 2.022266248711166455796e-21, /* third 33 bits of pi/2 */
+	pio2_3t	= 8.478427660368899643959e-32, /* pi/2 - pio2_3 */
+	pp1		= -1.666666666605760465276263943134982554676e-0001,
+	pp2		=  8.333261209690963126718376566146180944442e-0003,
+	qq1		= -4.999999999977710986407023955908711557870e-0001,
+	qq2		=  4.166654863857219350645055881018842089580e-0002,
+	poly1[2]= { -1.666666666666629669805215138920301589656e-0001,
+				-4.999999999999931701464060878888294524481e-0001 },
+	poly2[2]= {  8.333333332390951295683993455280336376663e-0003,
+				 4.166666666394861917535640593963708222319e-0002 },
+	poly3[2]= { -1.984126237997976692791551778230098403960e-0004,
+				-1.388888552656142867832756687736851681462e-0003 },
+	poly4[2]= {  2.753403624854277237649987622848330351110e-0006,
+				 2.478519423681460796618128289454530524759e-0005 };
+
+static const unsigned thresh[2] = { 0x3fc90000, 0x3fc40000 };
+
+/* Don't __ the following; acomp will handle it */
+extern double fabs( double );
+extern void __vlibm_vcos_big( int, double *, int, double *, int, int );
+
+/*
+ * y[i*stridey] := cos( x[i*stridex] ), for i = 0..n.
+ *
+ * Calls __vlibm_vcos_big to handle all elts which have abs >~ 1.647e+06.
+ * Argument reduction is done here for elts pi/4 < arg < 1.647e+06.
+ *
+ * elts < 2^-27 use the approximation 1.0 ~ cos(x).
+ */
+void
+__vcos( int n, double * restrict x, int stridex, double * restrict y,
+	int stridey )
+{
+	double		x0_or_one[4], x1_or_one[4], x2_or_one[4];
+	double		y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
+	double		x0, x1, x2, *py0 = 0, *py1 = 0, *py2, *xsave, *ysave;
+	unsigned	hx0, hx1, hx2, xsb0, xsb1 = 0, xsb2;
+	int		i, biguns, nsave, sxsave, sysave;
+	volatile int	v __GNU_UNUSED;
+	nsave = n;
+	xsave = x;
+	sxsave = stridex;
+	ysave = y;
+	sysave = stridey;
+	biguns = 0;
+
+	do /* MAIN LOOP */
+	{
+		/* Gotos here so _break_ exits MAIN LOOP. */
+LOOP0:  /* Find first arg in right range. */
+		xsb0 = HI(x); /* get most significant word */
+		hx0 = xsb0 & ~0x80000000; /* mask off sign bit */
+		if ( hx0 > 0x3fe921fb ) {
+			/* Too big: arg reduction needed, so leave for second part */
+			biguns = 1;
+			goto MEDIUM;
+		}
+		if ( hx0 < 0x3e400000 ) {
+			/* Too small.  cos x ~ 1. */
+			v = *x;
+			*y = 1.0;
+			x += stridex;
+			y += stridey;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto LOOP0;
+		}
+		x0 = *x;
+		py0 = y;
+		x += stridex;
+		y += stridey;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+LOOP1: /* Get second arg, same as above. */
+		xsb1 = HI(x);
+		hx1 = xsb1 & ~0x80000000;
+		if ( hx1 > 0x3fe921fb )
+		{
+			biguns = 2;
+			goto MEDIUM;
+		}
+		if ( hx1 < 0x3e400000 )
+		{
+			v = *x;
+			*y = 1.0;
+			x += stridex;
+			y += stridey;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto LOOP1;
+		}
+		x1 = *x;
+		py1 = y;
+		x += stridex;
+		y += stridey;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+LOOP2: /* Get third arg, same as above. */
+		xsb2 = HI(x);
+		hx2 = xsb2 & ~0x80000000;
+		if ( hx2 > 0x3fe921fb )
+		{
+			biguns = 3;
+			goto MEDIUM;
+		}
+		if ( hx2 < 0x3e400000 )
+		{
+			v = *x;
+			*y = 1.0;
+			x += stridex;
+			y += stridey;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto LOOP2;
+		}
+		x2 = *x;
+		py2 = y;
+
+		/*
+		 * 0x3fc40000 = 5/32 ~ 0.15625
+		 * Get msb after subtraction.  Will be 1 only if
+		 * hx0 - 5/32 is negative.
+		 */
+		i = ( hx0 - 0x3fc40000 ) >> 31;
+		i |= ( ( hx1 - 0x3fc40000 ) >> 30 ) & 2;
+		i |= ( ( hx2 - 0x3fc40000 ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		a0, a1, a2, w0, w1, w2;
+			double		t0, t1, t2, z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0: /* All are > 5/32 */
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0 -= t0;
+			x1 -= t1;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+1]; /* cos_hi(t) */
+			a1 = __vlibm_TBL_sincos_hi[j1+1];
+			a2 = __vlibm_TBL_sincos_hi[j2+1];
+			   /*   cos_lo(t)			 sin_hi(t) */
+			t0 = __vlibm_TBL_sincos_lo[j0+1] - ( __vlibm_TBL_sincos_hi[j0+xsb0]*w0 - a0*t0 );
+			t1 = __vlibm_TBL_sincos_lo[j1+1] - ( __vlibm_TBL_sincos_hi[j1+xsb1]*w1 - a1*t1 );
+			t2 = __vlibm_TBL_sincos_lo[j2+1] - ( __vlibm_TBL_sincos_hi[j2+xsb2]*w2 - a2*t2 );
+
+			*py0 = a0 + t0;
+			*py1 = a1 + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 1:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x1 -= t1;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a1 = __vlibm_TBL_sincos_hi[j1+1];
+			a2 = __vlibm_TBL_sincos_hi[j2+1];
+			t1 = __vlibm_TBL_sincos_lo[j1+1] - ( __vlibm_TBL_sincos_hi[j1+xsb1]*w1 - a1*t1 );
+			t2 = __vlibm_TBL_sincos_lo[j2+1] - ( __vlibm_TBL_sincos_hi[j2+xsb2]*w2 - a2*t2 );
+			*py0 = one + t0;
+			*py1 = a1 + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x0 -= t0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+1];
+			a2 = __vlibm_TBL_sincos_hi[j2+1];
+			t0 = __vlibm_TBL_sincos_lo[j0+1] - ( __vlibm_TBL_sincos_hi[j0+xsb0]*w0 - a0*t0 );
+			t2 = __vlibm_TBL_sincos_lo[j2+1] - ( __vlibm_TBL_sincos_hi[j2+xsb2]*w2 - a2*t2 );
+			*py0 = a0 + t0;
+			*py1 = one + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 3:
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a2 = __vlibm_TBL_sincos_hi[j2+1];
+			t2 = __vlibm_TBL_sincos_lo[j2+1] - ( __vlibm_TBL_sincos_hi[j2+xsb2]*w2 - a2*t2 );
+			*py0 = one + t0;
+			*py1 = one + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 4:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x0 -= t0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+1];
+			a1 = __vlibm_TBL_sincos_hi[j1+1];
+			t0 = __vlibm_TBL_sincos_lo[j0+1] - ( __vlibm_TBL_sincos_hi[j0+xsb0]*w0 - a0*t0 );
+			t1 = __vlibm_TBL_sincos_lo[j1+1] - ( __vlibm_TBL_sincos_hi[j1+xsb1]*w1 - a1*t1 );
+			*py0 = a0 + t0;
+			*py1 = a1 + t1;
+			*py2 = one + t2;
+			break;
+
+		case 5:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			a1 = __vlibm_TBL_sincos_hi[j1+1];
+			t1 = __vlibm_TBL_sincos_lo[j1+1] - ( __vlibm_TBL_sincos_hi[j1+xsb1]*w1 - a1*t1 );
+			*py0 = one + t0;
+			*py1 = a1 + t1;
+			*py2 = one + t2;
+			break;
+
+		case 6:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+1];
+			t0 = __vlibm_TBL_sincos_lo[j0+1] - ( __vlibm_TBL_sincos_hi[j0+xsb0]*w0 - a0*t0 );
+			*py0 = a0 + t0;
+			*py1 = one + t1;
+			*py2 = one + t2;
+			break;
+
+		case 7: /* All are < 5/32 */
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			*py0 = one + t0;
+			*py1 = one + t1;
+			*py2 = one + t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		i = 0;
+	} while ( --n > 0 ); /* END MAIN LOOP */
+
+	/*
+	 * CLEAN UP last 0, 1, or 2 elts.
+	 */
+	if ( i > 0 ) /* Clean up elts at tail.  i < 3. */
+	{
+		double		a0, a1, w0, w1;
+		double		t0, t1, z0, z1;
+		unsigned	j0, j1;
+
+		if ( i > 1 )
+		{
+			if ( hx1 < 0x3fc40000 )
+			{
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+				t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+				t1 = one + t1;
+				*py1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 -= t1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				a1 = __vlibm_TBL_sincos_hi[j1+1];
+				t1 = __vlibm_TBL_sincos_lo[j1+1]
+					- ( __vlibm_TBL_sincos_hi[j1+xsb1]*w1 - a1*t1 );
+				*py1 = a1 + t1;
+			}
+		}
+		if ( hx0 < 0x3fc40000 )
+		{
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t0 = one + t0;
+			*py0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+1];
+			t0 = __vlibm_TBL_sincos_lo[j0+1] - ( __vlibm_TBL_sincos_hi[j0+xsb0]*w0 - a0*t0 );
+			*py0 = a0 + t0;
+		}
+	} /* END CLEAN UP */
+
+	return;
+
+	/*
+	 * Take care of BIGUNS.
+	 *
+	 * We have jumped here in the middle of processing after having
+	 * encountered a medium range argument.  Therefore things are in a
+	 * bit of a tizzy.
+	 */
+
+MEDIUM:
+
+	x0_or_one[1] = 1.0;
+	x1_or_one[1] = 1.0;
+	x2_or_one[1] = 1.0;
+	x0_or_one[3] = -1.0;
+	x1_or_one[3] = -1.0;
+	x2_or_one[3] = -1.0;
+	y0_or_zero[1] = 0.0;
+	y1_or_zero[1] = 0.0;
+	y2_or_zero[1] = 0.0;
+	y0_or_zero[3] = 0.0;
+	y1_or_zero[3] = 0.0;
+	y2_or_zero[3] = 0.0;
+
+	if ( biguns == 3 )
+	{
+		biguns = 0;
+		xsb0 = xsb0 >> 31;
+		xsb1 = xsb1 >> 31;
+		goto loop2;
+	}
+	else if ( biguns == 2 )
+	{
+		xsb0 = xsb0 >> 31;
+		biguns = 0;
+		goto loop1;
+	}
+	biguns = 0;
+
+	do
+	{
+		double		fn0, fn1, fn2, a0, a1, a2, w0, w1, w2, y0, y1, y2;
+		unsigned	hx;
+		int			n0, n1, n2;
+
+		/*
+		 * Find 3 more to work on: Not already done, not too big.
+		 */
+
+loop0:
+		hx = HI(x);
+		xsb0 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx > 0x413921fb ) /* (1.6471e+06) Too big: leave it. */
+		{
+			if ( hx >= 0x7ff00000 ) /* Inf or NaN */
+			{
+				x0 = *x;
+				*y = x0 - x0;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto loop0;
+		}
+		x0 = *x;
+		py0 = y;
+		x += stridex;
+		y += stridey;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+loop1:
+		hx = HI(x);
+		xsb1 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x1 = *x;
+				*y = x1 - x1;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto loop1;
+		}
+		x1 = *x;
+		py1 = y;
+		x += stridex;
+		y += stridey;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+loop2:
+		hx = HI(x);
+		xsb2 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x2 = *x;
+				*y = x2 - x2;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto loop2;
+		}
+		x2 = *x;
+		py2 = y;
+
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		n1 = (int) ( x1 * invpio2 + half[xsb1] );
+		n2 = (int) ( x2 * invpio2 + half[xsb2] );
+		fn0 = (double) n0;
+		fn1 = (double) n1;
+		fn2 = (double) n2;
+		n0 = (n0 + 1) & 3; /* Add 1 (before the mod) to make sin into cos */
+		n1 = (n1 + 1) & 3;
+		n2 = (n2 + 1) & 3;
+		a0 = x0 - fn0 * pio2_1;
+		a1 = x1 - fn1 * pio2_1;
+		a2 = x2 - fn2 * pio2_1;
+		w0 = fn0 * pio2_2;
+		w1 = fn1 * pio2_2;
+		w2 = fn2 * pio2_2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3 - y0;
+		w1 = fn1 * pio2_3 - y1;
+		w2 = fn2 * pio2_3 - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3t - y0;
+		w1 = fn1 * pio2_3t - y1;
+		w2 = fn2 * pio2_3t - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		xsb0 = HI(&x0);
+		i = ( ( xsb0 & ~0x80000000 ) - thresh[n0&1] ) >> 31;
+		xsb1 = HI(&x1);
+		i |= ( ( ( xsb1 & ~0x80000000 ) - thresh[n1&1] ) >> 30 ) & 2;
+		xsb2 = HI(&x2);
+		i |= ( ( ( xsb2 & ~0x80000000 ) - thresh[n2&1] ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		t0, t1, t2, z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			xsb2 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = ( a0 + t0 );
+			*py1 = ( a1 + t1 );
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 1:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb1 |= 1;
+			xsb2 |= 1;
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = t0;
+			*py1 = ( a1 + t1 );
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb2 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = ( a0 + t0 );
+			*py1 = t1;
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 3:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb2 |= 1;
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 4:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = ( a0 + t0 );
+			*py1 = ( a1 + t1 );
+			*py2 = t2;
+			break;
+
+		case 5:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb1 |= 1;
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = t0;
+			*py1 = ( a1 + t1 );
+			*py2 = t2;
+			break;
+
+		case 6:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = ( a0 + t0 );
+			*py1 = t1;
+			*py2 = t2;
+			break;
+
+		case 7:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		i = 0;
+	} while ( --n > 0 );
+
+	if ( i > 0 )
+	{
+		double		fn0, fn1, a0, a1, w0, w1, y0, y1;
+		double		t0, t1, z0, z1;
+		unsigned	j0, j1;
+		int			n0, n1;
+
+		if ( i > 1 )
+		{
+			n1 = (int) ( x1 * invpio2 + half[xsb1] );
+			fn1 = (double) n1;
+			n1 = (n1 + 1) & 3; /* Add 1 (before the mod) to make sin into cos */
+			a1 = x1 - fn1 * pio2_1;
+			w1 = fn1 * pio2_2;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3 - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3t - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			xsb1 = HI(&x1);
+			if ( ( xsb1 & ~0x80000000 ) < thresh[n1&1] )
+			{
+				j1 = n1 & 1;
+				x1_or_one[0] = x1;
+				x1_or_one[2] = -x1;
+				y1_or_zero[0] = y1;
+				y1_or_zero[2] = -y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+				t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+				t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+				*py1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 = ( x1 - t1 ) + y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				n1 ^= ( xsb1 & ~( n1 << 1 ) );
+				xsb1 |= 1;
+				a1 = __vlibm_TBL_sincos_hi[j1+n1];
+				t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+				*py1 = ( a1 + t1 );
+			}
+		}
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		fn0 = (double) n0;
+		n0 = (n0 + 1) & 3; /* Add 1 (before the mod) to make sin into cos */
+		a0 = x0 - fn0 * pio2_1;
+		w0 = fn0 * pio2_2;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3 - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3t - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		xsb0 = HI(&x0);
+		if ( ( xsb0 & ~0x80000000 ) < thresh[n0&1] )
+		{
+			j0 = n0 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			*py0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			*py0 = ( a0 + t0 );
+		}
+	}
+
+	if ( biguns )
+		__vlibm_vcos_big( nsave, xsave, sxsave, ysave, sysave, 0x413921fb );
+}
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libmvec/common/__vsin.c	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,1108 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/isa_defs.h>
+#include <sys/ccompile.h>
+
+#ifdef _LITTLE_ENDIAN
+#define HI(x)	*(1+(int*)x)
+#define LO(x)	*(unsigned*)x
+#else
+#define HI(x)	*(int*)x
+#define LO(x)	*(1+(unsigned*)x)
+#endif
+
+#ifdef __RESTRICT
+#define restrict _Restrict
+#else
+#define restrict
+#endif
+
+extern const double __vlibm_TBL_sincos_hi[], __vlibm_TBL_sincos_lo[];
+
+static const double
+	half[2]	= { 0.5, -0.5 },
+	one		= 1.0,
+	invpio2 = 0.636619772367581343075535,
+	pio2_1  = 1.570796326734125614166,
+	pio2_2  = 6.077100506303965976596e-11,
+	pio2_3  = 2.022266248711166455796e-21,
+	pio2_3t = 8.478427660368899643959e-32,
+	pp1		= -1.666666666605760465276263943134982554676e-0001,
+	pp2		=  8.333261209690963126718376566146180944442e-0003,
+	qq1		= -4.999999999977710986407023955908711557870e-0001,
+	qq2		=  4.166654863857219350645055881018842089580e-0002,
+	poly1[2]= { -1.666666666666629669805215138920301589656e-0001,
+				-4.999999999999931701464060878888294524481e-0001 },
+	poly2[2]= {  8.333333332390951295683993455280336376663e-0003,
+				 4.166666666394861917535640593963708222319e-0002 },
+	poly3[2]= { -1.984126237997976692791551778230098403960e-0004,
+				-1.388888552656142867832756687736851681462e-0003 },
+	poly4[2]= {  2.753403624854277237649987622848330351110e-0006,
+				 2.478519423681460796618128289454530524759e-0005 };
+
+static const unsigned thresh[2] = { 0x3fc90000, 0x3fc40000 };
+
+/* Don't __ the following; acomp will handle it */
+extern double fabs( double );
+extern void __vlibm_vsin_big( int, double *, int, double *, int, int );
+
+void
+__vsin( int n, double * restrict x, int stridex, double * restrict y,
+	int stridey )
+{
+	double		x0_or_one[4], x1_or_one[4], x2_or_one[4];
+	double		y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
+	double		x0, x1, x2, *py0 = 0, *py1 = 0, *py2, *xsave, *ysave;
+	unsigned	hx0, hx1, hx2, xsb0, xsb1 = 0, xsb2;
+	int		i, biguns, nsave, sxsave, sysave;
+	volatile int	v __GNU_UNUSED;
+	nsave = n;
+	xsave = x;
+	sxsave = stridex;
+	ysave = y;
+	sysave = stridey;
+	biguns = 0;
+
+	do
+	{
+LOOP0:
+		xsb0 = HI(x);
+		hx0 = xsb0 & ~0x80000000;
+		if ( hx0 > 0x3fe921fb )
+		{
+			biguns = 1;
+			goto MEDIUM;
+		}
+		if ( hx0 < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto LOOP0;
+		}
+		x0 = *x;
+		py0 = y;
+		x += stridex;
+		y += stridey;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+LOOP1:
+		xsb1 = HI(x);
+		hx1 = xsb1 & ~0x80000000;
+		if ( hx1 > 0x3fe921fb )
+		{
+			biguns = 2;
+			goto MEDIUM;
+		}
+		if ( hx1 < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto LOOP1;
+		}
+		x1 = *x;
+		py1 = y;
+		x += stridex;
+		y += stridey;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+LOOP2:
+		xsb2 = HI(x);
+		hx2 = xsb2 & ~0x80000000;
+		if ( hx2 > 0x3fe921fb )
+		{
+			biguns = 3;
+			goto MEDIUM;
+		}
+		if ( hx2 < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto LOOP2;
+		}
+		x2 = *x;
+		py2 = y;
+
+		i = ( hx0 - 0x3fc90000 ) >> 31;
+		i |= ( ( hx1 - 0x3fc90000 ) >> 30 ) & 2;
+		i |= ( ( hx2 - 0x3fc90000 ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		a0, a1, a2, w0, w1, w2;
+			double		t0, t1, t2, z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0 -= t0;
+			x1 -= t1;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+xsb0];
+			a1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			a2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+1] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+xsb0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+1] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+1] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+xsb2];
+			*py0 = a0 + t0;
+			*py1 = a1 + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 1:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x1 -= t1;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			a2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+			t0 = x0 + x0 * t0;
+			t1 = ( __vlibm_TBL_sincos_hi[j1+1] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+1] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+xsb2];
+			*py0 = t0;
+			*py1 = a1 + t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x0 -= t0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+xsb0];
+			a2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+1] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+xsb0];
+			t1 = x1 + x1 * t1;
+			t2 = ( __vlibm_TBL_sincos_hi[j2+1] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+xsb2];
+			*py0 = a0 + t0;
+			*py1 = t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 3:
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+			t0 = x0 + x0 * t0;
+			t1 = x1 + x1 * t1;
+			t2 = ( __vlibm_TBL_sincos_hi[j2+1] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+xsb2];
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = a2 + t2;
+			break;
+
+		case 4:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x0 -= t0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+xsb0];
+			a1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+1] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+xsb0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+1] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = x2 + x2 * t2;
+			*py0 = a0 + t0;
+			*py1 = a1 + t1;
+			*py2 = t2;
+			break;
+
+		case 5:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			a1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			t0 = x0 + x0 * t0;
+			t1 = ( __vlibm_TBL_sincos_hi[j1+1] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = x2 + x2 * t2;
+			*py0 = t0;
+			*py1 = a1 + t1;
+			*py2 = t2;
+			break;
+
+		case 6:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+xsb0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+1] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+xsb0];
+			t1 = x1 + x1 * t1;
+			t2 = x2 + x2 * t2;
+			*py0 = a0 + t0;
+			*py1 = t1;
+			*py2 = t2;
+			break;
+
+		case 7:
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+			t0 = x0 + x0 * t0;
+			t1 = x1 + x1 * t1;
+			t2 = x2 + x2 * t2;
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		i = 0;
+	} while ( --n > 0 );
+
+	if ( i > 0 )
+	{
+		double		a0, a1, w0, w1;
+		double		t0, t1, z0, z1;
+		unsigned	j0, j1;
+
+		if ( i > 1 )
+		{
+			if ( hx1 < 0x3fc90000 )
+			{
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+				t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+				t1 = x1 + x1 * t1;
+				*py1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 -= t1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				a1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+				t1 = ( __vlibm_TBL_sincos_hi[j1+1] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+xsb1];
+				*py1 = a1 + t1;
+			}
+		}
+		if ( hx0 < 0x3fc90000 )
+		{
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t0 = x0 + x0 * t0;
+			*py0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a0 = __vlibm_TBL_sincos_hi[j0+xsb0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+1] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+xsb0];
+			*py0 = a0 + t0;
+		}
+	}
+
+	return;
+
+	/*
+	 * MEDIUM RANGE PROCESSING
+	 * Jump here at first sign of medium range argument.  We are a bit
+	 * confused due to the jump.. fix up several variables and jump into
+	 * the nth loop, same as was being processed above.
+	 */
+
+MEDIUM:
+
+	x0_or_one[1] = 1.0;
+	x1_or_one[1] = 1.0;
+	x2_or_one[1] = 1.0;
+	x0_or_one[3] = -1.0;
+	x1_or_one[3] = -1.0;
+	x2_or_one[3] = -1.0;
+	y0_or_zero[1] = 0.0;
+	y1_or_zero[1] = 0.0;
+	y2_or_zero[1] = 0.0;
+	y0_or_zero[3] = 0.0;
+	y1_or_zero[3] = 0.0;
+	y2_or_zero[3] = 0.0;
+
+	if ( biguns == 3 ) 
+	{
+		biguns = 0;
+		xsb0 = xsb0 >> 31;
+		xsb1 = xsb1 >> 31;
+		goto loop2;
+	}
+	else if ( biguns == 2 ) 
+	{
+		xsb0 = xsb0 >> 31;
+		biguns = 0;
+		goto loop1;
+	}
+	biguns = 0;
+
+	do
+	{
+		double		fn0, fn1, fn2, a0, a1, a2, w0, w1, w2, y0, y1, y2;
+		unsigned	hx;
+		int		n0, n1, n2;
+
+loop0:
+		hx = HI(x);
+		xsb0 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto loop0;
+		}
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x0 = *x;
+				*y = x0 - x0;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto loop0;
+		}
+		x0 = *x;
+		py0 = y;
+		x += stridex;
+		y += stridey;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+loop1:
+		hx = HI(x);
+		xsb1 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto loop1;
+		}
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x1 = *x;
+				*y = x1 - x1;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto loop1;
+		}
+		x1 = *x;
+		py1 = y;
+		x += stridex;
+		y += stridey;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+loop2:
+		hx = HI(x);
+		xsb2 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx < 0x3e400000 )
+		{
+			v = *x;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto loop2;
+		}
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x2 = *x;
+				*y = x2 - x2;
+			}
+			else
+				biguns = 1;
+			x += stridex;
+			y += stridey;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto loop2;
+		}
+		x2 = *x;
+		py2 = y;
+
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		n1 = (int) ( x1 * invpio2 + half[xsb1] );
+		n2 = (int) ( x2 * invpio2 + half[xsb2] );
+		fn0 = (double) n0;
+		fn1 = (double) n1;
+		fn2 = (double) n2;
+		n0 &= 3;
+		n1 &= 3;
+		n2 &= 3;
+		a0 = x0 - fn0 * pio2_1;
+		a1 = x1 - fn1 * pio2_1;
+		a2 = x2 - fn2 * pio2_1;
+		w0 = fn0 * pio2_2;
+		w1 = fn1 * pio2_2;
+		w2 = fn2 * pio2_2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3 - y0;
+		w1 = fn1 * pio2_3 - y1;
+		w2 = fn2 * pio2_3 - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3t - y0;
+		w1 = fn1 * pio2_3t - y1;
+		w2 = fn2 * pio2_3t - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		xsb0 = HI(&x0);
+		i = ( ( xsb0 & ~0x80000000 ) - thresh[n0&1] ) >> 31;
+		xsb1 = HI(&x1);
+		i |= ( ( ( xsb1 & ~0x80000000 ) - thresh[n1&1] ) >> 30 ) & 2;
+		xsb2 = HI(&x2);
+		i |= ( ( ( xsb2 & ~0x80000000 ) - thresh[n2&1] ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		t0, t1, t2, z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			xsb2 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = ( a0 + t0 );
+			*py1 = ( a1 + t1 );
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 1:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb1 |= 1;
+			xsb2 |= 1;
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = t0;
+			*py1 = ( a1 + t1 );
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb2 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = ( a0 + t0 );
+			*py1 = t1;
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 3:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb2 |= 1;
+			a2 = __vlibm_TBL_sincos_hi[j2+n2];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = ( __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2 ) + __vlibm_TBL_sincos_lo[j2+n2];
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = ( a2 + t2 );
+			break;
+
+		case 4:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = ( a0 + t0 );
+			*py1 = ( a1 + t1 );
+			*py2 = t2;
+			break;
+
+		case 5:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb1 |= 1;
+			a1 = __vlibm_TBL_sincos_hi[j1+n1];
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = t0;
+			*py1 = ( a1 + t1 );
+			*py2 = t2;
+			break;
+
+		case 6:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = ( a0 + t0 );
+			*py1 = t1;
+			*py2 = t2;
+			break;
+
+		case 7:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		i = 0;
+	} while ( --n > 0 );
+
+	if ( i > 0 )
+	{
+		double		fn0, fn1, a0, a1, w0, w1, y0, y1;
+		double		t0, t1, z0, z1;
+		unsigned	j0, j1;
+		int		n0, n1;
+
+		if ( i > 1 )
+		{
+			n1 = (int) ( x1 * invpio2 + half[xsb1] );
+			fn1 = (double) n1;
+			n1 &= 3;
+			a1 = x1 - fn1 * pio2_1;
+			w1 = fn1 * pio2_2;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3 - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3t - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			xsb1 = HI(&x1);
+			if ( ( xsb1 & ~0x80000000 ) < thresh[n1&1] )
+			{
+				j1 = n1 & 1;
+				x1_or_one[0] = x1;
+				x1_or_one[2] = -x1;
+				y1_or_zero[0] = y1;
+				y1_or_zero[2] = -y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+				t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+				t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+				*py1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 = ( x1 - t1 ) + y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				n1 ^= ( xsb1 & ~( n1 << 1 ) );
+				xsb1 |= 1;
+				a1 = __vlibm_TBL_sincos_hi[j1+n1];
+				t1 = ( __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1 ) + __vlibm_TBL_sincos_lo[j1+n1];
+				*py1 = ( a1 + t1 );
+			}
+		}
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		fn0 = (double) n0;
+		n0 &= 3;
+		a0 = x0 - fn0 * pio2_1;
+		w0 = fn0 * pio2_2;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3 - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3t - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		xsb0 = HI(&x0);
+		if ( ( xsb0 & ~0x80000000 ) < thresh[n0&1] )
+		{
+			j0 = n0 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			*py0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+			a0 = __vlibm_TBL_sincos_hi[j0+n0];
+			t0 = ( __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0 ) + __vlibm_TBL_sincos_lo[j0+n0];
+			*py0 = ( a0 + t0 );
+		}
+	}
+
+	if ( biguns )
+		__vlibm_vsin_big( nsave, xsave, sxsave, ysave, sysave, 0x413921fb );
+}
--- /dev/null	Thu Oct  9 19:48:55 2014
+++ new/usr/src/lib/libmvec/common/__vsincos.c	Thu Oct  9 19:48:55 2014
@@ -0,0 +1,1547 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/isa_defs.h>
+#include <sys/ccompile.h>
+
+#ifdef _LITTLE_ENDIAN
+#define HI(x)	*(1+(int*)x)
+#define LO(x)	*(unsigned*)x
+#else
+#define HI(x)	*(int*)x
+#define LO(x)	*(1+(unsigned*)x)
+#endif
+
+#ifdef __RESTRICT
+#define restrict _Restrict
+#else
+#define restrict
+#endif
+
+/*
+ * vsincos.c
+ *
+ * Vector sine and cosine function.  Just slight modifications to vcos.c.
+ */
+
+extern const double __vlibm_TBL_sincos_hi[], __vlibm_TBL_sincos_lo[];
+
+static const double
+	half[2]	= { 0.5, -0.5 },
+	one		= 1.0,
+	invpio2 = 0.636619772367581343075535,  /* 53 bits of pi/2 */
+	pio2_1	= 1.570796326734125614166,  /* first 33 bits of pi/2 */
+	pio2_2	= 6.077100506303965976596e-11, /* second 33 bits of pi/2 */
+	pio2_3	= 2.022266248711166455796e-21, /* third 33 bits of pi/2 */
+	pio2_3t	= 8.478427660368899643959e-32, /* pi/2 - pio2_3 */
+	pp1		= -1.666666666605760465276263943134982554676e-0001,
+	pp2		=  8.333261209690963126718376566146180944442e-0003,
+	qq1		= -4.999999999977710986407023955908711557870e-0001,
+	qq2		=  4.166654863857219350645055881018842089580e-0002,
+	poly1[2]= { -1.666666666666629669805215138920301589656e-0001,
+				-4.999999999999931701464060878888294524481e-0001 },
+	poly2[2]= {  8.333333332390951295683993455280336376663e-0003,
+				 4.166666666394861917535640593963708222319e-0002 },
+	poly3[2]= { -1.984126237997976692791551778230098403960e-0004,
+				-1.388888552656142867832756687736851681462e-0003 },
+	poly4[2]= {  2.753403624854277237649987622848330351110e-0006,
+				 2.478519423681460796618128289454530524759e-0005 };
+
+/* Don't __ the following; acomp will handle it */
+extern double fabs( double );
+extern void __vlibm_vsincos_big( int, double *, int, double *, int, double *, int, int );
+
+/*
+ * y[i*stridey] := sin( x[i*stridex] ), for i = 0..n.
+ * c[i*stridec] := cos( x[i*stridex] ), for i = 0..n.
+ *
+ * Calls __vlibm_vsincos_big to handle all elts which have abs >~ 1.647e+06.
+ * Argument reduction is done here for elts pi/4 < arg < 1.647e+06.
+ *
+ * elts < 2^-27 use the approximation 1.0 ~ cos(x).
+ */
+void
+__vsincos( int n, double * restrict x, int stridex,
+				double * restrict y, int stridey,
+				double * restrict c, int stridec )
+{
+	double		x0_or_one[4], x1_or_one[4], x2_or_one[4];
+	double		y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
+	double		x0, x1, x2,
+			*py0, *py1, *py2,
+			*pc0, *pc1, *pc2,
+			*xsave, *ysave, *csave;
+	unsigned	hx0, hx1, hx2, xsb0, xsb1, xsb2;
+	int		i, biguns, nsave, sxsave, sysave, scsave;
+	volatile int	v __GNU_UNUSED;
+	nsave = n;
+	xsave = x;
+	sxsave = stridex;
+	ysave = y;
+	sysave = stridey;
+	csave = c;
+	scsave = stridec;
+	biguns = 0;
+
+	do /* MAIN LOOP */
+	{
+
+		/* Gotos here so _break_ exits MAIN LOOP. */
+LOOP0:  /* Find first arg in right range. */
+		xsb0 = HI(x); /* get most significant word */
+		hx0 = xsb0 & ~0x80000000; /* mask off sign bit */
+		if ( hx0 > 0x3fe921fb ) {
+			/* Too big: arg reduction needed, so leave for second part */
+			biguns = 1;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto LOOP0;
+		}
+		if ( hx0 < 0x3e400000 ) {
+			/* Too small.  cos x ~ 1, sin x ~ x. */
+			v = *x;
+			*c = 1.0;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto LOOP0;
+		}
+		x0 = *x;
+		py0 = y;
+		pc0 = c;
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+LOOP1: /* Get second arg, same as above. */
+		xsb1 = HI(x);
+		hx1 = xsb1 & ~0x80000000;
+		if ( hx1 > 0x3fe921fb )
+		{
+			biguns = 1;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto LOOP1;
+		}
+		if ( hx1 < 0x3e400000 )
+		{
+			v = *x;
+			*c = 1.0;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto LOOP1;
+		}
+		x1 = *x;
+		py1 = y;
+		pc1 = c;
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+LOOP2: /* Get third arg, same as above. */
+		xsb2 = HI(x);
+		hx2 = xsb2 & ~0x80000000;
+		if ( hx2 > 0x3fe921fb )
+		{
+			biguns = 1;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto LOOP2;
+		}
+		if ( hx2 < 0x3e400000 )
+		{
+			v = *x;
+			*c = 1.0;
+			*y = *x;
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto LOOP2;
+		}
+		x2 = *x;
+		py2 = y;
+		pc2 = c;
+
+		/*
+		 * 0x3fc40000 = 5/32 ~ 0.15625
+		 * Get msb after subtraction.  Will be 1 only if
+		 * hx0 - 5/32 is negative.
+		 */
+		i = ( hx2 - 0x3fc40000 ) >> 31;
+		i |= ( ( hx1 - 0x3fc40000 ) >> 30 ) & 2;
+		i |= ( ( hx0 - 0x3fc40000 ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		a1_0, a1_1, a1_2, a2_0, a2_1, a2_2;
+			double		w0, w1, w2;
+			double		t0, t1, t2, t1_0, t1_1, t1_2, t2_0, t2_1, t2_2;
+			double		z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0: /* All are > 5/32 */
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+
+			x0 -= t0;
+			x1 -= t1;
+			x2 -= t2;
+
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+xsb0]; /* sin_hi(t) */
+			a1_1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			a1_2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+1];	/* cos_hi(t) */
+			a2_1 = __vlibm_TBL_sincos_hi[j1+1];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+1];
+				/* cos_lo(t) */
+			t2_0 = __vlibm_TBL_sincos_lo[j0+1] - ( a1_0*w0 - a2_0*t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+1] - ( a1_1*w1 - a2_1*t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+1] - ( a1_2*w2 - a2_2*t2 );
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = a2_2 + t2_2;
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+xsb0]; /* sin_lo(t) */
+			t1_1 += __vlibm_TBL_sincos_lo[j1+xsb1];
+			t1_2 += __vlibm_TBL_sincos_lo[j2+xsb2];
+
+			*py0 = a1_0 + t1_0;
+			*py1 = a1_1 + t1_1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 1:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x0 -= t0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+xsb0]; /* sin_hi(t) */
+			a1_1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+1];	/* cos_hi(t) */
+			a2_1 = __vlibm_TBL_sincos_hi[j1+1];
+				/* cos_lo(t) */
+			t2_0 = __vlibm_TBL_sincos_lo[j0+1] - ( a1_0*w0 - a2_0*t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+1] - ( a1_1*w1 - a2_1*t1 );
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = one + t2;
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+xsb0]; /* sin_lo(t) */
+			t1_1 += __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+
+			*py0 = a1_0 + t1_0;
+			*py1 = a1_1 + t1_1;
+			t2 = x2 + x2 * t2;
+			*py2 = t2;
+
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x0 -= t0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+xsb0]; /* sin_hi(t) */
+			a1_2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+1];	/* cos_hi(t) */
+			a2_2 = __vlibm_TBL_sincos_hi[j2+1];
+				/* cos_lo(t) */
+			t2_0 = __vlibm_TBL_sincos_lo[j0+1] - ( a1_0*w0 - a2_0*t0 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+1] - ( a1_2*w2 - a2_2*t2 );
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = one + t1;
+			*pc2 = a2_2 + t2_2;
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+xsb0]; /* sin_lo(t) */
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t1_2 += __vlibm_TBL_sincos_lo[j2+xsb2];
+
+			*py0 = a1_0 + t1_0;
+			t1 = x1 + x1 * t1;
+			*py1 = t1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 3:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a1_0 = __vlibm_TBL_sincos_hi[j0+xsb0]; /* sin_hi(t) */
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+1];	/* cos_hi(t) */
+
+			t2_0 = __vlibm_TBL_sincos_lo[j0+1] - ( a1_0*w0 - a2_0*t0 );
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = one + t1;
+			*pc2 = one + t2;
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+xsb0]; /* sin_lo(t) */
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+
+			*py0 = a1_0 + t1_0;
+			t1 = x1 + x1 * t1;
+			*py1 = t1;
+			t2 = x2 + x2 * t2;
+			*py2 = t2;
+
+			break;
+
+		case 4:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x1 -= t1;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+
+			a1_1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+			a1_2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+
+			a2_1 = __vlibm_TBL_sincos_hi[j1+1];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+1];
+				/* cos_lo(t) */
+			t2_1 = __vlibm_TBL_sincos_lo[j1+1] - ( a1_1*w1 - a2_1*t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+1] - ( a1_2*w2 - a2_2*t2 );
+
+			*pc0 = one + t0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = a2_2 + t2_2;
+
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1_1 += __vlibm_TBL_sincos_lo[j1+xsb1];
+			t1_2 += __vlibm_TBL_sincos_lo[j2+xsb2];
+
+			t0 = x0 + x0 * t0;
+			*py0 = t0;
+			*py1 = a1_1 + t1_1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 5:
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x1 -= t1;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+
+			a1_1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+
+			a2_1 = __vlibm_TBL_sincos_hi[j1+1];
+
+			t2_1 = __vlibm_TBL_sincos_lo[j1+1] - ( a1_1*w1 - a2_1*t1 );
+
+			*pc0 = one + t0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = one + t2;
+
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1_1 += __vlibm_TBL_sincos_lo[j1+xsb1];
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+
+			t0 = x0 + x0 * t0;
+			*py0 = t0;
+			*py1 = a1_1 + t1_1;
+			t2 = x2 + x2 * t2;
+			*py2 = t2;
+
+			break;
+
+		case 6:
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x2 -= t2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			a1_2 = __vlibm_TBL_sincos_hi[j2+xsb2];
+
+			a2_2 = __vlibm_TBL_sincos_hi[j2+1];
+
+			t2_2 = __vlibm_TBL_sincos_lo[j2+1] - ( a1_2*w2 - a2_2*t2 );
+
+			*pc0 = one + t0;
+			*pc1 = one + t1;
+			*pc2 = a2_2 + t2_2;
+
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t1_2 += __vlibm_TBL_sincos_lo[j2+xsb2];
+
+			t0 = x0 + x0 * t0;
+			*py0 = t0;
+			t1 = x1 + x1 * t1;
+			*py1 = t1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 7: /* All are < 5/32 */
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+			t2 = z2 * ( poly3[1] + z2 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+			t2 = z2 * ( poly1[1] + z2 * ( poly2[1] + t2 ) );
+			*pc0 = one + t0;
+			*pc1 = one + t1;
+			*pc2 = one + t2;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+			t2 = z2 * ( poly3[0] + z2 * poly4[0] );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+			t2 = z2 * ( poly1[0] + z2 * ( poly2[0] + t2 ) );
+			t0 = x0 + x0 * t0;
+			t1 = x1 + x1 * t1;
+			t2 = x2 + x2 * t2;
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 0;
+	} while ( --n > 0 ); /* END MAIN LOOP */
+
+	/*
+	 * CLEAN UP last 0, 1, or 2 elts.
+	 */
+	if ( i > 0 ) /* Clean up elts at tail.  i < 3. */
+	{
+		double		a1_0, a1_1, a2_0, a2_1;
+		double		w0, w1;
+		double		t0, t1, t1_0, t1_1, t2_0, t2_1;
+		double		z0, z1;
+		unsigned	j0, j1;
+
+		if ( i > 1 )
+		{
+			if ( hx1 < 0x3fc40000 )
+			{
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[1] + z1 * poly4[1] );
+				t1 = z1 * ( poly1[1] + z1 * ( poly2[1] + t1 ) );
+				t1 = one + t1;
+				*pc1 = t1;
+				t1 = z1 * ( poly3[0] + z1 * poly4[0] );
+				t1 = z1 * ( poly1[0] + z1 * ( poly2[0] + t1 ) );
+				t1 = x1 + x1 * t1;
+				*py1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 -= t1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				a1_1 = __vlibm_TBL_sincos_hi[j1+xsb1];
+				a2_1 = __vlibm_TBL_sincos_hi[j1+1];
+				t2_1 = __vlibm_TBL_sincos_lo[j1+1] - ( a1_1*w1 - a2_1*t1 );
+				*pc1 = a2_1 + t2_1;
+				t1_1 = a2_1*w1 + a1_1*t1;
+				t1_1 += __vlibm_TBL_sincos_lo[j1+xsb1];
+				*py1 = a1_1 + t1_1;
+			}
+		}
+		if ( hx0 < 0x3fc40000 )
+		{
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[1] + z0 * poly4[1] );
+			t0 = z0 * ( poly1[1] + z0 * ( poly2[1] + t0 ) );
+			t0 = one + t0;
+			*pc0 = t0;
+			t0 = z0 * ( poly3[0] + z0 * poly4[0] );
+			t0 = z0 * ( poly1[0] + z0 * ( poly2[0] + t0 ) );
+			t0 = x0 + x0 * t0;
+			*py0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 -= t0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			a1_0 = __vlibm_TBL_sincos_hi[j0+xsb0]; /* sin_hi(t) */
+			a2_0 = __vlibm_TBL_sincos_hi[j0+1];	/* cos_hi(t) */
+			t2_0 = __vlibm_TBL_sincos_lo[j0+1] - ( a1_0*w0 - a2_0*t0 );
+			*pc0 = a2_0 + t2_0;
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1_0 += __vlibm_TBL_sincos_lo[j0+xsb0]; /* sin_lo(t) */
+			*py0 = a1_0 + t1_0;
+		}
+	} /* END CLEAN UP */
+
+	if ( !biguns )
+		return;
+
+	/*
+	 * Take care of BIGUNS.
+	 */
+	n = nsave;
+	x = xsave;
+	stridex = sxsave;
+	y = ysave;
+	stridey = sysave;
+	c = csave;
+	stridec = scsave;
+	biguns = 0;
+
+	x0_or_one[1] = 1.0;
+	x1_or_one[1] = 1.0;
+	x2_or_one[1] = 1.0;
+	x0_or_one[3] = -1.0;
+	x1_or_one[3] = -1.0;
+	x2_or_one[3] = -1.0;
+	y0_or_zero[1] = 0.0;
+	y1_or_zero[1] = 0.0;
+	y2_or_zero[1] = 0.0;
+	y0_or_zero[3] = 0.0;
+	y1_or_zero[3] = 0.0;
+	y2_or_zero[3] = 0.0;
+
+	do
+	{
+		double		fn0, fn1, fn2, a0, a1, a2, w0, w1, w2, y0, y1, y2;
+		unsigned	hx;
+		int			n0, n1, n2;
+
+		/*
+		 * Find 3 more to work on: Not already done, not too big.
+		 */
+loop0:
+		hx = HI(x);
+		xsb0 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx <= 0x3fe921fb ) /* Done above. */
+		{
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto loop0;
+		}
+		if ( hx > 0x413921fb ) /* (1.6471e+06) Too big: leave it. */
+		{
+			if ( hx >= 0x7ff00000 ) /* Inf or NaN */
+			{
+				x0 = *x;
+				*y = x0 - x0;
+				*c = x0 - x0;
+			}
+			else {
+				biguns = 1;
+			}
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 0;
+			if ( --n <= 0 )
+				break;
+			goto loop0;
+		}
+		x0 = *x;
+		py0 = y;
+		pc0 = c;
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 1;
+		if ( --n <= 0 )
+			break;
+
+loop1:
+		hx = HI(x);
+		xsb1 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx <= 0x3fe921fb )
+		{
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto loop1;
+		}
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x1 = *x;
+				*y = x1 - x1;
+				*c = x1 - x1;
+			}
+			else {
+				biguns = 1;
+			}
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 1;
+			if ( --n <= 0 )
+				break;
+			goto loop1;
+		}
+		x1 = *x;
+		py1 = y;
+		pc1 = c;
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 2;
+		if ( --n <= 0 )
+			break;
+
+loop2:
+		hx = HI(x);
+		xsb2 = hx >> 31;
+		hx &= ~0x80000000;
+		if ( hx <= 0x3fe921fb )
+		{
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto loop2;
+		}
+		if ( hx > 0x413921fb )
+		{
+			if ( hx >= 0x7ff00000 )
+			{
+				x2 = *x;
+				*y = x2 - x2;
+				*c = x2 - x2;
+			}
+			else {
+				biguns = 1;
+			}
+			x += stridex;
+			y += stridey;
+			c += stridec;
+			i = 2;
+			if ( --n <= 0 )
+				break;
+			goto loop2;
+		}
+		x2 = *x;
+		py2 = y;
+		pc2 = c;
+
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		n1 = (int) ( x1 * invpio2 + half[xsb1] );
+		n2 = (int) ( x2 * invpio2 + half[xsb2] );
+		fn0 = (double) n0;
+		fn1 = (double) n1;
+		fn2 = (double) n2;
+		n0 &= 3;
+		n1 &= 3;
+		n2 &= 3;
+		a0 = x0 - fn0 * pio2_1;
+		a1 = x1 - fn1 * pio2_1;
+		a2 = x2 - fn2 * pio2_1;
+		w0 = fn0 * pio2_2;
+		w1 = fn1 * pio2_2;
+		w2 = fn2 * pio2_2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3 - y0;
+		w1 = fn1 * pio2_3 - y1;
+		w2 = fn2 * pio2_3 - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		a0 = x0;
+		a1 = x1;
+		a2 = x2;
+		w0 = fn0 * pio2_3t - y0;
+		w1 = fn1 * pio2_3t - y1;
+		w2 = fn2 * pio2_3t - y2;
+		x0 = a0 - w0;
+		x1 = a1 - w1;
+		x2 = a2 - w2;
+		y0 = ( a0 - x0 ) - w0;
+		y1 = ( a1 - x1 ) - w1;
+		y2 = ( a2 - x2 ) - w2;
+		xsb2 = HI(&x2);
+		i = ( ( xsb2 & ~0x80000000 ) - 0x3fc40000 ) >> 31;
+		xsb1 = HI(&x1);
+		i |= ( ( ( xsb1 & ~0x80000000 ) - 0x3fc40000 ) >> 30 ) & 2;
+		xsb0 = HI(&x0);
+		i |= ( ( ( xsb0 & ~0x80000000 ) - 0x3fc40000 ) >> 29 ) & 4;
+		switch ( i )
+		{
+			double		a1_0, a1_1, a1_2, a2_0, a2_1, a2_2;
+			double		t0, t1, t2, t1_0, t1_1, t1_2, t2_0, t2_1, t2_2;
+			double		z0, z1, z2;
+			unsigned	j0, j1, j2;
+
+		case 0:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			xsb2 |= 1;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1_1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a1_2 = __vlibm_TBL_sincos_hi[j2+n2];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)];
+			a2_1 = __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)];
+
+			t2_0 = __vlibm_TBL_sincos_lo[j0+((n0+xsb0)&3)] - ( a1_0*w0 - a2_0*t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+((n1+xsb1)&3)] - ( a1_1*w1 - a2_1*t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+((n2+xsb2)&3)] - ( a1_2*w2 - a2_2*t2 );
+
+			w0 *= a2_0;
+			w1 *= a2_1;
+			w2 *= a2_2;
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = a2_2 + t2_2;
+
+			t1_0 = w0 + a1_0*t0;
+			t1_1 = w1 + a1_1*t1;
+			t1_2 = w2 + a1_2*t2;
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+n0];
+			t1_1 += __vlibm_TBL_sincos_lo[j1+n1];
+			t1_2 += __vlibm_TBL_sincos_lo[j2+n2];
+
+			*py0 = a1_0 + t1_0;
+			*py1 = a1_1 + t1_1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 1:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			HI(&t1) = j1;
+			LO(&t0) = 0;
+			LO(&t1) = 0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb0 |= 1;
+			xsb1 |= 1;
+			a1_0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1_1 = __vlibm_TBL_sincos_hi[j1+n1];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)];
+			a2_1 = __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)];
+
+			t2_0 = __vlibm_TBL_sincos_lo[j0+((n0+xsb0)&3)] - ( a1_0*w0 - a2_0*t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+((n1+xsb1)&3)] - ( a1_1*w1 - a2_1*t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*pc0 = a2_0 + t2_0;
+			*pc1 = a2_1 + t2_1;
+			*py2 = t2;
+
+			n2 = (n2 + 1) & 3;
+			j2 = (j2 + 1) & 1;
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+n0];
+			t1_1 += __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*py0 = a1_0 + t1_0;
+			*py1 = a1_1 + t1_1;
+			*pc2 = t2;
+
+			break;
+
+		case 2:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			HI(&t2) = j2;
+			LO(&t0) = 0;
+			LO(&t2) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb0 |= 1;
+			xsb2 |= 1;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a1_2 = __vlibm_TBL_sincos_hi[j2+n2];
+
+			a2_0 = __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)];
+
+			t2_0 = __vlibm_TBL_sincos_lo[j0+((n0+xsb0)&3)] - ( a1_0*w0 - a2_0*t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+((n2+xsb2)&3)] - ( a1_2*w2 - a2_2*t2 );
+
+			*pc0 = a2_0 + t2_0;
+			*py1 = t1;
+			*pc2 = a2_2 + t2_2;
+
+			n1 = (n1 + 1) & 3;
+			j1 = (j1 + 1) & 1;
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t1_2 += __vlibm_TBL_sincos_lo[j2+n2];
+
+			*py0 = a1_0 + t1_0;
+			*pc1 = t1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 3:
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			x0 = ( x0 - t0 ) + y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+
+			a1_0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a2_0 = __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)];
+
+			t2_0 = __vlibm_TBL_sincos_lo[j0+((n0+xsb0)&3)] - ( a1_0*w0 - a2_0*t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*pc0 = a2_0 + t2_0;
+			*py1 = t1;
+			*py2 = t2;
+
+			n1 = (n1 + 1) & 3;
+			n2 = (n2 + 1) & 3;
+			j1 = (j1 + 1) & 1;
+			j2 = (j2 + 1) & 1;
+
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+
+			t1_0 += __vlibm_TBL_sincos_lo[j0+n0];
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*py0 = a1_0 + t1_0;
+			*pc1 = t1;
+			*pc2 = t2;
+
+			break;
+
+		case 4:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t1) = j1;
+			HI(&t2) = j2;
+			LO(&t1) = 0;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb1 |= 1;
+			xsb2 |= 1;
+
+			a1_1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a1_2 = __vlibm_TBL_sincos_hi[j2+n2];
+
+			a2_1 = __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)];
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+((n1+xsb1)&3)] - ( a1_1*w1 - a2_1*t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+((n2+xsb2)&3)] - ( a1_2*w2 - a2_2*t2 );
+
+			*py0 = t0;
+			*pc1 = a2_1 + t2_1;
+			*pc2 = a2_2 + t2_2;
+
+			n0 = (n0 + 1) & 3;
+			j0 = (j0 + 1) & 1;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1_1 += __vlibm_TBL_sincos_lo[j1+n1];
+			t1_2 += __vlibm_TBL_sincos_lo[j2+n2];
+
+			*py1 = a1_1 + t1_1;
+			*py2 = a1_2 + t1_2;
+			*pc0 = t0;
+
+			break;
+
+		case 5:
+			j0 = n0 & 1;
+			j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+			j2 = n2 & 1;
+			HI(&t1) = j1;
+			LO(&t1) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			x1 = ( x1 - t1 ) + y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( qq1 + z1 * qq2 );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb1 = ( xsb1 >> 30 ) & 2;
+			n1 ^= ( xsb1 & ~( n1 << 1 ) );
+			xsb1 |= 1;
+
+			a1_1 = __vlibm_TBL_sincos_hi[j1+n1];
+			a2_1 = __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)];
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t2_1 = __vlibm_TBL_sincos_lo[j1+((n1+xsb1)&3)] - ( a1_1*w1 - a2_1*t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*py0 = t0;
+			*pc1 = a2_1 + t2_1;
+			*py2 = t2;
+
+			n0 = (n0 + 1) & 3;
+			n2 = (n2 + 1) & 3;
+			j0 = (j0 + 1) & 1;
+			j2 = (j2 + 1) & 1;
+
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1_1 = a2_1*w1 + a1_1*t1;
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1_1 += __vlibm_TBL_sincos_lo[j1+n1];
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+
+			*pc0 = t0;
+			*py1 = a1_1 + t1_1;
+			*pc2 = t2;
+
+			break;
+
+		case 6:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = ( xsb2 + 0x4000 ) & 0xffff8000;
+			HI(&t2) = j2;
+			LO(&t2) = 0;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			x2 = ( x2 - t2 ) + y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( qq1 + z2 * qq2 );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			w2 = x2 * ( one + z2 * ( pp1 + z2 * pp2 ) );
+			j2 = ( ( ( j2 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb2 = ( xsb2 >> 30 ) & 2;
+			n2 ^= ( xsb2 & ~( n2 << 1 ) );
+			xsb2 |= 1;
+
+			a1_2 = __vlibm_TBL_sincos_hi[j2+n2];
+			a2_2 = __vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)];
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2_2 = __vlibm_TBL_sincos_lo[j2+((n2+xsb2)&3)] - ( a1_2*w2 - a2_2*t2 );
+
+			*py0 = t0;
+			*py1 = t1;
+			*pc2 = a2_2 + t2_2;
+
+			n0 = (n0 + 1) & 3;
+			n1 = (n1 + 1) & 3;
+			j0 = (j0 + 1) & 1;
+			j1 = (j1 + 1) & 1;
+
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t1_2 = a2_2*w2 + a1_2*t2;
+
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t1_2 += __vlibm_TBL_sincos_lo[j2+n2];
+
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+
+			*pc0 = t0;
+			*pc1 = t1;
+			*py2 = a1_2 + t1_2;
+
+			break;
+
+		case 7:
+			j0 = n0 & 1;
+			j1 = n1 & 1;
+			j2 = n2 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			x1_or_one[0] = x1;
+			x1_or_one[2] = -x1;
+			x2_or_one[0] = x2;
+			x2_or_one[2] = -x2;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			y1_or_zero[0] = y1;
+			y1_or_zero[2] = -y1;
+			y2_or_zero[0] = y2;
+			y2_or_zero[2] = -y2;
+			z0 = x0 * x0;
+			z1 = x1 * x1;
+			z2 = x2 * x2;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*py0 = t0;
+			*py1 = t1;
+			*py2 = t2;
+
+			n0 = (n0 + 1) & 3;
+			n1 = (n1 + 1) & 3;
+			n2 = (n2 + 1) & 3;
+			j0 = (j0 + 1) & 1;
+			j1 = (j1 + 1) & 1;
+			j2 = (j2 + 1) & 1;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+			t2 = z2 * ( poly3[j2] + z2 * poly4[j2] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+			t2 = z2 * ( poly1[j2] + z2 * ( poly2[j2] + t2 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+			t2 = x2_or_one[n2] + ( y2_or_zero[n2] + x2_or_one[n2] * t2 );
+			*pc0 = t0;
+			*pc1 = t1;
+			*pc2 = t2;
+			break;
+		}
+
+		x += stridex;
+		y += stridey;
+		c += stridec;
+		i = 0;
+	} while ( --n > 0 );
+
+	if ( i > 0 )
+	{
+		double		a1_0, a1_1, a2_0, a2_1;
+		double		t0, t1, t1_0, t1_1, t2_0, t2_1;
+		double		fn0, fn1, a0, a1, w0, w1, y0, y1;
+		double		z0, z1;
+		unsigned	j0, j1;
+		int		n0, n1;
+
+		if ( i > 1 )
+		{
+			n1 = (int) ( x1 * invpio2 + half[xsb1] );
+			fn1 = (double) n1;
+			n1 &= 3;
+			a1 = x1 - fn1 * pio2_1;
+			w1 = fn1 * pio2_2;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3 - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			a1 = x1;
+			w1 = fn1 * pio2_3t - y1;
+			x1 = a1 - w1;
+			y1 = ( a1 - x1 ) - w1;
+			xsb1 = HI(&x1);
+			if ( ( xsb1 & ~0x80000000 ) < 0x3fc40000 )
+			{
+				j1 = n1 & 1;
+				x1_or_one[0] = x1;
+				x1_or_one[2] = -x1;
+				y1_or_zero[0] = y1;
+				y1_or_zero[2] = -y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+				t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+				t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+				*py1 = t1;
+				n1 = (n1 + 1) & 3;
+				j1 = (j1 + 1) & 1;
+				t1 = z1 * ( poly3[j1] + z1 * poly4[j1] );
+				t1 = z1 * ( poly1[j1] + z1 * ( poly2[j1] + t1 ) );
+				t1 = x1_or_one[n1] + ( y1_or_zero[n1] + x1_or_one[n1] * t1 );
+				*pc1 = t1;
+			}
+			else
+			{
+				j1 = ( xsb1 + 0x4000 ) & 0xffff8000;
+				HI(&t1) = j1;
+				LO(&t1) = 0;
+				x1 = ( x1 - t1 ) + y1;
+				z1 = x1 * x1;
+				t1 = z1 * ( qq1 + z1 * qq2 );
+				w1 = x1 * ( one + z1 * ( pp1 + z1 * pp2 ) );
+				j1 = ( ( ( j1 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+				xsb1 = ( xsb1 >> 30 ) & 2;
+				n1 ^= ( xsb1 & ~( n1 << 1 ) );
+				xsb1 |= 1;
+				a1_1 = __vlibm_TBL_sincos_hi[j1+n1];
+				a2_1 = __vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)];
+				t2_1 = __vlibm_TBL_sincos_lo[j1+((n1+xsb1)&3)] - ( a1_1*w1 - a2_1*t1 );
+				*pc1 = a2_1 + t2_1;
+				t1_1 = a2_1*w1 + a1_1*t1;
+				t1_1 += __vlibm_TBL_sincos_lo[j1+n1];
+				*py1 = a1_1 + t1_1;
+			}
+		}
+		n0 = (int) ( x0 * invpio2 + half[xsb0] );
+		fn0 = (double) n0;
+		n0 &= 3;
+		a0 = x0 - fn0 * pio2_1;
+		w0 = fn0 * pio2_2;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3 - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		a0 = x0;
+		w0 = fn0 * pio2_3t - y0;
+		x0 = a0 - w0;
+		y0 = ( a0 - x0 ) - w0;
+		xsb0 = HI(&x0);
+		if ( ( xsb0 & ~0x80000000 ) < 0x3fc40000 )
+		{
+			j0 = n0 & 1;
+			x0_or_one[0] = x0;
+			x0_or_one[2] = -x0;
+			y0_or_zero[0] = y0;
+			y0_or_zero[2] = -y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			*py0 = t0;
+			n0 = (n0 + 1) & 3;
+			j0 = (j0 + 1) & 1;
+			t0 = z0 * ( poly3[j0] + z0 * poly4[j0] );
+			t0 = z0 * ( poly1[j0] + z0 * ( poly2[j0] + t0 ) );
+			t0 = x0_or_one[n0] + ( y0_or_zero[n0] + x0_or_one[n0] * t0 );
+			*pc0 = t0;
+		}
+		else
+		{
+			j0 = ( xsb0 + 0x4000 ) & 0xffff8000;
+			HI(&t0) = j0;
+			LO(&t0) = 0;
+			x0 = ( x0 - t0 ) + y0;
+			z0 = x0 * x0;
+			t0 = z0 * ( qq1 + z0 * qq2 );
+			w0 = x0 * ( one + z0 * ( pp1 + z0 * pp2 ) );
+			j0 = ( ( ( j0 & ~0x80000000 ) - 0x3fc40000 ) >> 13 ) & ~0x3;
+			xsb0 = ( xsb0 >> 30 ) & 2;
+			n0 ^= ( xsb0 & ~( n0 << 1 ) );
+			xsb0 |= 1;
+			a1_0 = __vlibm_TBL_sincos_hi[j0+n0];
+			a2_0 = __vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)];
+			t2_0 = __vlibm_TBL_sincos_lo[j0+((n0+xsb0)&3)] - ( a1_0*w0 - a2_0*t0 );
+			*pc0 = a2_0 + t2_0;
+			t1_0 = a2_0*w0 + a1_0*t0;
+			t1_0 += __vlibm_TBL_sincos_lo[j0+n0];
+			*py0 = a1_0 + t1_0;
+		}
+	}
+
+	if ( biguns ) {
+		__vlibm_vsincos_big( nsave, xsave, sxsave, ysave, sysave, csave, scsave, 0x413921fb );
+	}
+}
--- old/usr/src/tools/cw/cw.c	Thu Oct  9 19:48:55 2014
+++ new/usr/src/tools/cw/cw.c	Thu Oct  9 19:48:55 2014
@@ -20,6 +20,9 @@
  */
 
 /*
+ * Copyright 2011, Richard Lowe.
+ */
+/*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -33,7 +36,7 @@
  */
 
 /* If you modify this file, you must increment CW_VERSION */
-#define	CW_VERSION	"1.29"
+#define	CW_VERSION	"1.30"
 
 /*
  * -#		Verbose mode
@@ -392,6 +395,8 @@
 	{ "amd64",	(SS11|M64), { "-m64", "-mtune=opteron" } },
 	{ "386",	SS11,	{ "-march=i386" } },
 	{ "pentium_pro", SS11,	{ "-march=pentiumpro" } },
+	{ "sse",	SS11, { "-msse", "-mfpmath=sse" } },
+	{ "sse2",	SS11, { "-msse2", "-mfpmath=sse" } },
 #elif defined(__sparc)
 	{ "generic",	(SS11|M32), { "-m32", "-mcpu=v8" } },
 	{ "generic64",	(SS11|M64), { "-m64", "-mcpu=v9" } },
--- old/usr/src/uts/common/sys/ccompile.h	Thu Oct  9 19:48:56 2014
+++ new/usr/src/uts/common/sys/ccompile.h	Thu Oct  9 19:48:56 2014
@@ -139,6 +139,7 @@
 #define	__RETURNS_TWICE		__sun_attr__((__returns_twice__))
 #define	__CONST			__sun_attr__((__const__))
 #define	__PURE			__sun_attr__((__pure__))
+#define	__GNU_UNUSED	__attribute__((__unused__))
 
 #ifdef	__cplusplus
 }
