Author: mmokhi (ports committer)
Date: Wed Feb 15 07:59:54 2017
New Revision: 313761
URL: https://svnweb.freebsd.org/changeset/base/313761
Log:
Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.
PR: 216850 216851 216852 216856 216857 216858
Submitted by: mmokhi
Reported by: s...@troutmask.apl.washington.edu
Reviewed by: bde, mat, theraven
Approved by: bde (src committer), mat (mentor)
Differential Revision:https://reviews.freebsd.org/D9491
Added:
head/lib/msun/src/catrigl.c
- copied, changed from r313732, head/lib/msun/src/catrigf.c
Modified:
head/lib/msun/Makefile
head/lib/msun/Symbol.map
Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile Wed Feb 15 07:22:47 2017(r313760)
+++ head/lib/msun/Makefile Wed Feb 15 07:59:54 2017(r313761)
@@ -107,7 +107,7 @@ COMMON_SRCS+= e_acoshl.c e_acosl.c e_asi
.endif
# C99 complex functions
-COMMON_SRCS+= catrig.c catrigf.c \
+COMMON_SRCS+= catrig.c catrigf.c catrigl.c \
s_ccosh.c s_ccoshf.c s_cexp.c s_cexpf.c \
s_cimag.c s_cimagf.c s_cimagl.c \
s_conj.c s_conjf.c s_conjl.c \
Modified: head/lib/msun/Symbol.map
==
--- head/lib/msun/Symbol.mapWed Feb 15 07:22:47 2017(r313760)
+++ head/lib/msun/Symbol.mapWed Feb 15 07:59:54 2017(r313761)
@@ -285,3 +285,13 @@ FBSD_1.3 {
FBSD_1.4 {
lgammal_r;
};
+
+/* First added in 12.0-CURRENT */
+FBSD_1.5 {
+ cacoshl;
+ cacosl;
+ casinhl;
+ casinl;
+ catanl;
+ catanhl;
+};
Copied and modified: head/lib/msun/src/catrigl.c (from r313732,
head/lib/msun/src/catrigf.c)
==
--- head/lib/msun/src/catrigf.c Tue Feb 14 16:49:32 2017(r313732, copy
source)
+++ head/lib/msun/src/catrigl.c Wed Feb 15 07:59:54 2017(r313761)
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2012 Stephen Montgomery-Smith
+ * Copyright (c) 2017 Mahdi Mokhtari
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,38 +45,53 @@ __FBSDID("$FreeBSD$");
#include
#include
+#include "invtrig.h"
#include "math.h"
#include "math_private.h"
#undef isinf
-#define isinf(x) (fabsf(x) == INFINITY)
+#define isinf(x) (fabsl(x) == INFINITY)
#undef isnan
#define isnan(x) ((x) != (x))
#defineraise_inexact() do { volatile float junk = 1 + tiny; } while(0)
#undef signbit
-#define signbit(x) (__builtin_signbitf(x))
+#define signbit(x) (__builtin_signbitl(x))
-static const float
+static const long double
A_crossover = 10,
B_crossover = 0.6417,
-FOUR_SQRT_MIN =0x1p-61,
-QUARTER_SQRT_MAX = 0x1p61,
-m_e = 2.7182818285e0, /* 0xadf854.0p-22 */
-m_ln2 =6.9314718056e-1,/* 0xb17218.0p-24 */
-pio2_hi = 1.5707962513e0, /* 0xc90fda.0p-23 */
-RECIP_EPSILON =1 / FLT_EPSILON,
-SQRT_3_EPSILON = 5.9801995673e-4,/* 0x9cc471.0p-34 */
-SQRT_6_EPSILON = 8.4572793338e-4,/* 0xddb3d7.0p-34 */
-SQRT_MIN = 0x1p-63;
+FOUR_SQRT_MIN =0x1p-8189L,
+QUARTER_SQRT_MAX = 0x1p8189L,
+RECIP_EPSILON =1 / LDBL_EPSILON,
+SQRT_MIN = 0x1p-8191L;
+
+#if LDBL_MANT_DIG == 64
+static const union IEEEl2bits
+um_e = LD80C(0xadf85458a2bb4a9b, 1, 2.71828182845904523536e+0L),
+um_ln2 = LD80C(0xb17217f7d1cf79ac, -1, 6.93147180559945309417e-1L);
+#definem_e um_e.e
+#definem_ln2 um_ln2.e
+static const long double
+/* The next 2 literals for non-i386. Misrounding them on i386 is harmless. */
+SQRT_3_EPSILON = 5.70316273435758915310e-10, /* 0x9cc470a0490973e8.0p-94 */
+SQRT_6_EPSILON = 8.06549008734932771664e-10; /* 0xddb3d742c265539e.0p-94 */
+#elif LDBL_MANT_DIG == 113
+static const long double
+m_e = 2.71828182845904523536028747135266250e0L, /*
0x15bf0a8b1457695355fb8ac404e7a.0p-111 */
+m_ln2 =6.93147180559945309417232121458176568e-1L, /*
0x162e42fefa39ef35793c7673007e6.0p-113 */
+SQRT_3_EPSILON = 2.40370335797945490975336727199878124e-17,/*
0x1bb67ae8584caa73b25742d7078b8.0p-168 */
+SQRT_6_EPSILON = 3.39934988877629587239082586223300391e-17;/*
0x13988e1409212e7d0321914321a55.0p-167 */
+#else
+#error "Unsupported long double format"
+#endif
static const volatile float
-pio2_lo = 7.5497899549e-8,/* 0xa22169.0p-47 */
tiny = 0x1p-100;
-static float complex clog_for_large_values(float complex z);
+static long double complex clog_for_large_values(long double