summaryrefslogtreecommitdiff
path: root/usr/src/head
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/head')
-rw-r--r--usr/src/head/Makefile9
-rw-r--r--usr/src/head/complex.h134
-rw-r--r--usr/src/head/fenv.h247
-rw-r--r--usr/src/head/floatingpoint.h212
-rw-r--r--usr/src/head/iso/math_c99.h530
-rw-r--r--usr/src/head/iso/math_iso.h232
-rw-r--r--usr/src/head/math.h351
-rw-r--r--usr/src/head/tgmath.h171
8 files changed, 1886 insertions, 0 deletions
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile
index 72e2224afc..d13946c1b9 100644
--- a/usr/src/head/Makefile
+++ b/usr/src/head/Makefile
@@ -19,6 +19,8 @@
# CDDL HEADER END
#
#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -49,6 +51,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
assert.h \
atomic.h \
attr.h \
+ complex.h \
config_admin.h \
cpio.h \
crypt.h \
@@ -70,7 +73,9 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
execinfo.h \
fatal.h \
fcntl.h \
+ fenv.h \
float.h \
+ floatingpoint.h \
fmtmsg.h \
fnmatch.h \
ftw.h \
@@ -101,6 +106,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
locale.h \
macros.h \
malloc.h \
+ math.h \
mdmn_changelog.h \
memory.h \
meta.h \
@@ -182,6 +188,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
tar.h \
termio.h \
termios.h \
+ tgmath.h \
thread.h \
thread_db.h \
time.h \
@@ -214,6 +221,8 @@ ISOHDRS = \
ctype_iso.h \
limits_iso.h \
locale_iso.h \
+ math_c99.h \
+ math_iso.h \
setjmp_iso.h \
signal_iso.h \
stdarg_c99.h \
diff --git a/usr/src/head/complex.h b/usr/src/head/complex.h
new file mode 100644
index 0000000000..eaa2da8401
--- /dev/null
+++ b/usr/src/head/complex.h
@@ -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 */
diff --git a/usr/src/head/fenv.h b/usr/src/head/fenv.h
new file mode 100644
index 0000000000..66a2163b6d
--- /dev/null
+++ b/usr/src/head/fenv.h
@@ -0,0 +1,247 @@
+/*
+ * 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 _FENV_H
+#define _FENV_H
+
+#include <sys/feature_tests.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(p) p
+#else
+#define __P(p) ()
+#endif
+#endif /* !defined(__P) */
+
+/*
+ * Rounding modes
+ */
+#if defined(__sparc)
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+
+#elif defined(__i386) || defined(__amd64)
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 1
+#define FE_UPWARD 2
+#define FE_TOWARDZERO 3
+
+#endif
+
+extern int fegetround __P((void));
+extern int fesetround __P((int));
+
+#if (defined(__i386) || defined(__amd64)) && \
+ (!defined(_STRICT_STDC) || defined(__EXTENSIONS__))
+
+#define FE_FLTPREC 0
+#define FE_DBLPREC 2
+#define FE_LDBLPREC 3
+
+extern int fegetprec __P((void));
+extern int fesetprec __P((int));
+
+#endif
+
+/*
+ * Exception flags
+ */
+#if defined(__sparc)
+
+#define FE_INEXACT 0x01
+#define FE_DIVBYZERO 0x02
+#define FE_UNDERFLOW 0x04
+#define FE_OVERFLOW 0x08
+#define FE_INVALID 0x10
+#define FE_ALL_EXCEPT 0x1f
+
+#elif defined(__i386) || defined(__amd64)
+
+#define FE_INVALID 0x01
+#define FE_DIVBYZERO 0x04
+#define FE_OVERFLOW 0x08
+#define FE_UNDERFLOW 0x10
+#define FE_INEXACT 0x20
+#define FE_ALL_EXCEPT 0x3d
+
+#endif
+
+typedef int fexcept_t;
+
+extern int feclearexcept __P((int));
+extern int feraiseexcept __P((int));
+extern int fetestexcept __P((int));
+extern int fegetexceptflag __P((fexcept_t *, int));
+extern int fesetexceptflag __P((const fexcept_t *, int));
+
+#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
+
+/*
+ * Exception handling extensions
+ */
+#define FEX_NOHANDLER -1
+#define FEX_NONSTOP 0
+#define FEX_ABORT 1
+#define FEX_SIGNAL 2
+#define FEX_CUSTOM 3
+
+#define FEX_INEXACT 0x001
+#define FEX_DIVBYZERO 0x002
+#define FEX_UNDERFLOW 0x004
+#define FEX_OVERFLOW 0x008
+#define FEX_INV_ZDZ 0x010
+#define FEX_INV_IDI 0x020
+#define FEX_INV_ISI 0x040
+#define FEX_INV_ZMI 0x080
+#define FEX_INV_SQRT 0x100
+#define FEX_INV_SNAN 0x200
+#define FEX_INV_INT 0x400
+#define FEX_INV_CMP 0x800
+#define FEX_INVALID 0xff0
+#define FEX_COMMON (FEX_INVALID | FEX_DIVBYZERO | FEX_OVERFLOW)
+#define FEX_ALL (FEX_COMMON | FEX_UNDERFLOW | FEX_INEXACT)
+#define FEX_NONE 0
+
+#define FEX_NUM_EXC 12
+
+/* structure to hold a numeric value in any format used by the FPU */
+typedef struct {
+ enum fex_nt {
+ fex_nodata = 0,
+ fex_int = 1,
+ fex_llong = 2,
+ fex_float = 3,
+ fex_double = 4,
+ fex_ldouble = 5
+ } type;
+ union {
+ int i;
+#if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \
+ defined(__C99FEATURES__)
+ long long l;
+#else
+ struct {
+ int l[2];
+ } l;
+#endif
+ float f;
+ double d;
+ long double q;
+ } val;
+} fex_numeric_t;
+
+/* structure to supply information about an exception to a custom handler */
+typedef struct {
+ enum fex_op {
+ fex_add = 0,
+ fex_sub = 1,
+ fex_mul = 2,
+ fex_div = 3,
+ fex_sqrt = 4,
+ fex_cnvt = 5,
+ fex_cmp = 6,
+ fex_other = 7
+ } op; /* operation that caused the exception */
+ int flags; /* flags to be set */
+ fex_numeric_t op1, op2, res; /* operands and result */
+} fex_info_t;
+
+typedef struct fex_handler_data {
+ int __mode;
+ void (*__handler)();
+} fex_handler_t[FEX_NUM_EXC];
+
+extern int fex_get_handling __P((int));
+extern int fex_set_handling __P((int, int, void (*)()));
+
+extern void fex_getexcepthandler __P((fex_handler_t *, int));
+extern void fex_setexcepthandler __P((const fex_handler_t *, int));
+
+#ifdef __STDC__
+#include <stdio_tag.h>
+#ifndef _FILEDEFED
+#define _FILEDEFED
+typedef __FILE FILE;
+#endif
+#endif
+extern FILE *fex_get_log __P((void));
+extern int fex_set_log __P((FILE *));
+extern int fex_get_log_depth __P((void));
+extern int fex_set_log_depth __P((int));
+extern void fex_log_entry __P((const char *));
+
+#define __fex_handler_t fex_handler_t
+
+#else
+
+typedef struct {
+ int __mode;
+ void (*__handler)();
+} __fex_handler_t[12];
+
+#endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */
+
+/*
+ * Environment as a whole
+ */
+typedef struct {
+ __fex_handler_t __handlers;
+ unsigned long __fsr;
+} fenv_t;
+
+#ifdef __STDC__
+extern const fenv_t __fenv_dfl_env;
+#else
+extern fenv_t __fenv_dfl_env;
+#endif
+
+#define FE_DFL_ENV (&__fenv_dfl_env)
+
+extern int fegetenv __P((fenv_t *));
+extern int fesetenv __P((const fenv_t *));
+extern int feholdexcept __P((fenv_t *));
+extern int feupdateenv __P((const fenv_t *));
+
+#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
+extern void fex_merge_flags __P((const fenv_t *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FENV_H */
diff --git a/usr/src/head/floatingpoint.h b/usr/src/head/floatingpoint.h
new file mode 100644
index 0000000000..c774303e65
--- /dev/null
+++ b/usr/src/head/floatingpoint.h
@@ -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 */
diff --git a/usr/src/head/iso/math_c99.h b/usr/src/head/iso/math_c99.h
new file mode 100644
index 0000000000..72c4b30fc0
--- /dev/null
+++ b/usr/src/head/iso/math_c99.h
@@ -0,0 +1,530 @@
+/*
+ * 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.
+ */
+
+#ifndef _ISO_MATH_C99_H
+#define _ISO_MATH_C99_H
+
+#include <sys/isa_defs.h>
+#include <sys/feature_tests.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(p) p
+#else
+#define __P(p) ()
+#endif
+#endif /* !defined(__P) */
+
+#if defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || defined(__C99FEATURES__)
+#if defined(__GNUC__)
+#undef HUGE_VAL
+#define HUGE_VAL (__builtin_huge_val())
+#undef HUGE_VALF
+#define HUGE_VALF (__builtin_huge_valf())
+#undef HUGE_VALL
+#define HUGE_VALL (__builtin_huge_vall())
+#undef INFINITY
+#define INFINITY (__builtin_inff())
+#undef NAN
+#define NAN (__builtin_nanf(""))
+
+/*
+ * C99 7.12.3 classification macros
+ */
+#undef isnan
+#undef isinf
+#if __GNUC__ >= 4
+#define isnan(x) __builtin_isnan(x)
+#define isinf(x) __builtin_isinf(x)
+#else
+#define isnan(x) __extension__( \
+ { __typeof(x) __x_n = (x); \
+ __builtin_isunordered(__x_n, __x_n); })
+#define isinf(x) __extension__( \
+ { __typeof(x) __x_i = (x); \
+ __x_i == (__typeof(__x_i)) INFINITY || \
+ __x_i == (__typeof(__x_i)) (-INFINITY); })
+#endif
+#undef isfinite
+#define isfinite(x) __extension__( \
+ { __typeof(x) __x_f = (x); \
+ !isnan(__x_f) && !isinf(__x_f); })
+#undef isnormal
+#define isnormal(x) __extension__( \
+ { __typeof(x) __x_r = (x); isfinite(__x_r) && \
+ (sizeof (__x_r) == sizeof (float) ? \
+ __builtin_fabsf(__x_r) >= __FLT_MIN__ : \
+ sizeof (__x_r) == sizeof (double) ? \
+ __builtin_fabs(__x_r) >= __DBL_MIN__ : \
+ __builtin_fabsl(__x_r) >= __LDBL_MIN__); })
+#undef fpclassify
+#define fpclassify(x) __extension__( \
+ { __typeof(x) __x_c = (x); \
+ isnan(__x_c) ? FP_NAN : \
+ isinf(__x_c) ? FP_INFINITE : \
+ isnormal(__x_c) ? FP_NORMAL : \
+ __x_c == (__typeof(__x_c)) 0 ? FP_ZERO : \
+ FP_SUBNORMAL; })
+#undef signbit
+#if defined(_BIG_ENDIAN)
+#define signbit(x) __extension__( \
+ { __typeof(x) __x_s = (x); \
+ (int) (*(unsigned *) &__x_s >> 31); })
+#elif defined(_LITTLE_ENDIAN)
+#define signbit(x) __extension__( \
+ { __typeof(x) __x_s = (x); \
+ (sizeof (__x_s) == sizeof (float) ? \
+ (int) (*(unsigned *) &__x_s >> 31) : \
+ sizeof (__x_s) == sizeof (double) ? \
+ (int) (((unsigned *) &__x_s)[1] >> 31) : \
+ (int) (((unsigned short *) &__x_s)[4] >> 15)); })
+#endif
+
+/*
+ * C99 7.12.14 comparison macros
+ */
+#undef isgreater
+#define isgreater(x, y) __builtin_isgreater(x, y)
+#undef isgreaterequal
+#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
+#undef isless
+#define isless(x, y) __builtin_isless(x, y)
+#undef islessequal
+#define islessequal(x, y) __builtin_islessequal(x, y)
+#undef islessgreater
+#define islessgreater(x, y) __builtin_islessgreater(x, y)
+#undef isunordered
+#define isunordered(x, y) __builtin_isunordered(x, y)
+#else /* defined(__GNUC__) */
+#undef HUGE_VAL
+#define HUGE_VAL __builtin_huge_val
+#undef HUGE_VALF
+#define HUGE_VALF __builtin_huge_valf
+#undef HUGE_VALL
+#define HUGE_VALL __builtin_huge_vall
+#undef INFINITY
+#define INFINITY __builtin_infinity
+#undef NAN
+#define NAN __builtin_nan
+
+/*
+ * C99 7.12.3 classification macros
+ */
+#undef fpclassify
+#define fpclassify(x) __builtin_fpclassify(x)
+#undef isfinite
+#define isfinite(x) __builtin_isfinite(x)
+#undef isinf
+#define isinf(x) __builtin_isinf(x)
+#undef isnan
+#define isnan(x) __builtin_isnan(x)
+#undef isnormal
+#define isnormal(x) __builtin_isnormal(x)
+#undef signbit
+#define signbit(x) __builtin_signbit(x)
+
+/*
+ * C99 7.12.14 comparison macros
+ */
+#undef isgreater
+#define isgreater(x, y) ((x) __builtin_isgreater(y))
+#undef isgreaterequal
+#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))
+#undef isless
+#define isless(x, y) ((x) __builtin_isless(y))
+#undef islessequal
+#define islessequal(x, y) ((x) __builtin_islessequal(y))
+#undef islessgreater
+#define islessgreater(x, y) ((x) __builtin_islessgreater(y))
+#undef isunordered
+#define isunordered(x, y) ((x) __builtin_isunordered(y))
+#endif /* defined(__GNUC__) */
+#endif /* defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || ... */
+
+#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \
+ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
+ defined(__C99FEATURES__)
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ - 0 == 0
+typedef float float_t;
+typedef double double_t;
+#elif __FLT_EVAL_METHOD__ - 0 == 1
+typedef double float_t;
+typedef double double_t;
+#elif __FLT_EVAL_METHOD__ - 0 == 2
+typedef long double float_t;
+typedef long double double_t;
+#elif defined(__sparc) || defined(__amd64)
+typedef float float_t;
+typedef double double_t;
+#elif defined(__i386)
+typedef long double float_t;
+typedef long double double_t;
+#endif
+
+#undef FP_ZERO
+#define FP_ZERO 0
+#undef FP_SUBNORMAL
+#define FP_SUBNORMAL 1
+#undef FP_NORMAL
+#define FP_NORMAL 2
+#undef FP_INFINITE
+#define FP_INFINITE 3
+#undef FP_NAN
+#define FP_NAN 4
+
+#undef FP_ILOGB0
+#define FP_ILOGB0 (-2147483647)
+#undef FP_ILOGBNAN
+#define FP_ILOGBNAN 2147483647
+
+#undef MATH_ERRNO
+#define MATH_ERRNO 1
+#undef MATH_ERREXCEPT
+#define MATH_ERREXCEPT 2
+#undef math_errhandling
+#define math_errhandling MATH_ERREXCEPT
+
+extern double acosh __P((double));
+extern double asinh __P((double));
+extern double atanh __P((double));
+
+extern double exp2 __P((double));
+extern double expm1 __P((double));
+extern int ilogb __P((double));
+extern double log1p __P((double));
+extern double log2 __P((double));
+extern double logb __P((double));
+extern double scalbn __P((double, int));
+extern double scalbln __P((double, long int));
+
+extern double cbrt __P((double));
+extern double hypot __P((double, double));
+
+extern double erf __P((double));
+extern double erfc __P((double));
+extern double lgamma __P((double));
+extern double tgamma __P((double));
+
+extern double nearbyint __P((double));
+extern double rint __P((double));
+extern long int lrint __P((double));
+extern double round __P((double));
+extern long int lround __P((double));
+extern double trunc __P((double));
+
+extern double remainder __P((double, double));
+extern double remquo __P((double, double, int *));
+
+extern double copysign __P((double, double));
+extern double nan __P((const char *));
+extern double nextafter __P((double, double));
+extern double nexttoward __P((double, long double));
+
+extern double fdim __P((double, double));
+extern double fmax __P((double, double));
+extern double fmin __P((double, double));
+
+extern double fma __P((double, double, double));
+
+extern float acosf __P((float));
+extern float asinf __P((float));
+extern float atanf __P((float));
+extern float atan2f __P((float, float));
+extern float cosf __P((float));
+extern float sinf __P((float));
+extern float tanf __P((float));
+
+extern float acoshf __P((float));
+extern float asinhf __P((float));
+extern float atanhf __P((float));
+extern float coshf __P((float));
+extern float sinhf __P((float));
+extern float tanhf __P((float));
+
+extern float expf __P((float));
+extern float exp2f __P((float));
+extern float expm1f __P((float));
+extern float frexpf __P((float, int *));
+extern int ilogbf __P((float));
+extern float ldexpf __P((float, int));
+extern float logf __P((float));
+extern float log10f __P((float));
+extern float log1pf __P((float));
+extern float log2f __P((float));
+extern float logbf __P((float));
+extern float modff __P((float, float *));
+extern float scalbnf __P((float, int));
+extern float scalblnf __P((float, long int));
+
+extern float cbrtf __P((float));
+extern float fabsf __P((float));
+extern float hypotf __P((float, float));
+extern float powf __P((float, float));
+extern float sqrtf __P((float));
+
+extern float erff __P((float));
+extern float erfcf __P((float));
+extern float lgammaf __P((float));
+extern float tgammaf __P((float));
+
+extern float ceilf __P((float));
+extern float floorf __P((float));
+extern float nearbyintf __P((float));
+extern float rintf __P((float));
+extern long int lrintf __P((float));
+extern float roundf __P((float));
+extern long int lroundf __P((float));
+extern float truncf __P((float));
+
+extern float fmodf __P((float, float));
+extern float remainderf __P((float, float));
+extern float remquof __P((float, float, int *));
+
+extern float copysignf __P((float, float));
+extern float nanf __P((const char *));
+extern float nextafterf __P((float, float));
+extern float nexttowardf __P((float, long double));
+
+extern float fdimf __P((float, float));
+extern float fmaxf __P((float, float));
+extern float fminf __P((float, float));
+
+extern float fmaf __P((float, float, float));
+
+extern long double acosl __P((long double));
+extern long double asinl __P((long double));
+extern long double atanl __P((long double));
+extern long double atan2l __P((long double, long double));
+extern long double cosl __P((long double));
+extern long double sinl __P((long double));
+extern long double tanl __P((long double));
+
+extern long double acoshl __P((long double));
+extern long double asinhl __P((long double));
+extern long double atanhl __P((long double));
+extern long double coshl __P((long double));
+extern long double sinhl __P((long double));
+extern long double tanhl __P((long double));
+
+extern long double expl __P((long double));
+extern long double exp2l __P((long double));
+extern long double expm1l __P((long double));
+extern long double frexpl __P((long double, int *));
+extern int ilogbl __P((long double));
+extern long double ldexpl __P((long double, int));
+extern long double logl __P((long double));
+extern long double log10l __P((long double));
+extern long double log1pl __P((long double));
+extern long double log2l __P((long double));
+extern long double logbl __P((long double));
+extern long double modfl __P((long double, long double *));
+extern long double scalbnl __P((long double, int));
+extern long double scalblnl __P((long double, long int));
+
+extern long double cbrtl __P((long double));
+extern long double fabsl __P((long double));
+extern long double hypotl __P((long double, long double));
+extern long double powl __P((long double, long double));
+extern long double sqrtl __P((long double));
+
+extern long double erfl __P((long double));
+extern long double erfcl __P((long double));
+extern long double lgammal __P((long double));
+extern long double tgammal __P((long double));
+
+extern long double ceill __P((long double));
+extern long double floorl __P((long double));
+extern long double nearbyintl __P((long double));
+extern long double rintl __P((long double));
+extern long int lrintl __P((long double));
+extern long double roundl __P((long double));
+extern long int lroundl __P((long double));
+extern long double truncl __P((long double));
+
+extern long double fmodl __P((long double, long double));
+extern long double remainderl __P((long double, long double));
+extern long double remquol __P((long double, long double, int *));
+
+extern long double copysignl __P((long double, long double));
+extern long double nanl __P((const char *));
+extern long double nextafterl __P((long double, long double));
+extern long double nexttowardl __P((long double, long double));
+
+extern long double fdiml __P((long double, long double));
+extern long double fmaxl __P((long double, long double));
+extern long double fminl __P((long double, long double));
+
+extern long double fmal __P((long double, long double, long double));
+
+#if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \
+ defined(__C99FEATURES__)
+extern long long int llrint __P((double));
+extern long long int llround __P((double));
+
+extern long long int llrintf __P((float));
+extern long long int llroundf __P((float));
+
+extern long long int llrintl __P((long double));
+extern long long int llroundl __P((long double));
+#endif
+
+#if !defined(__cplusplus)
+#pragma does_not_read_global_data(asinh, exp2, expm1)
+#pragma does_not_read_global_data(ilogb, log2)
+#pragma does_not_read_global_data(scalbn, scalbln, cbrt)
+#pragma does_not_read_global_data(erf, erfc, tgamma)
+#pragma does_not_read_global_data(nearbyint, rint, lrint, round, lround, trunc)
+#pragma does_not_read_global_data(remquo)
+#pragma does_not_read_global_data(copysign, nan, nexttoward)
+#pragma does_not_read_global_data(fdim, fmax, fmin, fma)
+#pragma does_not_write_global_data(asinh, exp2, expm1)
+#pragma does_not_write_global_data(ilogb, log2)
+#pragma does_not_write_global_data(scalbn, scalbln, cbrt)
+#pragma does_not_write_global_data(erf, erfc, tgamma)
+#pragma does_not_write_global_data(nearbyint, rint, lrint, round, lround, trunc)
+#pragma does_not_write_global_data(copysign, nan, nexttoward)
+#pragma does_not_write_global_data(fdim, fmax, fmin, fma)
+
+#pragma does_not_read_global_data(acosf, asinf, atanf, atan2f)
+#pragma does_not_read_global_data(cosf, sinf, tanf)
+#pragma does_not_read_global_data(acoshf, asinhf, atanhf, coshf, sinhf, tanhf)
+#pragma does_not_read_global_data(expf, exp2f, expm1f, frexpf, ilogbf, ldexpf)
+#pragma does_not_read_global_data(logf, log10f, log1pf, log2f, logbf)
+#pragma does_not_read_global_data(modff, scalbnf, scalblnf)
+#pragma does_not_read_global_data(cbrtf, fabsf, hypotf, powf, sqrtf)
+#pragma does_not_read_global_data(erff, erfcf, lgammaf, tgammaf)
+#pragma does_not_read_global_data(ceilf, floorf, nearbyintf)
+#pragma does_not_read_global_data(rintf, lrintf, roundf, lroundf, truncf)
+#pragma does_not_read_global_data(fmodf, remainderf, remquof)
+#pragma does_not_read_global_data(copysignf, nanf, nextafterf, nexttowardf)
+#pragma does_not_read_global_data(fdimf, fmaxf, fminf, fmaf)
+#pragma does_not_write_global_data(acosf, asinf, atanf, atan2f)
+#pragma does_not_write_global_data(cosf, sinf, tanf)
+#pragma does_not_write_global_data(acoshf, asinhf, atanhf, coshf, sinhf, tanhf)
+#pragma does_not_write_global_data(expf, exp2f, expm1f, ilogbf, ldexpf)
+#pragma does_not_write_global_data(logf, log10f, log1pf, log2f, logbf)
+#pragma does_not_write_global_data(cbrtf, fabsf, hypotf, powf, sqrtf)
+#pragma does_not_write_global_data(erff, erfcf, tgammaf)
+#pragma does_not_write_global_data(ceilf, floorf, nearbyintf)
+#pragma does_not_write_global_data(rintf, lrintf, roundf, lroundf, truncf)
+#pragma does_not_write_global_data(fmodf, remainderf)
+#pragma does_not_write_global_data(copysignf, nanf, nextafterf, nexttowardf)
+#pragma does_not_write_global_data(fdimf, fmaxf, fminf, fmaf)
+
+#pragma does_not_read_global_data(acosl, asinl, atanl, atan2l)
+#pragma does_not_read_global_data(cosl, sinl, tanl)
+#pragma does_not_read_global_data(acoshl, asinhl, atanhl, coshl, sinhl, tanhl)
+#pragma does_not_read_global_data(expl, exp2l, expm1l, frexpl, ilogbl, ldexpl)
+#pragma does_not_read_global_data(logl, log10l, log1pl, log2l, logbl)
+#pragma does_not_read_global_data(modfl, scalbnl, scalblnl)
+#pragma does_not_read_global_data(cbrtl, fabsl, hypotl, powl, sqrtl)
+#pragma does_not_read_global_data(erfl, erfcl, lgammal, tgammal)
+#pragma does_not_read_global_data(ceill, floorl, nearbyintl)
+#pragma does_not_read_global_data(rintl, lrintl, roundl, lroundl, truncl)
+#pragma does_not_read_global_data(fmodl, remainderl, remquol)
+#pragma does_not_read_global_data(copysignl, nanl, nextafterl, nexttowardl)
+#pragma does_not_read_global_data(fdiml, fmaxl, fminl, fmal)
+#pragma does_not_write_global_data(acosl, asinl, atanl, atan2l)
+#pragma does_not_write_global_data(cosl, sinl, tanl)
+#pragma does_not_write_global_data(acoshl, asinhl, atanhl, coshl, sinhl, tanhl)
+#pragma does_not_write_global_data(expl, exp2l, expm1l, ilogbl, ldexpl)
+#pragma does_not_write_global_data(logl, log10l, log1pl, log2l, logbl)
+#pragma does_not_write_global_data(cbrtl, fabsl, hypotl, powl, sqrtl)
+#pragma does_not_write_global_data(erfl, erfcl, tgammal)
+#pragma does_not_write_global_data(ceill, floorl, nearbyintl)
+#pragma does_not_write_global_data(rintl, lrintl, roundl, lroundl, truncl)
+#pragma does_not_write_global_data(fmodl, remainderl)
+#pragma does_not_write_global_data(copysignl, nanl, nextafterl, nexttowardl)
+#pragma does_not_write_global_data(fdiml, fmaxl, fminl, fmal)
+
+#if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \
+ defined(__C99FEATURES__)
+#pragma does_not_read_global_data(llrint, llround)
+#pragma does_not_read_global_data(llrintf, llroundf, llrintl, llroundl)
+#pragma does_not_write_global_data(llrint, llround)
+#pragma does_not_write_global_data(llrintf, llroundf, llrintl, llroundl)
+#endif
+#endif /* !defined(__cplusplus) */
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(acosh, atanh, hypot, lgamma, log1p, logb)
+#pragma does_not_read_global_data(nextafter, remainder)
+#pragma does_not_write_global_data(acosh, atanh, hypot, log1p, logb)
+#pragma does_not_write_global_data(nextafter, remainder)
+
+#pragma no_side_effect(acosh, asinh, atanh, exp2, expm1)
+#pragma no_side_effect(ilogb, log1p, log2, logb)
+#pragma no_side_effect(scalbn, scalbln, cbrt, hypot)
+#pragma no_side_effect(erf, erfc, tgamma)
+#pragma no_side_effect(nearbyint, rint, lrint, round, lround, trunc)
+#pragma no_side_effect(remainder)
+#pragma no_side_effect(copysign, nan, nextafter, nexttoward)
+#pragma no_side_effect(fdim, fmax, fmin, fma)
+
+#pragma no_side_effect(acosf, asinf, atanf, atan2f)
+#pragma no_side_effect(cosf, sinf, tanf, coshf, sinhf, tanhf)
+#pragma no_side_effect(acoshf, asinhf, atanhf, coshf, sinhf, tanhf)
+#pragma no_side_effect(expf, exp2f, expm1f, ilogbf, ldexpf)
+#pragma no_side_effect(logf, log10f, log1pf, log2f, logbf)
+#pragma no_side_effect(cbrtf, fabsf, hypotf, powf, sqrtf)
+#pragma no_side_effect(erff, erfcf, tgammaf)
+#pragma no_side_effect(ceilf, floorf, nearbyintf)
+#pragma no_side_effect(rintf, lrintf, roundf, lroundf, truncf)
+#pragma no_side_effect(fmodf, remainderf)
+#pragma no_side_effect(copysignf, nanf, nextafterf, nexttowardf)
+#pragma no_side_effect(fdimf, fmaxf, fminf, fmaf)
+
+#pragma no_side_effect(acosl, asinl, atanl, atan2l)
+#pragma no_side_effect(cosl, sinl, tanl, coshl, sinhl, tanhl)
+#pragma no_side_effect(acoshl, asinhl, atanhl, coshl, sinhl, tanhl)
+#pragma no_side_effect(expl, exp2l, expm1l, ilogbl, ldexpl)
+#pragma no_side_effect(logl, log10l, log1pl, log2l, logbl)
+#pragma no_side_effect(cbrtl, fabsl, hypotl, powl, sqrtl)
+#pragma no_side_effect(erfl, erfcl, tgammal)
+#pragma no_side_effect(ceill, floorl, nearbyintl)
+#pragma no_side_effect(rintl, lrintl, roundl, lroundl, truncl)
+#pragma no_side_effect(fmodl, remainderl)
+#pragma no_side_effect(copysignl, nanl, nextafterl, nexttowardl)
+#pragma no_side_effect(fdiml, fmaxl, fminl, fmal)
+
+#if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \
+ defined(__C99FEATURES__)
+#pragma no_side_effect(llrint, llround, llrintf, llroundf, llrintl, llroundl)
+#endif
+#endif /* defined(__MATHERR_ERRNO_DONTCARE) */
+#endif /* defined(__EXTENSIONS__) || defined(_STDC_C99) || ... */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ISO_MATH_C99_H */
diff --git a/usr/src/head/iso/math_iso.h b/usr/src/head/iso/math_iso.h
new file mode 100644
index 0000000000..4ecb29fbf8
--- /dev/null
+++ b/usr/src/head/iso/math_iso.h
@@ -0,0 +1,232 @@
+/*
+ * 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 _ISO_MATH_ISO_H
+#define _ISO_MATH_ISO_H
+
+#include <sys/feature_tests.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(p) p
+#else
+#define __P(p) ()
+#endif
+#endif /* !defined(__P) */
+
+#if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__)
+typedef union _h_val {
+ unsigned long _i[sizeof (double) / sizeof (unsigned long)];
+ double _d;
+} _h_val;
+
+#ifdef __STDC__
+extern const _h_val __huge_val;
+#else
+extern _h_val __huge_val;
+#endif
+#undef HUGE_VAL
+#define HUGE_VAL __huge_val._d
+#endif /* !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && ... */
+
+#if __cplusplus >= 199711L
+namespace std {
+#endif
+
+extern double acos __P((double));
+extern double asin __P((double));
+extern double atan __P((double));
+extern double atan2 __P((double, double));
+extern double cos __P((double));
+extern double sin __P((double));
+extern double tan __P((double));
+
+extern double cosh __P((double));
+extern double sinh __P((double));
+extern double tanh __P((double));
+
+extern double exp __P((double));
+extern double frexp __P((double, int *));
+extern double ldexp __P((double, int));
+extern double log __P((double));
+extern double log10 __P((double));
+extern double modf __P((double, double *));
+
+extern double pow __P((double, double));
+extern double sqrt __P((double));
+
+extern double ceil __P((double));
+extern double fabs __P((double));
+extern double floor __P((double));
+extern double fmod __P((double, double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(acos, asin, atan, atan2)
+#pragma does_not_read_global_data(cos, sin, tan, cosh, sinh, tanh)
+#pragma does_not_read_global_data(exp, log, log10, pow, sqrt)
+#pragma does_not_read_global_data(frexp, ldexp, modf)
+#pragma does_not_read_global_data(ceil, fabs, floor, fmod)
+#pragma does_not_write_global_data(acos, asin, atan, atan2)
+#pragma does_not_write_global_data(cos, sin, tan, cosh, sinh, tanh)
+#pragma does_not_write_global_data(exp, log, log10, pow, sqrt)
+#pragma does_not_write_global_data(ldexp)
+#pragma does_not_write_global_data(ceil, fabs, floor, fmod)
+#pragma no_side_effect(acos, asin, atan, atan2)
+#pragma no_side_effect(cos, sin, tan, cosh, sinh, tanh)
+#pragma no_side_effect(exp, log, log10, pow, sqrt)
+#pragma no_side_effect(ldexp)
+#pragma no_side_effect(ceil, fabs, floor, fmod)
+#endif
+
+#if __cplusplus >= 199711L
+extern float __acosf(float);
+extern float __asinf(float);
+extern float __atanf(float);
+extern float __atan2f(float, float);
+extern float __ceilf(float);
+extern float __cosf(float);
+extern float __coshf(float);
+extern float __expf(float);
+extern float __fabsf(float);
+extern float __floorf(float);
+extern float __fmodf(float, float);
+extern float __frexpf(float, int *);
+extern float __ldexpf(float, int);
+extern float __logf(float);
+extern float __log10f(float);
+extern float __modff(float, float *);
+extern float __powf(float, float);
+extern float __sinf(float);
+extern float __sinhf(float);
+extern float __sqrtf(float);
+extern float __tanf(float);
+extern float __tanhf(float);
+
+extern long double __acosl(long double);
+extern long double __asinl(long double);
+extern long double __atanl(long double);
+extern long double __atan2l(long double, long double);
+extern long double __ceill(long double);
+extern long double __cosl(long double);
+extern long double __coshl(long double);
+extern long double __expl(long double);
+extern long double __fabsl(long double);
+extern long double __floorl(long double);
+extern long double __fmodl(long double, long double);
+extern long double __frexpl(long double, int *);
+extern long double __ldexpl(long double, int);
+extern long double __logl(long double);
+extern long double __log10l(long double);
+extern long double __modfl(long double, long double *);
+extern long double __powl(long double, long double);
+extern long double __sinl(long double);
+extern long double __sinhl(long double);
+extern long double __sqrtl(long double);
+extern long double __tanl(long double);
+extern long double __tanhl(long double);
+
+extern "C++" {
+#undef __X
+#undef __Y
+ inline double abs(double __X) { return fabs(__X); }
+ inline double pow(double __X, int __Y) { return
+ pow(__X, (double) (__Y)); }
+
+ inline float abs(float __X) { return __fabsf(__X); }
+ inline float acos(float __X) { return __acosf(__X); }
+ inline float asin(float __X) { return __asinf(__X); }
+ inline float atan(float __X) { return __atanf(__X); }
+ inline float atan2(float __X, float __Y) { return __atan2f(__X, __Y); }
+ inline float ceil(float __X) { return __ceilf(__X); }
+ inline float cos(float __X) { return __cosf(__X); }
+ inline float cosh(float __X) { return __coshf(__X); }
+ inline float exp(float __X) { return __expf(__X); }
+ inline float fabs(float __X) { return __fabsf(__X); }
+ inline float floor(float __X) { return __floorf(__X); }
+ inline float fmod(float __X, float __Y) { return __fmodf(__X, __Y); }
+ inline float frexp(float __X, int *__Y) { return __frexpf(__X, __Y); }
+ inline float ldexp(float __X, int __Y) { return __ldexpf(__X, __Y); }
+ inline float log(float __X) { return __logf(__X); }
+ inline float log10(float __X) { return __log10f(__X); }
+ inline float modf(float __X, float *__Y) { return __modff(__X, __Y); }
+ inline float pow(float __X, float __Y) { return __powf(__X, __Y); }
+ inline float pow(float __X, int __Y) { return
+ pow((double) (__X), (double) (__Y)); }
+ inline float sin(float __X) { return __sinf(__X); }
+ inline float sinh(float __X) { return __sinhf(__X); }
+ inline float sqrt(float __X) { return __sqrtf(__X); }
+ inline float tan(float __X) { return __tanf(__X); }
+ inline float tanh(float __X) { return __tanhf(__X); }
+
+ inline long double abs(long double __X) { return __fabsl(__X); }
+ inline long double acos(long double __X) { return __acosl(__X); }
+ inline long double asin(long double __X) { return __asinl(__X); }
+ inline long double atan(long double __X) { return __atanl(__X); }
+ inline long double atan2(long double __X, long double __Y) { return
+ __atan2l(__X, __Y); }
+ inline long double ceil(long double __X) { return __ceill(__X); }
+ inline long double cos(long double __X) { return __cosl(__X); }
+ inline long double cosh(long double __X) { return __coshl(__X); }
+ inline long double exp(long double __X) { return __expl(__X); }
+ inline long double fabs(long double __X) { return __fabsl(__X); }
+ inline long double floor(long double __X) { return __floorl(__X); }
+ inline long double fmod(long double __X, long double __Y) { return
+ __fmodl(__X, __Y); }
+ inline long double frexp(long double __X, int *__Y) { return
+ __frexpl(__X, __Y); }
+ inline long double ldexp(long double __X, int __Y) { return
+ __ldexpl(__X, __Y); }
+ inline long double log(long double __X) { return __logl(__X); }
+ inline long double log10(long double __X) { return __log10l(__X); }
+ inline long double modf(long double __X, long double *__Y) { return
+ __modfl(__X, __Y); }
+ inline long double pow(long double __X, long double __Y) { return
+ __powl(__X, __Y); }
+ inline long double pow(long double __X, int __Y) { return
+ __powl(__X, (long double) (__Y)); }
+ inline long double sin(long double __X) { return __sinl(__X); }
+ inline long double sinh(long double __X) { return __sinhl(__X); }
+ inline long double sqrt(long double __X) { return __sqrtl(__X); }
+ inline long double tan(long double __X) { return __tanl(__X); }
+ inline long double tanh(long double __X) { return __tanhl(__X); }
+} /* end of extern "C++" */
+#endif /* __cplusplus >= 199711L */
+
+#if __cplusplus >= 199711L
+} /* end of namespace std */
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ISO_MATH_ISO_H */
diff --git a/usr/src/head/math.h b/usr/src/head/math.h
new file mode 100644
index 0000000000..b28f42a907
--- /dev/null
+++ b/usr/src/head/math.h
@@ -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 2011 Nexenta Systems, Inc. All rights reserved.
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _MATH_H
+#define _MATH_H
+
+#include <iso/math_iso.h>
+#include <iso/math_c99.h>
+
+#if __cplusplus >= 199711L
+using std::abs;
+using std::acos;
+using std::asin;
+using std::atan2;
+using std::atan;
+using std::ceil;
+using std::cos;
+using std::cosh;
+using std::exp;
+using std::fabs;
+using std::floor;
+using std::fmod;
+using std::frexp;
+using std::ldexp;
+using std::log10;
+using std::log;
+using std::modf;
+using std::pow;
+using std::sin;
+using std::sinh;
+using std::sqrt;
+using std::tan;
+using std::tanh;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__cplusplus)
+#define exception __math_exception
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(p) p
+#else
+#define __P(p) ()
+#endif
+#endif /* !defined(__P) */
+
+#if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || \
+ !defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)
+/*
+ * SVID & X/Open
+ */
+#define M_E 2.7182818284590452354
+#define M_LOG2E 1.4426950408889634074
+#define M_LOG10E 0.43429448190325182765
+#define M_LN2 0.69314718055994530942
+#define M_LN10 2.30258509299404568402
+#define M_PI 3.14159265358979323846
+#define M_PI_2 1.57079632679489661923
+#define M_PI_4 0.78539816339744830962
+#define M_1_PI 0.31830988618379067154
+#define M_2_PI 0.63661977236758134308
+#define M_2_SQRTPI 1.12837916709551257390
+#define M_SQRT2 1.41421356237309504880
+#define M_SQRT1_2 0.70710678118654752440
+
+extern int signgam;
+
+#define MAXFLOAT ((float)3.40282346638528860e+38)
+
+#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE)
+/*
+ * SVID
+ */
+enum version {libm_ieee = -1, c_issue_4, ansi_1, strict_ansi};
+
+#ifdef __STDC__
+extern const enum version _lib_version;
+#else
+extern enum version _lib_version;
+#endif
+
+struct exception {
+ int type;
+ char *name;
+ double arg1;
+ double arg2;
+ double retval;
+};
+
+#define HUGE MAXFLOAT
+
+#define _ABS(x) ((x) < 0 ? -(x) : (x))
+
+#define _REDUCE(TYPE, X, XN, C1, C2) { \
+ double x1 = (double)(TYPE)X, x2 = X - x1; \
+ X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); }
+
+#define DOMAIN 1
+#define SING 2
+#define OVERFLOW 3
+#define UNDERFLOW 4
+#define TLOSS 5
+#define PLOSS 6
+
+#define _POLY1(x, c) ((c)[0] * (x) + (c)[1])
+#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2])
+#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3])
+#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4])
+#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5])
+#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6])
+#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7])
+#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8])
+#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9])
+#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */
+
+/*
+ * SVID & X/Open
+ */
+/* BEGIN adopted by C99 */
+extern double erf __P((double));
+extern double erfc __P((double));
+extern double hypot __P((double, double));
+extern double lgamma __P((double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(erf, erfc, hypot)
+#pragma does_not_write_global_data(erf, erfc, hypot)
+#pragma no_side_effect(erf, erfc, hypot)
+#endif
+
+#if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__)
+extern int isnan __P((double));
+
+#pragma does_not_read_global_data(isnan)
+#pragma does_not_write_global_data(isnan)
+#pragma no_side_effect(isnan)
+#endif
+/* END adopted by C99 */
+
+#if defined(__EXTENSIONS__) || _XOPEN_SOURCE - 0 < 600
+extern double gamma __P((double)); /* deprecated; use lgamma */
+#endif
+extern double j0 __P((double));
+extern double j1 __P((double));
+extern double jn __P((int, double));
+extern double y0 __P((double));
+extern double y1 __P((double));
+extern double yn __P((int, double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(j0, j1, jn, y0, y1, yn)
+#pragma does_not_write_global_data(j0, j1, jn, y0, y1, yn)
+#pragma no_side_effect(j0, j1, jn, y0, y1, yn)
+#endif
+#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || \
+ _XOPEN_SOURCE - 0 >= 500 || \
+ defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1
+/*
+ * SVID & XPG 4.2/5
+ */
+extern double scalb __P((double, double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(scalb)
+#pragma does_not_write_global_data(scalb)
+#pragma no_side_effect(scalb)
+#endif
+
+/* BEGIN adopted by C99 */
+extern double acosh __P((double));
+extern double asinh __P((double));
+extern double atanh __P((double));
+extern double cbrt __P((double));
+extern double logb __P((double));
+extern double nextafter __P((double, double));
+extern double remainder __P((double, double));
+
+/*
+ * XPG 4.2/5
+ */
+extern double expm1 __P((double));
+extern int ilogb __P((double));
+extern double log1p __P((double));
+extern double rint __P((double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(acosh, asinh, atanh, cbrt)
+#pragma does_not_read_global_data(logb, nextafter, remainder)
+#pragma does_not_read_global_data(expm1, ilogb, log1p, rint)
+#pragma does_not_write_global_data(acosh, asinh, atanh, cbrt)
+#pragma does_not_write_global_data(logb, nextafter, remainder)
+#pragma does_not_write_global_data(expm1, ilogb, log1p, rint)
+#pragma no_side_effect(acosh, asinh, atanh, cbrt)
+#pragma no_side_effect(logb, nextafter, remainder)
+#pragma no_side_effect(expm1, ilogb, log1p, rint)
+#endif
+/* END adopted by C99 */
+#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || ... */
+
+#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE)
+/*
+ * SVID
+ */
+extern int matherr __P((struct exception *));
+
+/*
+ * IEEE Test Vector
+ */
+extern double significand __P((double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(significand)
+#pragma does_not_write_global_data(significand)
+#pragma no_side_effect(significand)
+#endif
+
+extern int signgamf; /* deprecated; use signgam */
+extern int signgaml; /* deprecated; use signgam */
+
+extern int isnanf __P((float));
+extern int isnanl __P((long double));
+extern float gammaf __P((float)); /* deprecated; use lgammaf */
+extern float gammaf_r __P((float, int *)); /* deprecated; use lgammaf_r */
+extern float j0f __P((float));
+extern float j1f __P((float));
+extern float jnf __P((int, float));
+extern float lgammaf_r __P((float, int *));
+extern float scalbf __P((float, float));
+extern float significandf __P((float));
+extern float y0f __P((float));
+extern float y1f __P((float));
+extern float ynf __P((int, float));
+extern long double gammal __P((long double)); /* deprecated; use lgammal */
+extern long double gammal_r __P((long double, int *)); /* deprecated */
+extern long double j0l __P((long double));
+extern long double j1l __P((long double));
+extern long double jnl __P((int, long double));
+extern long double lgammal_r __P((long double, int *));
+extern long double scalbl __P((long double, long double));
+extern long double significandl __P((long double));
+extern long double y0l __P((long double));
+extern long double y1l __P((long double));
+extern long double ynl __P((int, long double));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(isnanf, isnanl)
+#pragma does_not_write_global_data(isnanf, isnanl)
+#pragma no_side_effect(isnanf, isnanl)
+#pragma does_not_read_global_data(gammaf_r, j0f, j1f, jnf, lgammaf_r, scalbf)
+#pragma does_not_read_global_data(significandf, y0f, y1f, ynf)
+#pragma does_not_write_global_data(j0f, j1f, jnf, scalbf)
+#pragma does_not_write_global_data(significandf, y0f, y1f, ynf)
+#pragma no_side_effect(j0f, j1f, jnf, scalbf)
+#pragma no_side_effect(significandf, y0f, y1f, ynf)
+#pragma does_not_read_global_data(gammal_r, j0l, j1l, jnl, lgammal_r, scalbl)
+#pragma does_not_read_global_data(significandl, y0l, y1l, ynl)
+#pragma does_not_write_global_data(j0l, j1l, jnl, scalbl)
+#pragma does_not_write_global_data(significandl, y0l, y1l, ynl)
+#pragma no_side_effect(j0l, j1l, jnl, scalbl)
+#pragma no_side_effect(significandl, y0l, y1l, ynl)
+#endif
+
+/*
+ * for sin+cos->sincos transformation
+ */
+extern void sincos __P((double, double *, double *));
+extern void sincosf __P((float, float *, float *));
+extern void sincosl __P((long double, long double *, long double *));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(sincos, sincosf, sincosl)
+#endif
+
+/* BEGIN adopted by C99 */
+/*
+ * Functions callable from C, intended to support IEEE arithmetic.
+ */
+extern double copysign __P((double, double));
+extern double scalbn __P((double, int));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(copysign, scalbn)
+#pragma does_not_write_global_data(copysign, scalbn)
+#pragma no_side_effect(copysign, scalbn)
+#endif
+/* END adopted by C99 */
+
+/*
+ * Reentrant version of gamma & lgamma; passes signgam back by reference
+ * as the second argument; user must allocate space for signgam.
+ */
+extern double gamma_r __P((double, int *)); /* deprecated; use lgamma_r */
+extern double lgamma_r __P((double, int *));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(gamma_r, lgamma_r)
+#endif
+
+/* BEGIN adopted by C99 */
+extern float modff __P((float, float *));
+
+#if defined(__MATHERR_ERRNO_DONTCARE)
+#pragma does_not_read_global_data(modff)
+#endif
+/* END adopted by C99 */
+
+#if defined(__EXTENSIONS__) || !defined(__cplusplus)
+#include <floatingpoint.h>
+#endif
+#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */
+#endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || ... */
+
+#if defined(__cplusplus) && defined(__GNUC__)
+#undef exception
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MATH_H */
diff --git a/usr/src/head/tgmath.h b/usr/src/head/tgmath.h
new file mode 100644
index 0000000000..c5b2c519e5
--- /dev/null
+++ b/usr/src/head/tgmath.h
@@ -0,0 +1,171 @@
+/*
+ * 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 _TGMATH_H
+#define _TGMATH_H
+
+#if !defined(__cplusplus)
+
+#include <math.h>
+#include <complex.h>
+
+/*
+ * real-floating and complex
+ */
+#undef acos
+#define acos(x) __tgmath_acos(x)
+#undef asin
+#define asin(x) __tgmath_asin(x)
+#undef atan
+#define atan(x) __tgmath_atan(x)
+#undef acosh
+#define acosh(x) __tgmath_acosh(x)
+#undef asinh
+#define asinh(x) __tgmath_asinh(x)
+#undef atanh
+#define atanh(x) __tgmath_atanh(x)
+#undef cos
+#define cos(x) __tgmath_cos(x)
+#undef sin
+#define sin(x) __tgmath_sin(x)
+#undef tan
+#define tan(x) __tgmath_tan(x)
+#undef cosh
+#define cosh(x) __tgmath_cosh(x)
+#undef sinh
+#define sinh(x) __tgmath_sinh(x)
+#undef tanh
+#define tanh(x) __tgmath_tanh(x)
+#undef exp
+#define exp(x) __tgmath_exp(x)
+#undef log
+#define log(x) __tgmath_log(x)
+#undef pow
+#define pow(x, y) __tgmath_pow(x, y)
+#undef sqrt
+#define sqrt(x) __tgmath_sqrt(x)
+#undef fabs
+#define fabs(x) __tgmath_fabs(x)
+
+/*
+ * real-floating only
+ */
+#undef atan2
+#define atan2(y, x) __tgmath_atan2(y, x)
+#undef cbrt
+#define cbrt(x) __tgmath_cbrt(x)
+#undef ceil
+#define ceil(x) __tgmath_ceil(x)
+#undef copysign
+#define copysign(x, y) __tgmath_copysign(x, y)
+#undef erf
+#define erf(x) __tgmath_erf(x)
+#undef erfc
+#define erfc(x) __tgmath_erfc(x)
+#undef exp2
+#define exp2(x) __tgmath_exp2(x)
+#undef expm1
+#define expm1(x) __tgmath_expm1(x)
+#undef fdim
+#define fdim(x, y) __tgmath_fdim(x, y)
+#undef floor
+#define floor(x) __tgmath_floor(x)
+#undef fma
+#define fma(x, y, z) __tgmath_fma(x, y, z)
+#undef fmax
+#define fmax(x, y) __tgmath_fmax(x, y)
+#undef fmin
+#define fmin(x, y) __tgmath_fmin(x, y)
+#undef fmod
+#define fmod(x, y) __tgmath_fmod(x, y)
+#undef frexp
+#define frexp(x, ip) __tgmath_frexp(x, ip)
+#undef hypot
+#define hypot(x, y) __tgmath_hypot(x, y)
+#undef ilogb
+#define ilogb(x) __tgmath_ilogb(x)
+#undef ldexp
+#define ldexp(x, i) __tgmath_ldexp(x, i)
+#undef lgamma
+#define lgamma(x) __tgmath_lgamma(x)
+#undef llrint
+#define llrint(x) __tgmath_llrint(x)
+#undef llround
+#define llround(x) __tgmath_llround(x)
+#undef log10
+#define log10(x) __tgmath_log10(x)
+#undef log1p
+#define log1p(x) __tgmath_log1p(x)
+#undef log2
+#define log2(x) __tgmath_log2(x)
+#undef logb
+#define logb(x) __tgmath_logb(x)
+#undef lrint
+#define lrint(x) __tgmath_lrint(x)
+#undef lround
+#define lround(x) __tgmath_lround(x)
+#undef nearbyint
+#define nearbyint(x) __tgmath_nearbyint(x)
+#undef nextafter
+#define nextafter(x, y) __tgmath_nextafter(x, y)
+#undef nexttoward
+#define nexttoward(x, y) __tgmath_nexttoward(x, y)
+#undef remainder
+#define remainder(x, y) __tgmath_remainder(x, y)
+#undef remquo
+#define remquo(x, y, ip) __tgmath_remquo(x, y, ip)
+#undef rint
+#define rint(x) __tgmath_rint(x)
+#undef round
+#define round(x) __tgmath_round(x)
+#undef scalbln
+#define scalbln(x, l) __tgmath_scalbln(x, l)
+#undef scalbn
+#define scalbn(x, i) __tgmath_scalbn(x, i)
+#undef tgamma
+#define tgamma(x) __tgmath_tgamma(x)
+#undef trunc
+#define trunc(x) __tgmath_trunc(x)
+
+/*
+ * complex only
+ */
+#undef carg
+#define carg(x) __tgmath_carg(x)
+#undef cimag
+#define cimag(x) __tgmath_cimag(x)
+#undef conj
+#define conj(x) __tgmath_conj(x)
+#undef cproj
+#define cproj(x) __tgmath_cproj(x)
+#undef creal
+#define creal(x) __tgmath_creal(x)
+
+#endif /* !defined(__cplusplus) */
+
+#endif /* _TGMATH_H */