Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Mar 2011 16:50:40 +0000 (UTC)
From:      Steve Kargl <kargl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219571 - in head/lib/msun: . man src
Message-ID:  <201103121650.p2CGoePR024529@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kargl
Date: Sat Mar 12 16:50:39 2011
New Revision: 219571
URL: http://svn.freebsd.org/changeset/base/219571

Log:
  Implement the long double version for the cube root function, cbrtl.
  The algorithm uses Newton's iterations with a crude estimate of the
  cube root to converge to a result.
  
  Reviewed by:	bde
  Approved by:	das

Modified:
  head/lib/msun/Makefile
  head/lib/msun/Symbol.map
  head/lib/msun/man/math.3
  head/lib/msun/man/sqrt.3
  head/lib/msun/src/math.h
  head/lib/msun/src/s_cbrt.c

Modified: head/lib/msun/Makefile
==============================================================================
--- head/lib/msun/Makefile	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/Makefile	Sat Mar 12 16:50:39 2011	(r219571)
@@ -93,8 +93,8 @@ COMMON_SRCS+=	s_copysignl.c s_fabsl.c s_
 COMMON_SRCS+=	e_acosl.c e_asinl.c e_atan2l.c e_fmodl.c \
 	e_hypotl.c e_remainderl.c e_sqrtl.c \
 	invtrig.c k_cosl.c k_sinl.c k_tanl.c \
-	s_atanl.c s_ceill.c s_cosl.c s_cprojl.c s_csqrtl.c s_exp2l.c \
-	s_floorl.c s_fmal.c \
+	s_atanl.c s_cbrtl.c s_ceill.c s_cosl.c s_cprojl.c \
+	s_csqrtl.c s_exp2l.c s_floorl.c s_fmal.c \
 	s_frexpl.c s_logbl.c s_nanl.c s_nextafterl.c s_nexttoward.c \
 	s_remquol.c s_rintl.c s_scalbnl.c \
 	s_sinl.c s_tanl.c s_truncl.c w_cabsl.c
@@ -197,7 +197,8 @@ MLINKS+=scalbn.3 scalbln.3 scalbn.3 scal
 MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3
 MLINKS+=sin.3 sinf.3 sin.3 sinl.3
 MLINKS+=sinh.3 sinhf.3
-MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 sqrtf.3 sqrt.3 sqrtl.3
+MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \
+	sqrt.3 sqrtl.3
 MLINKS+=tan.3 tanf.3 tan.3 tanl.3
 MLINKS+=tanh.3 tanhf.3
 MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3

Modified: head/lib/msun/Symbol.map
==============================================================================
--- head/lib/msun/Symbol.map	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/Symbol.map	Sat Mar 12 16:50:39 2011	(r219571)
@@ -222,6 +222,7 @@ FBSD_1.1 {
 /* First added in 9.0-CURRENT */
 FBSD_1.2 {
 	__isnanf;
+	cbrtl;
 	cexp;
 	cexpf;
 	log2;

Modified: head/lib/msun/man/math.3
==============================================================================
--- head/lib/msun/man/math.3	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/man/math.3	Sat Mar 12 16:50:39 2011	(r219571)
@@ -220,12 +220,11 @@ and
 .Vt long double
 values, were written for or imported into subsequent versions of FreeBSD.
 .Sh BUGS
-The
-.Fn cbrt
-function and many of the transcendental functions
-are not available in their
+Some of the
 .Vt "long double"
-variants.
+math functions in
+.St -isoC-99
+are not available.
 .Pp
 Many of the routines to compute transcendental functions produce
 inaccurate results in other than the default rounding mode.

Modified: head/lib/msun/man/sqrt.3
==============================================================================
--- head/lib/msun/man/sqrt.3	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/man/sqrt.3	Sat Mar 12 16:50:39 2011	(r219571)
@@ -28,12 +28,13 @@
 .\"     from: @(#)sqrt.3	6.4 (Berkeley) 5/6/91
 .\" $FreeBSD$
 .\"
-.Dd March 1, 2008
+.Dd March 5, 2011
 .Dt SQRT 3
 .Os
 .Sh NAME
 .Nm cbrt ,
 .Nm cbrtf ,
+.Nm cbrtl ,
 .Nm sqrt ,
 .Nm sqrtf ,
 .Nm sqrtl
@@ -46,6 +47,8 @@
 .Fn cbrt "double x"
 .Ft float
 .Fn cbrtf "float x"
+.Ft long double
+.Fn cbrtl "long double x"
 .Ft double
 .Fn sqrt "double x"
 .Ft float
@@ -54,9 +57,10 @@
 .Fn sqrtl "long double x"
 .Sh DESCRIPTION
 The
-.Fn cbrt
-and the
-.Fn cbrtf
+.Fn cbrt ,
+.Fn cbrtf ,
+and
+.Fn cbrtl
 functions compute
 the cube root of
 .Ar x .
@@ -67,12 +71,14 @@ The
 and
 .Fn sqrtl
 functions compute the
-non-negative square root of x.
+non-negative square root of
+.Ar x .
 .Sh RETURN VALUES
 The
-.Fn cbrt
-and the
-.Fn cbrtf
+.Fn cbrt ,
+.Fn cbrtf ,
+and
+.Fn cbrtl
 functions return the requested cube root.
 The
 .Fn sqrt ,
@@ -94,6 +100,7 @@ raises an invalid exception and causes a
 The
 .Fn cbrt ,
 .Fn cbrtf ,
+.Fn cbrtl ,
 .Fn sqrt ,
 .Fn sqrtf ,
 and
@@ -109,3 +116,7 @@ The
 .Fn sqrtl
 function appeared in
 .Fx 8.0 .
+The
+.Fn cbrtl
+function appeared in
+.Fx 9.0 .

Modified: head/lib/msun/src/math.h
==============================================================================
--- head/lib/msun/src/math.h	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/src/math.h	Sat Mar 12 16:50:39 2011	(r219571)
@@ -411,9 +411,7 @@ long double	atan2l(long double, long dou
 long double	atanhl(long double);
 #endif
 long double	atanl(long double);
-#if 0
 long double	cbrtl(long double);
-#endif
 long double	ceill(long double);
 long double	copysignl(long double, long double) __pure2;
 #if 0

Modified: head/lib/msun/src/s_cbrt.c
==============================================================================
--- head/lib/msun/src/s_cbrt.c	Sat Mar 12 16:45:15 2011	(r219570)
+++ head/lib/msun/src/s_cbrt.c	Sat Mar 12 16:50:39 2011	(r219571)
@@ -111,3 +111,7 @@ cbrt(double x)
 
 	return(t);
 }
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(cbrt, cbrtl);
+#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103121650.p2CGoePR024529>