Module Name:    src
Committed By:   christos
Date:           Wed Sep 15 16:11:30 UTC 2010

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/include: complex.h math.h
        src/lib/libm: Makefile
        src/lib/libm/complex: Makefile.inc cimag.3 cimag.c cimagf.c conj.3
            conj.c conjf.c creal.3 creal.c crealf.c
        src/lib/libm/man: ieee.3
        src/lib/libm/src: math_private.h
        src/sys/arch/x86/include: ieee.h
Added Files:
        src/lib/libm/complex: cimagl.c conjl.c cproj.3 cproj.c cprojf.c
            cprojl.c creall.c

Log Message:
Commit SoC long double support from Stathis Kamperis


To generate a diff of this commit:
cvs rdiff -u -r1.1507 -r1.1508 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2 -r1.3 src/include/complex.h
cvs rdiff -u -r1.52 -r1.53 src/include/math.h
cvs rdiff -u -r1.97 -r1.98 src/lib/libm/Makefile
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/complex/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/complex/cimag.3 \
    src/lib/libm/complex/cimag.c src/lib/libm/complex/cimagf.c \
    src/lib/libm/complex/conj.3 src/lib/libm/complex/conj.c \
    src/lib/libm/complex/conjf.c src/lib/libm/complex/creal.3 \
    src/lib/libm/complex/creal.c src/lib/libm/complex/crealf.c
cvs rdiff -u -r0 -r1.1 src/lib/libm/complex/cimagl.c \
    src/lib/libm/complex/conjl.c src/lib/libm/complex/cproj.3 \
    src/lib/libm/complex/cproj.c src/lib/libm/complex/cprojf.c \
    src/lib/libm/complex/cprojl.c src/lib/libm/complex/creall.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libm/man/ieee.3
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/src/math_private.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/include/ieee.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1507 src/distrib/sets/lists/comp/mi:1.1508
--- src/distrib/sets/lists/comp/mi:1.1507	Mon Sep  6 10:55:37 2010
+++ src/distrib/sets/lists/comp/mi	Wed Sep 15 12:11:28 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1507 2010/09/06 14:55:37 christos Exp $
+#	$NetBSD: mi,v 1.1508 2010/09/15 16:11:28 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5365,6 +5365,7 @@
 ./usr/share/man/cat3/chgat.0			comp-c-catman		.cat
 ./usr/share/man/cat3/cimag.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/cimagf.0			comp-c-catman		complex,.cat
+./usr/share/man/cat3/cimagl.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/circleq_empty.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/circleq_entry.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/circleq_first.0		comp-obsolete		obsolete
@@ -5423,6 +5424,7 @@
 ./usr/share/man/cat3/conjf.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/copysign.0			comp-c-catman		.cat
 ./usr/share/man/cat3/copysignf.0		comp-c-catman		.cat
+./usr/share/man/cat3/copysignl.0		comp-c-catman		.cat
 ./usr/share/man/cat3/copywin.0			comp-c-catman		.cat
 ./usr/share/man/cat3/cos.0			comp-c-catman		.cat
 ./usr/share/man/cat3/cosf.0			comp-c-catman		.cat
@@ -5430,6 +5432,7 @@
 ./usr/share/man/cat3/coshf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/cpow.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/cpowf.0			comp-c-catman		complex,.cat
+./usr/share/man/cat3/cproj.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/cpuset.0			comp-c-catman		.cat
 ./usr/share/man/cat3/cpuset_clr.0		comp-c-catman		.cat
 ./usr/share/man/cat3/cpuset_create.0		comp-c-catman		.cat
@@ -5440,6 +5443,7 @@
 ./usr/share/man/cat3/cpuset_zero.0		comp-c-catman		.cat
 ./usr/share/man/cat3/creal.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/crealf.0			comp-c-catman		complex,.cat
+./usr/share/man/cat3/creall.0			comp-c-catman		complex,.cat
 ./usr/share/man/cat3/creat.0			comp-c-catman		.cat
 ./usr/share/man/cat3/crypt.0			comp-c-catman		.cat
 ./usr/share/man/cat3/crypto.0			comp-c-catman		crypto,.cat
@@ -5783,6 +5787,8 @@
 ./usr/share/man/cat3/execvp.0			comp-c-catman		.cat
 ./usr/share/man/cat3/exit.0			comp-c-catman		.cat
 ./usr/share/man/cat3/exp.0			comp-c-catman		.cat
+./usr/share/man/cat3/exp2.0			comp-c-catman		.cat
+./usr/share/man/cat3/exp2f.0			comp-c-catman		.cat
 ./usr/share/man/cat3/expf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/expm1.0			comp-c-catman		.cat
 ./usr/share/man/cat3/expm1f.0			comp-c-catman		.cat
@@ -7292,6 +7298,8 @@
 ./usr/share/man/cat3/newwin.0			comp-c-catman		.cat
 ./usr/share/man/cat3/nextafter.0		comp-c-catman		.cat
 ./usr/share/man/cat3/nextafterf.0		comp-c-catman		.cat
