aboutsummaryrefslogtreecommitdiff
path: root/lib/msun/ld80/s_expl.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/msun: Cleanup after $FreeBSD$ removalSteve Kargl2024-01-281-1/+0
| | | | | | | Remove no longer needed explicit inclusion of sys/cdefs.h. PR: 276669 MFC after: 1 week
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Cleanup debugging code in libmSteve Kargl2023-08-031-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | David Das (das@) committed Bruce Evan's (bde's) WIP code for expl() and logl() in git revision 25a4d6bfda29119. That code included instrumentation that allowed bde to generate pari scripts used in testing/debugging. This patch removes that instrumentation as it is unlikely that others will ever use it. * math/libm/msun/src/math_private.h: . Remove bde's macros for the generation of pari scripts. * math/libm/msun/ld128/s_expl.c: * math/libm/msun/ld128/s_logl.c: * math/libm/msun/ld80/s_expl.c: * math/libm/msun/ld80/s_logl.c: . Remove bde's DOPRINT_START macro. . Change RETURNP to RETURNF. . Change RETURN2P to RETURNF. Adjust arguments as needed. . Change RETURNPI to RETURNI. . Change RETURN2PI to RETURNI. Adjust arguments as needed. PR: 272765 MFC after: 1 week
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Centralize the complications for special efficient rounding to integers.Bruce Evans2018-07-201-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | This was open-coded in range reduction for trig and exp functions. Now there are 3 static inline functions rnint[fl]() that replace open-coded expressions, and type-generic irint() and i64rint() macros that hide the complications for efficiently using non-generic irint() and irintl() functions and casts. Special details: ld128/e_rem_pio2l.h needs to use i64rint() since it needs a 46-bit integer result. Everything else only needs a (less than) 32-bit integer result so uses irint(). Float and double cases now use float_t and double_t locally instead of STRICT_ASSIGN() to avoid bugs in extra precision. On amd64, inline asm is now only used for irint() on long doubles. The SSE asm for irint() on amd64 only existed because the ifdef tangles made the correct method of simply casting to int for this case non-obvious. Notes: svn path=/head/; revision=336545
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* * ld80/k_expl.h:Steve Kargl2013-12-301-230/+45
| | | | | | | | | | | | | | | | | | * ld128/k_expl.h: . Split out a computational kernel,__k_expl(x, &hi, &lo, &k) from expl(x). x must be finite and not tiny or huge. The kernel returns hi and lo values for extra precision and an exponent k for a 2**k scale factor. . Define additional kernels k_hexpl() and hexpl() that include a 1/2 scaling and are used by the hyperbolic functions. * ld80/s_expl.c: * ld128/s_expl.c: . Use the __k_expl() kernel. Obtained from: bde Notes: svn path=/head/; revision=260066
* ld80 and ld128 implementations of expm1l(). This code started lifeSteve Kargl2013-06-031-0/+165
| | | | | | | | | | | | | | | | | as a fairly faithful implementation of the algorithm found in PTP Tang, "Table-driven implementation of the Expm1 function in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18, 211-222 (1992). Over the last 18-24 months, the code has under gone significant optimization and testing. Reviewed by: bde Obtained from: bde (most of the optimizations) Notes: svn path=/head/; revision=251343
* ld80/s_expl.c:Steve Kargl2013-06-031-2/+2
| | | | | | | | | | | | | | | | | * Use integral numerical constants, and let the compiler do the conversion to long double. ld128/s_expl.c: * Use integral numerical constants, and let the compiler do the conversion to long double. * Use the ENTERI/RETURNI macros, which are no-ops on ld128. This however makes the ld80 and ld128 identical. Reviewed by: bde (as part of larger diff) Notes: svn path=/head/; revision=251339
* Micro-optimization: move the unary mius operator to operateSteve Kargl2013-06-031-2/+2
| | | | | | | | | on a literal constant. Obtained from: bde Notes: svn path=/head/; revision=251338
* ld80/s_expl.c:Steve Kargl2013-06-031-7/+5
| | | | | | | | | | | | | | | | | | | * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.man. * Fix an off-by-one for small arguments |x| < 0x1p-65. ld128/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.manh and u.xbits.manl. * Fix an off-by-one for small arguments |x| < 0x1p-114. Obtained from: bde Notes: svn path=/head/; revision=251335
* ld80/s_expl.c:Steve Kargl2013-06-031-6/+4
| | | | | | | | | | | | | | | | | * Update the evaluation of the polynomial. This allows the removal of the now unused variables t23 and t45. ld128/s_expl.c: * Update the evaluation of the polynomial and the intermediate result t. This update allows several numerical constants to be written as double rather than long double constants. Update the constants as appropriate. Obtained from: bde Notes: svn path=/head/; revision=251334
* Rename a few P2, P3, ... coefficients to A2, A3, ... missed inSteve Kargl2013-06-031-3/+3
| | | | | | | my previous commit. Notes: svn path=/head/; revision=251333
* Update a comment to reflect that we are using an endpoint ofSteve Kargl2013-06-031-1/+1
| | | | | | | an interval instead of a midpoint. Notes: svn path=/head/; revision=251330
* Add a u suffix to the IEEEl2bits unions o_threshold and u_threshold,Steve Kargl2013-06-031-4/+7
| | | | | | | | | | and use macros to access the e component of the unions. This allows the portions of the code in ld80 to be identical to the ld128 code. Obtained from: bde Notes: svn path=/head/; revision=251328
* Introduce the macro LOG2_INTERVAL, which is log2(number of intervals).Steve Kargl2013-06-031-1/+3
| | | | | | | | | | Use the macroi as a micro-optimization to convert a subtraction and division to a shift. Obtained from: bde Notes: svn path=/head/; revision=251327
* Whitespace.Steve Kargl2013-06-031-3/+3
| | | | Notes: svn path=/head/; revision=251325
* * Rename the polynomial coefficients from P2, P3, ... to A2, A3, ....Steve Kargl2013-06-031-10/+9
| | | | | | | | | | | | | The names now coincide with the name used in PTP Tang's paper. * Rename the variable from s to tbl to better reflect that this is a table, and to be consistent with the naming scheme in s_exp2l.c Reviewed by: bde (as part of larger diff) Notes: svn path=/head/; revision=251321
* * Style(9). Start non-Copyright fancy formatted comments with /**.Steve Kargl2013-06-031-1/+1
| | | | | | | Reviewed by: bde (as part of larger diff) Notes: svn path=/head/; revision=251316
* ld80/s_expl.c:Steve Kargl2013-06-031-1/+1
| | | | | | | | | | | | | | * Update Copyright years to include 2013. ld128/s_expl.c: * Correct and update Copyright years. This code originated from the ld80 version, so it should reflect the same time period. Reviewed by: bde (as part of larger diff) Notes: svn path=/head/; revision=251315
* * Update the comment that explains the choice of values in theSteve Kargl2012-10-131-6/+7
| | | | | | | | | | | | | table and the requirement on trailing zero bits. * Remove the __aligned() compiler directives as these were found to have a negative effect on the produced code. Submitted by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=241516
* * src/math_private.h:Steve Kargl2012-09-291-2/+2
| | | | | | | | | | | | | | | | | | . Change the API for the LD80C by removing the explicit passing of the sign bit. The sign can be determined from the last parameter of the macro. . On i386, load long double by bit manipulations to work around at least a gcc compiler issue. On non-i386 ld80 architectures, use a simple assignment. * ld80/s_expl.c: . Update the only consumer of LD80C. Submitted by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=241051
* * ld80/s_expl.c:Steve Kargl2012-09-231-1/+1
| | | | | | | | | | | | | | | | | | | . Fix the threshold for expl(x) where |x| is small. . Also update the previously incorrect comment to match the new threshold. * ld128/s_expl.c: . Re-order logic in exceptional cases to match the logic used in other long double functions. . Fix the threshold for expl(x) where is |x| is small. . Also update the previously incorrect comment to match the new threshold. Submitted by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=240866
* Fix whitespace issue.Steve Kargl2012-09-231-1/+1
| | | | | | | Approved by: das (mentor, implicit) Notes: svn path=/head/; revision=240865
* * ld80/s_expl.c:Steve Kargl2012-09-231-4/+4
| | | | | | | | | | | | | | | | | | | | . Guard a comment from reformatting by indent(1). . Re-order variables in declarations to alphabetical order. . Remove a banal comment. * ld128/s_expl.c: . Add a comment to point to ld80/s_expl.c for implementation details. . Move the #define of INTERVAL to reduce the diff with ld80/s_expl.c. . twom10000 does not need to be volatile, so move its declaration. . Re-order variables in declarations to alphabetical order. . Add a comment that describes the argument reduction. . Remove the same banal comment found in ld80/s_expl.c. Reviewed by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=240864
* * Update the lookup table to use 53-bit high and low values.Steve Kargl2012-09-231-131/+134
| | | | | | | | | | | | | | | | Also, update the comment to describe the choice of using a high and low decomposition of 2^(i/INTERNVAL) for 0 <= i <= INTERVAL in preparation for an implementation of expm1l. * Move the #define of INTERVAL above the comment, because the comment refers to INTERVAL. Reviewed by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=240861
* Whitespace.Steve Kargl2012-07-301-1/+1
| | | | | | | | Submitted by: bde Approved by: das (pre-approved) Notes: svn path=/head/; revision=238923
* Replace the macro name NUM with INTERVALS. This change providesSteve Kargl2012-07-261-11/+11
| | | | | | | | | | | | | | compatibility with the INTERVALS macro used in the soon-to-be-commmitted expm1l() and someday-to-be-committed log*l() functions. Add a comment into ld128/s_expl.c noting at gcc issue that was deleted when rewriting ld80/e_expl.c as ld128/s_expl.c. Requested by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=238784
* * ld80/expl.c:Steve Kargl2012-07-261-5/+1
| | | | | | | | | | | | | | | | . Remove a few #ifdefs that should have been removed in the initial commit. . Sort fpmath.h to its rightful place. * ld128/s_expl.c: . Replace EXPMASK with its actual value. . Sort fpmath.h to its rightful place. Requested by: bde Approved by: das (mentor) Notes: svn path=/head/; revision=238783
* Compute the exponential of x for Intel 80-bit format and IEEE 128-bitSteve Kargl2012-07-231-0/+304
format. These implementations are based on PTP Tang, "Table-driven implementation of the exponential function in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 15, 144-157 (1989). PR: standards/152415 Submitted by: kargl Reviewed by: bde, das Approved by: das (mentor) Notes: svn path=/head/; revision=238722