Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109938116
D44168.id135273.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D44168.id135273.diff
View Options
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -122,7 +122,8 @@
COMMON_SRCS+= s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c
.if ${LDBL_PREC} != 53
# If long double != double use these; otherwise, we alias the double versions.
-COMMON_SRCS+= b_tgammal.c catrigl.c \
+.PATH: ${SRCTOP}/contrib/arm-optimized-routines/math
+COMMON_SRCS+= b_tgammal.c tgamma128.c catrigl.c \
e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \
e_coshl.c e_fmodl.c e_hypotl.c \
e_lgammal.c e_lgammal_r.c e_powl.c \
diff --git a/lib/msun/ld128/b_tgammal.c b/lib/msun/ld128/b_tgammal.c
--- a/lib/msun/ld128/b_tgammal.c
+++ b/lib/msun/ld128/b_tgammal.c
@@ -1,8 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2013 David Chisnall
- * All rights reserved.
+ * Copyright (c) 2024 Mark Murray
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,30 +25,15 @@
* SUCH DAMAGE.
*/
-#include <float.h>
-#include <math.h>
-
-/*
- * If long double is not the same size as double, then these will lose
- * precision and we should emit a warning whenever something links against
- * them.
- */
-#if (LDBL_MANT_DIG > 53)
-#define WARN_IMPRECISE(x) \
- __warn_references(x, # x " has lower than advertised precision");
-#else
-#define WARN_IMPRECISE(x)
-#endif
/*
- * Declare the functions as weak variants so that other libraries providing
- * real versions can override them.
+ * This is a pure C function generously donated by ARM.
+ * See src/contrib/arm-optimized-routines/math/tgamma128.[ch].
*/
-#define DECLARE_WEAK(x)\
- __weak_reference(imprecise_## x, x);\
- WARN_IMPRECISE(x)
+long double tgamma128(long double x);
-#define DECLARE_IMPRECISE(f) \
- long double imprecise_ ## f ## l(long double v) { return f(v); }\
- DECLARE_WEAK(f ## l)
+long double
+tgammal(long double x)
+{
-DECLARE_IMPRECISE(tgamma);
+ return tgamma128(x);
+}
diff --git a/lib/msun/man/lgamma.3 b/lib/msun/man/lgamma.3
--- a/lib/msun/man/lgamma.3
+++ b/lib/msun/man/lgamma.3
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 8, 2017
+.Dd March 1, 2024
.Dt LGAMMA 3
.Os
.Sh NAME
@@ -167,15 +167,6 @@
For large non-integer negative values,
.Fn tgamma
will underflow.
-.Sh BUGS
-To conform with newer C/C++ standards, a stub implementation for
-.Nm tgammal
-was committed to the math library, where
-.Nm tgammal
-is mapped to
-.Nm tgamma .
-Thus, the numerical accuracy is at most that of the 53-bit double
-precision implementation.
.Sh SEE ALSO
.Xr math 3
.Sh STANDARDS
@@ -212,3 +203,11 @@
.Fn tgamma
function appeared in
.Fx 5.0 .
+The 128-bit
+.Ft long double
+version of
+.Fn tgammal
+replaced the 80-bit stub version in
+version in
+.Fx 16 ,
+thanks to an appropriate implementation from ARM.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 12, 12:00 PM (5 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16610264
Default Alt Text
D44168.id135273.diff (2 KB)
Attached To
Mode
D44168: lib/msun: Fix tgammal(3) on IEEE 128-bit platforms
Attached
Detach File
Event Timeline
Log In to Comment