+./usr/share/man/cat3/nextafterl.0		comp-c-catman		.cat
+./usr/share/man/cat3/nexttoward.0		comp-c-catman		.cat
 ./usr/share/man/cat3/nftw.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ngettext.0			comp-c-catman		.cat
 ./usr/share/man/cat3/nice.0			comp-c-catman		.cat
@@ -11320,6 +11328,7 @@
 ./usr/share/man/html3/chgat.html		comp-c-htmlman		html
 ./usr/share/man/html3/cimag.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/cimagf.html		comp-c-htmlman		complex,html
+./usr/share/man/html3/cimagl.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/clear.html		comp-c-htmlman		html
 ./usr/share/man/html3/clearerr.html		comp-c-htmlman		html
 ./usr/share/man/html3/clearok.html		comp-c-htmlman		html
@@ -11364,6 +11373,7 @@
 ./usr/share/man/html3/conjf.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/copysign.html		comp-c-htmlman		html
 ./usr/share/man/html3/copysignf.html		comp-c-htmlman		html
+./usr/share/man/html3/copysignl.html		comp-c-htmlman		html
 ./usr/share/man/html3/copywin.html		comp-c-htmlman		html
 ./usr/share/man/html3/cos.html			comp-c-htmlman		html
 ./usr/share/man/html3/cosf.html			comp-c-htmlman		html
@@ -11371,6 +11381,7 @@
 ./usr/share/man/html3/coshf.html		comp-c-htmlman		html
 ./usr/share/man/html3/cpow.html			comp-c-htmlman		complex,html
 ./usr/share/man/html3/cpowf.html		comp-c-htmlman		complex,html
+./usr/share/man/html3/cproj.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/cpuset.html		comp-c-htmlman		html
 ./usr/share/man/html3/cpuset_clr.html		comp-c-htmlman		html
 ./usr/share/man/html3/cpuset_create.html	comp-c-htmlman		html
@@ -11381,6 +11392,7 @@
 ./usr/share/man/html3/cpuset_zero.html		comp-c-htmlman		html
 ./usr/share/man/html3/creal.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/crealf.html		comp-c-htmlman		complex,html
+./usr/share/man/html3/creall.html		comp-c-htmlman		complex,html
 ./usr/share/man/html3/creat.html		comp-c-htmlman		html
 ./usr/share/man/html3/crypt.html		comp-c-htmlman		html
 ./usr/share/man/html3/crypto.html		comp-c-htmlman		crypto,html
@@ -11723,6 +11735,8 @@
 ./usr/share/man/html3/exit.html			comp-c-htmlman		html
 ./usr/share/man/html3/exp.html			comp-c-htmlman		html
 ./usr/share/man/html3/expf.html			comp-c-htmlman		html
+./usr/share/man/html3/exp2.html			comp-c-htmlman		html
+./usr/share/man/html3/exp2f.html		comp-c-htmlman		html
 ./usr/share/man/html3/expm1.html		comp-c-htmlman		html
 ./usr/share/man/html3/expm1f.html		comp-c-htmlman		html
 ./usr/share/man/html3/extattr.html		comp-c-htmlman		html
@@ -13192,6 +13206,8 @@
 ./usr/share/man/html3/newwin.html		comp-c-htmlman		html
 ./usr/share/man/html3/nextafter.html		comp-c-htmlman		html
 ./usr/share/man/html3/nextafterf.html		comp-c-htmlman		html
+./usr/share/man/html3/nextafterl.html		comp-c-htmlman		html
+./usr/share/man/html3/nexttoward.html		comp-c-htmlman		html
 ./usr/share/man/html3/nftw.html			comp-c-htmlman		html
 ./usr/share/man/html3/ngettext.html		comp-c-htmlman		html
 ./usr/share/man/html3/nice.html			comp-c-htmlman		html
@@ -17153,6 +17169,7 @@
 ./usr/share/man/man3/chgat.3			comp-c-man		.man
 ./usr/share/man/man3/cimag.3			comp-c-man		complex,.man
 ./usr/share/man/man3/cimagf.3			comp-c-man		complex,.man
+./usr/share/man/man3/cimagl.3			comp-c-man		complex,.man
 ./usr/share/man/man3/circleq_empty.3		comp-obsolete		obsolete
 ./usr/share/man/man3/circleq_entry.3		comp-obsolete		obsolete
 ./usr/share/man/man3/circleq_first.3		comp-obsolete		obsolete
@@ -17211,6 +17228,7 @@
 ./usr/share/man/man3/conjf.3			comp-c-man		complex,.man
 ./usr/share/man/man3/copysign.3			comp-c-man		.man
 ./usr/share/man/man3/copysignf.3		comp-c-man		.man
+./usr/share/man/man3/copysignl.3		comp-c-man		.man
 ./usr/share/man/man3/copywin.3			comp-c-man		.man
 ./usr/share/man/man3/cos.3			comp-c-man		.man
 ./usr/share/man/man3/cosf.3			comp-c-man		.man
@@ -17218,6 +17236,7 @@
 ./usr/share/man/man3/coshf.3			comp-c-man		.man
 ./usr/share/man/man3/cpow.3			comp-c-man		complex,.man
 ./usr/share/man/man3/cpowf.3			comp-c-man		complex,.man
+./usr/share/man/man3/cproj.3			comp-c-man		complex,.man
 ./usr/share/man/man3/cpuset.3			comp-c-man		.man
 ./usr/share/man/man3/cpuset_clr.3		comp-c-man		.man
 ./usr/share/man/man3/cpuset_create.3		comp-c-man		.man
@@ -17228,6 +17247,7 @@
 ./usr/share/man/man3/cpuset_zero.3		comp-c-man		.man
 ./usr/share/man/man3/creal.3			comp-c-man		complex,.man
 ./usr/share/man/man3/crealf.3			comp-c-man		complex,.man
+./usr/share/man/man3/creall.3			comp-c-man		complex,.man
 ./usr/share/man/man3/creat.3			comp-c-man		.man
 ./usr/share/man/man3/crypt.3			comp-c-man		.man
 ./usr/share/man/man3/crypto.3			comp-c-man		crypto,.man
@@ -17572,6 +17592,8 @@
 ./usr/share/man/man3/exit.3			comp-c-man		.man
 ./usr/share/man/man3/exp.3			comp-c-man		.man
 ./usr/share/man/man3/expf.3			comp-c-man		.man
+./usr/share/man/man3/exp2.3			comp-c-man		.man
+./usr/share/man/man3/exp2f.3			comp-c-man		.man
 ./usr/share/man/man3/expm1.3			comp-c-man		.man
 ./usr/share/man/man3/expm1f.3			comp-c-man		.man
 ./usr/share/man/man3/extattr.3			comp-c-man		.man
@@ -19080,6 +19102,8 @@
 ./usr/share/man/man3/newwin.3			comp-c-man		.man
 ./usr/share/man/man3/nextafter.3		comp-c-man		.man
 ./usr/share/man/man3/nextafterf.3		comp-c-man		.man
+./usr/share/man/man3/nextafterl.3		comp-c-man		.man
+./usr/share/man/man3/nexttoward.3		comp-c-man		.man
 ./usr/share/man/man3/nftw.3			comp-c-man		.man
 ./usr/share/man/man3/ngettext.3			comp-c-man		.man
 ./usr/share/man/man3/nice.3			comp-c-man		.man

Index: src/include/complex.h
diff -u src/include/complex.h:1.2 src/include/complex.h:1.3
--- src/include/complex.h:1.2	Wed Jul 22 11:09:57 2009
+++ src/include/complex.h	Wed Sep 15 12:11:30 2010
@@ -1,10 +1,13 @@
-/* $NetBSD: complex.h,v 1.2 2009/07/22 15:09:57 drochner Exp $ */
+/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
 
 /*
  * Written by Matthias Drochner.
  * Public domain.
  */
 
+#ifndef	_COMPLEX_H
+#define	_COMPLEX_H
+
 #define complex _Complex
 #define _Complex_I 1.0fi
 #define I _Complex_I
@@ -13,57 +16,106 @@
 
 __BEGIN_DECLS
 
-double creal(double complex);
-double cimag(double complex);
-double complex conj(double complex);
-float crealf(float complex);
-float cimagf(float complex);
-float complex conjf(float complex);
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
 
-#ifndef __LIBM0_SOURCE__
-/* avoid conflict with historical cabs(struct complex) */
-double cabs(double complex) __RENAME(__c99_cabs);
-float cabsf(float complex) __RENAME(__c99_cabsf);
-#endif
-double carg(double complex);
-float cargf(float complex);
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
 
-double complex csqrt(double complex);
-double complex cexp(double complex);
-double complex clog(double complex);
-double complex cpow(double complex, double complex);
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
 
-double complex csin(double complex);
+/* 7.3.5.1 The ccos functions */
 double complex ccos(double complex);
+float complex ccosf(float complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+
+/* 7.3.5.1 The ctan functions */
 double complex ctan(double complex);
-double complex csinh(double complex);
-double complex ccosh(double complex);
-double complex ctanh(double complex);
+float complex ctanf(float complex);
 
-double complex casin(double complex);
-double complex cacos(double complex);
-double complex catan(double complex);
-double complex casinh(double complex);
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
 double complex cacosh(double complex);
+float complex cacoshf(float complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+
+/* 7.3.6.3 The catanh functions */
 double complex catanh(double complex);
+float complex catanhf(float complex);
 
-float complex csqrtf(float complex);
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
 float complex cexpf(float complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
 float complex clogf(float complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+#ifndef __LIBM0_SOURCE__
+/* avoid conflict with historical cabs(struct complex) */
+double cabs(double complex) __RENAME(__c99_cabs);
+float cabsf(float complex) __RENAME(__c99_cabsf);
+#endif
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
 float complex cpowf(float complex, float complex);
 
-float complex csinf(float complex);
-float complex ccosf(float complex);
-float complex ctanf(float complex);
-float complex csinhf(float complex);
-float complex ccoshf(float complex);
-float complex ctanhf(float complex);
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
 
-float complex casinf(float complex);
-float complex cacosf(float complex);
-float complex catanf(float complex);
-float complex casinhf(float complex);
-float complex cacoshf(float complex);
-float complex catanhf(float complex);
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */ 
+double carg(double complex);
+float cargf(float complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
 
 __END_DECLS
+
+#endif	/* ! _COMPLEX_H */

Index: src/include/math.h
diff -u src/include/math.h:1.52 src/include/math.h:1.53
--- src/include/math.h:1.52	Sun May  2 02:31:48 2010
+++ src/include/math.h	Wed Sep 15 12:11:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.52 2010/05/02 06:31:48 dholland Exp $	*/
+/*	$NetBSD: math.h,v 1.53 2010/09/15 16:11:30 christos Exp $	*/
 
 /*
  * ====================================================
@@ -311,6 +311,7 @@
 
 float	cbrtf(float);
 float	fabsf(float);
+long double	fabsl(long double);
 float	hypotf(float, float);
 float	powf(float, float);
 float	sqrtf(float);
@@ -351,10 +352,13 @@
 /* 7.12.11 manipulation */
 
 float	copysignf(float, float);
+long double	copysignl(long double, long double);
 double	nan(const char *);
 float	nanf(const char *);
 long double	nanl(const char *);
 float	nextafterf(float, float);
+long double     nextafterl(long double, long double);
+double	nexttoward(double, long double);
 
 /* 7.12.14 comparison */
 

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.97 src/lib/libm/Makefile:1.98
--- src/lib/libm/Makefile:1.97	Tue Aug 10 13:53:08 2010
+++ src/lib/libm/Makefile	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.97 2010/08/10 17:53:08 drochner Exp $
+#  $NetBSD: Makefile,v 1.98 2010/09/15 16:11:29 christos Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -57,7 +57,7 @@
 .endif
 .PATH:	${.CURDIR}/arch/i387
 
-COMMON_SRCS+= fenv.c
+COMMON_SRCS+= fenv.c s_nextafterl.c s_nexttoward.c
 ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
 	    e_logf.S e_log10.S e_log10f.S e_log2.S e_log2f.S e_remainder.S \
 	    e_remainderf.S e_scalb.S e_scalbf.S e_sqrt.S e_sqrtf.S s_atan.S \
@@ -127,8 +127,8 @@
 	k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
 	k_standard.c k_tan.c k_tanf.c \
 	s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_cbrt.c s_cbrtf.c s_ceil.c \
-	s_ceilf.c s_copysign.c s_copysignf.c s_cos.c s_cosf.c s_erf.c \
-	s_erff.c s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c \
+	s_ceilf.c s_copysign.c s_copysignf.c s_copysignl.c s_cos.c s_cosf.c s_erf.c \
+	s_erff.c s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c s_fabsl.c \
 	s_finite.c s_finitef.c \
 	s_floor.c s_floorf.c s_frexpf.c s_ilogb.c s_ilogbf.c \
 	s_isinff.c s_isnanf.c s_ldexpf.c s_lib_version.c s_log1p.c \
@@ -226,16 +226,24 @@
 MLINKS+=cos.3 cosf.3
 MLINKS+=cosh.3 coshf.3
 MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3
-MLINKS+=exp.3 expf.3 exp.3 expm1.3 exp.3 expm1f.3 exp.3 log.3 exp.3 logf.3 \
-	exp.3 log10.3 exp.3 log10f.3 exp.3 log1p.3 exp.3 log1pf.3 \
-	exp.3 pow.3 exp.3 powf.3 exp.3 log2.3 exp.3 log2f.3
+MLINKS+=exp.3 expf.3 exp.3 expm1.3 exp.3 expm1f.3 			\
+	exp.3 exp2.3 exp.3 exp2f.3 					\
+	exp.3 log.3 exp.3 logf.3 					\
+	exp.3 log10.3 exp.3 log10f.3 					\
+	exp.3 log1p.3 exp.3 log1pf.3 					\
+	exp.3 pow.3 exp.3 powf.3 					\
+	exp.3 log2.3 exp.3 log2f.3
 MLINKS+=fabs.3 fabsf.3
 MLINKS+=floor.3 floorf.3
 MLINKS+=fmod.3 fmodf.3
 MLINKS+=hypot.3 hypotf.3
-MLINKS+=ieee.3 copysign.3 ieee.3 copysignf.3 ieee.3 finite.3 ieee.3 finitef.3 \
-	ieee.3 ilogb.3 ieee.3 ilogbf.3 ieee.3 nextafter.3 ieee.3 nextafterf.3 \
-	ieee.3 remainder.3 ieee.3 remainderf.3 ieee.3 scalbn.3 ieee.3 scalbnf.3
+MLINKS+=ieee.3 copysign.3 ieee.3 copysignf.3 ieee.3 copysignl.3 	\
+	ieee.3 finite.3 ieee.3 finitef.3 				\
+	ieee.3 ilogb.3 ieee.3 ilogbf.3					\
+	ieee.3 nextafter.3 ieee.3 nextafterf.3 ieee.3 nextafterl.3	\
+	ieee.3 nexttoward.3						\
+	ieee.3 remainder.3 ieee.3 remainderf.3 				\
+	ieee.3 scalbn.3 ieee.3 scalbnf.3
 MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3
 MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3
 MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3

Index: src/lib/libm/complex/Makefile.inc
diff -u src/lib/libm/complex/Makefile.inc:1.2 src/lib/libm/complex/Makefile.inc:1.3
--- src/lib/libm/complex/Makefile.inc:1.2	Sat Mar  8 09:21:41 2008
+++ src/lib/libm/complex/Makefile.inc	Wed Sep 15 12:11:29 2010
@@ -1,24 +1,28 @@
-# $NetBSD: Makefile.inc,v 1.2 2008/03/08 14:21:41 drochner Exp $
+# $NetBSD: Makefile.inc,v 1.3 2010/09/15 16:11:29 christos Exp $
 
 .PATH: ${.CURDIR}/complex
 
 SRCS+= cabs.c cabsf.c carg.c cargf.c
-SRCS+= creal.c crealf.c cimag.c cimagf.c conj.c conjf.c
+SRCS+= creal.c crealf.c creall.c cimag.c cimagf.c cimagl.c
+SRCS+= conj.c conjf.c conjl.c
 SRCS+= csqrt.c cexp.c clog.c cpow.c
 SRCS+= cephes_subr.c csin.c ccos.c ctan.c csinh.c ccosh.c ctanh.c
 SRCS+= casin.c cacos.c catan.c casinh.c cacosh.c catanh.c
 SRCS+= csqrtf.c cexpf.c clogf.c cpowf.c
 SRCS+= cephes_subrf.c csinf.c ccosf.c ctanf.c csinhf.c ccoshf.c ctanhf.c
 SRCS+= casinf.c cacosf.c catanf.c casinhf.c cacoshf.c catanhf.c
+SRCS+= cproj.c cprojf.c cprojl.c
 
 MAN+= cabs.3 cacos.3 cacosh.3 carg.3 casin.3 casinh.3 catan.3 catanh.3
-MAN+= ccos.3 ccosh.3 cexp.3 cimag.3 clog.3 conj.3 cpow.3 creal.3
+MAN+= ccos.3 ccosh.3 cexp.3 cimag.3 clog.3 conj.3 cpow.3 cproj.3 creal.3
 MAN+= csin.3 csinh.3 csqrt.3 ctan.3 ctanh.3
 
 MLINKS+= cabs.3 cabsf.3 cacos.3 cacosf.3 cacosh.3 cacoshf.3
 MLINKS+= carg.3 cargf.3 casin.3 casinf.3 casinh.3 casinhf.3
 MLINKS+= catan.3 catanf.3 catanh.3 catanhf.3 ccos.3 ccosf.3
-MLINKS+= ccosh.3 ccoshf.3 cexp.3 cexpf.3 cimag.3 cimagf.3
+MLINKS+= ccosh.3 ccoshf.3 cexp.3 cexpf.3
+MLINKS+= cimag.3 cimagf.3 cimag.3 cimagl.3
 MLINKS+= clog.3 clogf.3 conj.3 conjf.3 cpow.3 cpowf.3
-MLINKS+= creal.3 crealf.3 csin.3 csinf.3 csinh.3 csinhf.3
+MLINKS+= creal.3 crealf.3 creal.3 creall.3
+MLINKS+= csin.3 csinf.3 csinh.3 csinhf.3
 MLINKS+= csqrt.3 csqrtf.3 ctan.3 ctanf.3 ctanh.3 ctanhf.3

Index: src/lib/libm/complex/cimag.3
diff -u src/lib/libm/complex/cimag.3:1.1 src/lib/libm/complex/cimag.3:1.2
--- src/lib/libm/complex/cimag.3:1.1	Wed Feb 20 04:55:38 2008
+++ src/lib/libm/complex/cimag.3	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: cimag.3,v 1.1 2008/02/20 09:55:38 drochner Exp $
+.\" $NetBSD: cimag.3,v 1.2 2010/09/15 16:11:29 christos Exp $
 .\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
 .TH "CIMAG" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
 .\" cimag 
@@ -13,6 +13,8 @@
 .br
 float cimagf(float complex\fP \fIz\fP\fB);
 .br
+long double cimagl(long double complex\fP \fIz\fP\fB);
+.br
 \fP
 .SH DESCRIPTION
 .LP
Index: src/lib/libm/complex/cimag.c
diff -u src/lib/libm/complex/cimag.c:1.1 src/lib/libm/complex/cimag.c:1.2
--- src/lib/libm/complex/cimag.c:1.1	Mon Aug 20 12:01:34 2007
+++ src/lib/libm/complex/cimag.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cimag.c,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+/* $NetBSD: cimag.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,12 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 double
 cimag(double complex z)
 {
+	double_complex w = { .z = z };
 
-	return __imag__ z;
+	return (IMAG_PART(w));
 }
Index: src/lib/libm/complex/cimagf.c
diff -u src/lib/libm/complex/cimagf.c:1.1 src/lib/libm/complex/cimagf.c:1.2
--- src/lib/libm/complex/cimagf.c:1.1	Mon Aug 20 12:01:35 2007
+++ src/lib/libm/complex/cimagf.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cimagf.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+/* $NetBSD: cimagf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,12 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 float
 cimagf(float complex z)
 {
+	float_complex w = { .z = z };
 
-	return __imag__ z;
+	return (IMAG_PART(w));
 }
Index: src/lib/libm/complex/conj.3
diff -u src/lib/libm/complex/conj.3:1.1 src/lib/libm/complex/conj.3:1.2
--- src/lib/libm/complex/conj.3:1.1	Wed Feb 20 04:55:38 2008
+++ src/lib/libm/complex/conj.3	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: conj.3,v 1.1 2008/02/20 09:55:38 drochner Exp $
+.\" $NetBSD: conj.3,v 1.2 2010/09/15 16:11:29 christos Exp $
 .\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
 .TH "CONJ" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
 .\" conj 
@@ -13,6 +13,8 @@
 .br
 float complex conjf(float complex\fP \fIz\fP\fB);
 .br
+long double complex conjl(long double complex\fP \fIz\fP\fB, long double complex\fP \fIz\fP\fB);
+.br
 \fP
 .SH DESCRIPTION
 .LP
Index: src/lib/libm/complex/conj.c
diff -u src/lib/libm/complex/conj.c:1.1 src/lib/libm/complex/conj.c:1.2
--- src/lib/libm/complex/conj.c:1.1	Mon Aug 20 12:01:35 2007
+++ src/lib/libm/complex/conj.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: conj.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+/* $NetBSD: conj.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,14 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 double complex
 conj(double complex z)
 {
+	double_complex w = { .z = z };
 
-	return ~z;
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
 }
Index: src/lib/libm/complex/conjf.c
diff -u src/lib/libm/complex/conjf.c:1.1 src/lib/libm/complex/conjf.c:1.2
--- src/lib/libm/complex/conjf.c:1.1	Mon Aug 20 12:01:35 2007
+++ src/lib/libm/complex/conjf.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: conjf.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+/* $NetBSD: conjf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,14 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 float complex
 conjf(float complex z)
 {
+	float_complex w = { .z = z };
 
-	return ~z;
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
 }
Index: src/lib/libm/complex/creal.3
diff -u src/lib/libm/complex/creal.3:1.1 src/lib/libm/complex/creal.3:1.2
--- src/lib/libm/complex/creal.3:1.1	Wed Feb 20 04:55:38 2008
+++ src/lib/libm/complex/creal.3	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: creal.3,v 1.1 2008/02/20 09:55:38 drochner Exp $
+.\" $NetBSD: creal.3,v 1.2 2010/09/15 16:11:29 christos Exp $
 .\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
 .TH "CREAL" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
 .\" creal 
@@ -13,6 +13,8 @@
 .br
 float crealf(float complex\fP \fIz\fP\fB);
 .br
+long double creall(long double complex\fP \fIz\fP\fB);
+.br
 \fP
 .SH DESCRIPTION
 .LP
Index: src/lib/libm/complex/creal.c
diff -u src/lib/libm/complex/creal.c:1.1 src/lib/libm/complex/creal.c:1.2
--- src/lib/libm/complex/creal.c:1.1	Mon Aug 20 12:01:36 2007
+++ src/lib/libm/complex/creal.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: creal.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+/* $NetBSD: creal.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,12 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 double
 creal(double complex z)
 {
+	double_complex w = { .z = z };
 
-	return __real__ z;
+	return (REAL_PART(w));
 }
Index: src/lib/libm/complex/crealf.c
diff -u src/lib/libm/complex/crealf.c:1.1 src/lib/libm/complex/crealf.c:1.2
--- src/lib/libm/complex/crealf.c:1.1	Mon Aug 20 12:01:36 2007
+++ src/lib/libm/complex/crealf.c	Wed Sep 15 12:11:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: crealf.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+/* $NetBSD: crealf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
 
 /*
  * Written by Matthias Drochner <droch...@netbsd.org>.
@@ -6,10 +6,12 @@
  */
 
 #include <complex.h>
+#include "../src/math_private.h"
 
 float
 crealf(float complex z)
 {
+	float_complex w = { .z = z };
 
-	return __real__ z;
+	return (REAL_PART(w));
 }

Index: src/lib/libm/man/ieee.3
diff -u src/lib/libm/man/ieee.3:1.20 src/lib/libm/man/ieee.3:1.21
--- src/lib/libm/man/ieee.3:1.20	Mon Apr  5 17:33:25 2010
+++ src/lib/libm/man/ieee.3	Wed Sep 15 12:11:30 2010
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)ieee.3	6.4 (Berkeley) 5/6/91
-.\"	$NetBSD: ieee.3,v 1.20 2010/04/05 21:33:25 joerg Exp $
+.\"	$NetBSD: ieee.3,v 1.21 2010/09/15 16:11:30 christos Exp $
 .\"
 .Dd February 25, 1994
 .Dt IEEE 3
@@ -34,12 +34,15 @@
 .Sh NAME
 .Nm copysign ,
 .Nm copysignf ,
+.Nm copysignl ,
 .Nm finite ,
 .Nm finitef ,
 .Nm ilogb ,
 .Nm ilogbf ,
 .Nm nextafter ,
 .Nm nextafterf ,
+.Nm nextafterl ,
+.Nm nexttoward ,
 .Nm remainder ,
 .Nm remainderf ,
 .Nm scalbn ,
@@ -53,6 +56,8 @@
 .Fn copysign "double x" "double y"
 .Ft float
 .Fn copysignf "float x" "float y"
+.Ft long double
+.Fn copysignl "long double x" "long double y"
 .Ft int
 .Fn finite "double x"
 .Ft int
@@ -65,6 +70,10 @@
 .Fn nextafter "double x" "double y"
 .Ft float
 .Fn nextafterf "float x" "float y"
+.Ft long double
+.Fn nextafterl "long double x" "long double y"
+.Ft double
+.Fn nexttoward "double x" "long double y"
 .Ft double
 .Fn remainder "double x" "double y"
 .Ft float
@@ -115,6 +124,18 @@
 in direction
 .Fa y .
 .Pp
+.Fn nexttoward
+is equivalent to
+.Fn nextafter ,
+except that the second parameter has type
+.Ft long double
+and the function returns
+.Dv y
+converted to the type of the function if
+.Dv x
+equals
+.Dv y .
+.Pp
 .Fn remainder
 returns the remainder
 .Fa r

Index: src/lib/libm/src/math_private.h
diff -u src/lib/libm/src/math_private.h:1.14 src/lib/libm/src/math_private.h:1.15
--- src/lib/libm/src/math_private.h:1.14	Mon Jan 11 11:28:39 2010
+++ src/lib/libm/src/math_private.h	Wed Sep 15 12:11:30 2010
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.14 2010/01/11 16:28:39 christos Exp $
+ * $NetBSD: math_private.h,v 1.15 2010/09/15 16:11:30 christos Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -170,6 +170,37 @@
 } while (/*CONSTCOND*/0)
 #endif
 
+#ifdef	_COMPLEX_H
+
+/*
+ * Quoting from ISO/IEC 9899:TC2:
+ *
+ * 6.2.5.13 Types
+ * Each complex type has the same representation and alignment requirements as
+ * an array type containing exactly two elements of the corresponding real type;
+ * the first element is equal to the real part, and the second element to the
+ * imaginary part, of the complex number.
+ */
+typedef union {
+	float complex z;
+	float parts[2];
+} float_complex;
+
+typedef union {
+	double complex z;
+	double parts[2];
+} double_complex;
+
+typedef union {
+	long double complex z;
+	long double complex parts[2];
+} long_double_complex;
+
+#define	REAL_PART(z)	((z).parts[0])
+#define	IMAG_PART(z)	((z).parts[1])
+
+#endif	/* _COMPLEX_H */
+
 /* ieee style elementary functions */
 extern double __ieee754_sqrt __P((double));
 extern double __ieee754_acos __P((double));

Index: src/sys/arch/x86/include/ieee.h
diff -u src/sys/arch/x86/include/ieee.h:1.10 src/sys/arch/x86/include/ieee.h:1.11
--- src/sys/arch/x86/include/ieee.h:1.10	Fri Feb  2 18:07:44 2007
+++ src/sys/arch/x86/include/ieee.h	Wed Sep 15 12:11:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee.h,v 1.10 2007/02/02 23:07:44 christos Exp $ */
+/*	$NetBSD: ieee.h,v 1.11 2010/09/15 16:11:28 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -85,7 +85,9 @@
  * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
  * high fraction; if the bit is set, it is a `quiet NaN'.
  */
-#define	EXT_EXP_INFNAN	32767
+#define	EXT_EXP_INFNAN	0x7fff
+#define	EXT_EXP_INF	0x7fff
+#define	EXT_EXP_NAN	0x7fff
 
 #if 0
 #define	SNG_QUIETNAN	(1 << 22)
@@ -105,3 +107,11 @@
 	long double		extu_ld;
 	struct ieee_ext		extu_ext;
 };
+
+#define extu_exp	extu_ext.ext_exp
+#define extu_sign	extu_ext.ext_sign
+#define extu_fracl	extu_ext.ext_fracl
+#define extu_frach	extu_ext.ext_frach
+
+#define LDBL_NBIT	0x80000000
+#define mask_nbit_l(u)	((u).extu_frach &= ~LDBL_NBIT)

Added files:

Index: src/lib/libm/complex/cimagl.c
diff -u /dev/null src/lib/libm/complex/cimagl.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/cimagl.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,44 @@
+/*	$NetBSD: cimagl.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: cimagl.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include "../src/math_private.h"
+
+/*
+ * cimagl(long double complex z)
+ * This function returns the imaginary part value (as a real) of z.
+ */
+long double
+cimagl(long double complex z)
+{
+	long_double_complex w = { .z = z };
+
+	return (IMAG_PART(w));
+}
Index: src/lib/libm/complex/conjl.c
diff -u /dev/null src/lib/libm/complex/conjl.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/conjl.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,49 @@
+/*	$NetBSD: conjl.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: conjl.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include <math.h>
+#include <machine/ieee.h>
+
+#include "../src/math_private.h"
+
+/*
+ * conjl(long double complex z)
+ * This function returns the complex conjugate value of its argument, z.
+ */
+long double complex
+conjl(long double complex z)
+{
+	long_double_complex w = { .z = z };
+
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
+}
Index: src/lib/libm/complex/cproj.3
diff -u /dev/null src/lib/libm/complex/cproj.3:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/cproj.3	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,59 @@
+.\" $NetBSD: cproj.3,v 1.1 2010/09/15 16:11:29 christos Exp $
+.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
+.TH "CPROJ" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\" cproj 
+.SH NAME
+cproj, cprojf, cprojl \- complex projection functions
+.SH SYNOPSIS
+.LP
+\fB#include <complex.h>
+.br
+.sp
+double cproj(double complex\fP \fIz\fP\fB);
+.br
+float cprojf(float complex\fP \fIz\fP\fB);
+.br
+long double cprojl(long double complex\fP \fIz\fP\fB);
+.br
+\fP
+.SH DESCRIPTION
+.LP
+These functions compute a projection of \fIz\fP ono the Riemann sphere:
+\fIz\fP projects to \fIz\fP , except that all complex infinities (even those
+with one infinite part and one NaN part) project to positive infinity on the
+real axis. If \fIz\fP has an infinite part, then cproj(z) shall be equivalent to:
+INFINITY + I * copysign(0.0, cimag(z))
+.SH RETURN VALUE
+.LP
+These functions return the value of the projection onto the Riemann sphere.
+.SH ERRORS
+.LP
+No errors are defined.
+.LP
+\fIThe following sections are informative.\fP
+.SH EXAMPLES
+.LP
+None.
+.SH APPLICATION USAGE
+.LP
+None.
+.SH RATIONALE
+.LP
+None.
+.SH FUTURE DIRECTIONS
+.LP
+None.
+.SH SEE ALSO
+.LP
+\fIcarg\fP(), \fIcimag\fP(), \fIconj\fP(), \fIcreal\fP() the
+Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<complex.h>\fP
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group. In the
+event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .
Index: src/lib/libm/complex/cproj.c
diff -u /dev/null src/lib/libm/complex/cproj.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/cproj.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,60 @@
+/*	$NetBSD: cproj.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: cproj.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include <math.h>
+#include <machine/ieee.h>
+
+#include "../src/math_private.h"
+
+/*
+ * cproj(double complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+double complex
+cproj(double complex z)
+{
+	double_complex w = { .z = z };
+
+	if (isinf(creal(z) || isinf(cimag(z)))) {
+		REAL_PART(w) = INFINITY;
+		IMAG_PART(w) = copysign(0.0, cimag(z));
+	}
+
+	return (w.z);
+}
Index: src/lib/libm/complex/cprojf.c
diff -u /dev/null src/lib/libm/complex/cprojf.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/cprojf.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,61 @@
+/*	$NetBSD: cprojf.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: cprojf.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include <math.h>
+#include <machine/ieee.h>
+
+#include "../src/math_private.h"
+
+/*
+ * cprojf(float complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+
+float complex
+cprojf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	if (isinf(crealf(z) || isinf(cimagf(z)))) {
+		REAL_PART(w) = INFINITY;
+		IMAG_PART(w) = copysignf(0.0, cimagf(z));
+	}
+
+	return (w.z);
+}
Index: src/lib/libm/complex/cprojl.c
diff -u /dev/null src/lib/libm/complex/cprojl.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/cprojl.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,61 @@
+/*	$NetBSD: cprojl.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: cprojl.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include <math.h>
+#include <machine/ieee.h>
+
+#include "../src/math_private.h"
+
+/*
+ * cprojl(long double complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+
+long double complex
+cprojl(long double complex z)
+{
+	long_double_complex w = { .z = z };
+
+	if (isinf(creall(z) || isinf(cimagl(z)))) {
+		REAL_PART(w) = INFINITY;
+		IMAG_PART(w) = copysignl(0.0, cimagl(z));
+	}
+
+	return (w.z);
+}
Index: src/lib/libm/complex/creall.c
diff -u /dev/null src/lib/libm/complex/creall.c:1.1
--- /dev/null	Wed Sep 15 12:11:30 2010
+++ src/lib/libm/complex/creall.c	Wed Sep 15 12:11:29 2010
@@ -0,0 +1,44 @@
+/*	$NetBSD: creall.c,v 1.1 2010/09/15 16:11:29 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: creall.c,v 1.1 2010/09/15 16:11:29 christos Exp $");
+
+#include <complex.h>
+#include "../src/math_private.h"
+
+/*
+ * creall(long double complex z)
+ * This function returns the real part value of z.
+ */
+long double
+creall(long double complex z)
+{
+	long_double_complex w = { .z = z };
+
+	return (REAL_PART(w));
+}

Reply via email to