summaryrefslogtreecommitdiffstats
path: root/lib/msun/src
Commit message (Collapse)AuthorAgeFilesLines
* MFC r318259:dim2017-05-162-2/+2
| | | | | | | | | Silence a -Wunused warning about the junk variable being used to raise an inexact floating point exception. The variable cannot be eliminated, unfortunately, otherwise the desired addition triggering the exception will be emitted neither by clang, nor by gcc. Reviewed by: Steve Kargl, bde
* MFC r305380:bde2016-09-191-0/+6
| | | | | | Fix missing fmodl() on arches with 53-bit long doubles. PR: 199422, 211965
* Fix frexpl() declaration to not include the field name.trasz2016-06-091-1/+1
| | | | MFC after: 1 month
* lib: minor spelling fixes in comments.pfg2016-05-012-2/+2
| | | | No functional change.
* In libm's exp2(3), avoid left-shifting a negative integer, which isdim2015-08-091-2/+2
| | | | | | | undefined. Replace it with the intended value, in a defined way. Reviewed by: bde MFC after: 3 days
* Follow up to r284427: fix NaN mixing for ctanhf too.tijl2015-06-151-1/+2
|
* - Change comments to be more consistent with s_ccosh.c and s_csinh.c.tijl2015-06-152-20/+21
| | | | | | | | - Fix a case where NaNs were not mixed correctly and signalling NaNs were not converted to quiet NaNs. - Eliminate two negations from ctan(z). In collaboration with: bde
* Fix some exceptional cases where the sign of the result is unspecifiedtijl2015-06-152-47/+43
| | | | | | | but must still satisfy csinh(conj(z)) == conj(csinh(z)) and csinh(-z) == -csinh(z). This allows eliminating two negations from csin(z). In collaboration with: bde
* Fix some exceptional cases where the sign of the result is unspecifiedtijl2015-06-152-34/+32
| | | | | | | but must still satisfy ccosh(conj(z)) == conj(ccosh(z)) and ccosh(-z) == ccosh(z). In collaboration with: bde
* In r279493, the functions pzero[f](), qzero[f], pone[f](),kargl2015-05-174-4/+4
| | | | | | | | and qone[f]() were marked as __inline, but their forward declarations were not updated. Fix the forward declarations to match the actual function declarations. Requested by: bde
* According to POSIX.1-2008, the Bessel functions of second kindkargl2015-03-106-22/+57
| | | | | | | | | should raise a divide-by-zero floating point exception for x = +-0 and an invalid floating point exception for x < 0 including x = -Inf. Update the code to raise the exception and update the documentation with hopefully better description of the behavior. Reviewed by: bde (code only)
* Give compilers a stronger hint to inline the functionskargl2015-03-014-8/+16
| | | | | pzero[f], qzero[f], pone[f], and qone[f]. While here fix the function declarations in accordance with style(9).
* When j0() and j1() were converted to j0f() and j1f(), the thresholdkargl2015-03-012-16/+16
| | | | | | | | | | values for the different invervals were not converted correctly. Adjust the threshold values to values, which should agree with the comments. Reported by: cognet (j1f only) Discussed with: pfg, bde Reviewed by: bde
* msun: drop unnecessary checks (part 2).pfg2015-02-244-4/+4
| | | | | | Drop an unnecessary check in some calculations. The check would have Coverity falsely conclude that a variable could be left undefined.
* msun: drop unnecessary checks.pfg2015-02-224-4/+4
| | | | | | | | | Drop an unnecessary check in some calculations. The check would have Coverity falsely conclude that variables could be left undefined. Discussed with: kargl, bde Reviewed by: bde
* Truncate the exponent 'n' of type long to a domain containedkargl2015-02-071-19/+9
| | | | | | | | | | within [INT_MIN, INT_MAX] where the magnitude of the lower and upper bounds are sufficiently large to span the range of scalbn[fl]. While here, remove the GNU style bug in the function declarations. Reviewed by: bde, pfg
* scanblnl: drop extra braces.pfg2015-02-031-2/+1
| | | | Pointed out by: bde
* Reduce confusion in scalbnl() family of functions.pfg2015-02-031-3/+10
| | | | | | | | | | | The changes unrelated to the bug in r277948 made the code very difficult to understand to both coverity and regular humans so take a step back to something that is much easier to understand for both and follows better the original code. CID: 1267992, 1267993, 1267994 Discussed with: kargl
* msun: use previously ignored value.pfg2015-01-301-22/+4
| | | | | | | | This fixes evaluation of exceptional values in scalblnl(). While here, simplify the code as suggested by Bruce Evans. Reported by: clang static analyzer MFC after: 1 week
* Clarify to explain that C99 conforming compilers don't need CMPLX*().ed2014-12-241-3/+2
| | | | Discussed with: kargl@
* Rename cpack*() to CMPLX*().ed2014-12-1622-180/+193
| | | | | | | | | | | | | | | The C11 standard introduced a set of macros (CMPLX, CMPLXF, CMPLXL) that can be used to construct complex numbers from a pair of real and imaginary numbers. Unfortunately, they require some compiler support, which is why we only define them for Clang and GCC>=4.7. The cpack() function in libm performs the same task as CMPLX(), but cannot be used to generate compile-time constants. This means that all invocations of cpack() can safely be replaced by C11's CMPLX(). To keep the code building with GCC 4.2, provide copies of CMPLX() that can at least be used to generate run-time complex numbers. This makes it easier to build some of the functions outside of libm.
* Adjust the |x| small limit from 0x1p-7 to 0x1p-9. Thiskargl2014-12-081-1/+1
| | | | | | | adjustment increases the number of correctly rounded cases within the interval on i386. Requested by: bde
* Update the constants associated with the evaluation of j0f(x)kargl2014-12-052-4/+4
| | | | | | | | | | for |x| small. While here, remove the explicit cast of 0.25 to float. Replace a multiplication involving 0.25 by a division using an integer constant 4. Make a similar change in j0() to minimize the diff. Suggested by: bde
* Fix a 20+ year bug by using an appropriate constant forkargl2014-12-041-2/+2
| | | | | | | the transition from one asymptotic approximation to another for the zeroth order Bessel and Neumann functions. Reviewed by: bde
* Revert r274772: it is not valid on MIPSemaste2014-11-251-2/+2
| | | | Reported by: sbruno
* Use canonical __PIC__ flagemaste2014-11-211-2/+2
| | | | | | | | It is automatically set when -fPIC is passed to the compiler. Reviewed by: dim, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1179
* The value small=2**-(p+3), where p is the precision, can be determine fromkargl2014-10-092-44/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lgamma(x) = -log(x) - log(1+x) + x*(1-g) + x**2*P(x) with g = 0.57... being the Euler constant and P(x) a polynomial. Substitution of small into the RHS shows that the last 3 terms are negligible in comparison to the leading term. The choice of 3 may be conservative. The value large=2**(p+3) is detemined from Stirling's approximation lgamma(x) = x*(log(x)-1) - log(x)/2 + log(2*pi)/2 + P(1/x)/x Again, substitution of large into the RHS reveals the last 3 terms are negligible in comparison to the leading term. Move the x=+-0 special case into the |x|<small block. In the ld80 and ld128 implementaion, use fdlibm compatible comparisons involving ix, lx, and llx. This replaces several floating point comparisons (some involving fabsl()) and also fixes the special cases x=1 and x=2. While here . Remove unnecessary parentheses. . Fix/improve comments due to the above changes. . Fix nearby whitespace. * src/e_lgamma_r.c: . Sort declaration. . Remove unneeded explicit cast for type conversion. . Replace a double literal constant by an integer literal constant. * src/e_lgammaf_r.c: . Sort declaration. * ld128/e_lgammal_r.c: . Replace a long double literal constant by a double literal constant. * ld80/e_lgammal_r.c: . Remove unused '#include float.h' . Replace a long double literal constant by a double literal constant. Requested by: bde
* Remove whitespace and 2 blank lines.kargl2014-10-021-14/+12
|
* * Whitespace.kargl2014-09-251-3/+1
|
* For targets that have a signed zero, lgamma_r(-0, &signgamp) shouldkargl2014-09-172-2/+10
| | | | | | set signgamp = -1. Submitted by: enh at google dot com (e_lgamma[f]_r.c)
* * Makefile:kargl2014-09-156-100/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . Hook e_lgammal[_r].c to the build. . Create man page links for lgammal[-r].3. * Symbol.map: . Sort lgammal to its rightful place. . Add FBSD_1.4 section for the new lgamal_r symbol. * ld128/e_lgammal_r.c: . 128-bit implementataion of lgammal_r(). * ld80/e_lgammal_r.c: . Intel 80-bit format implementation of lgammal_r(). * src/e_lgamma.c: . Expose lgammal as a weak reference to lgamma for platforms where long double is mapped to double. * src/e_lgamma_r.c: . Use integer literal constants instead of real literal constants. Let compiler(s) do the job of conversion to the appropriate type. . Expose lgammal_r as a weak reference to lgamma_r for platforms where long double is mapped to double. * src/e_lgammaf_r.c: . Fixed the Cygnus Support conversion of e_lgamma_r.c to float. This includes the generation of new polynomial and rational approximations with fewer terms. For each approximation, include a comment on an estimate of the accuracy over the relevant domain. . Use integer literal constants instead of real literal constants. Let compiler(s) do the job of conversion to the appropriate type. This allows the removal of several explicit casts of double values to float. * src/e_lgammal.c: . Wrapper for lgammal() about lgammal_r(). * src/imprecise.c: . Remove the lgamma. * src/math.h: . Add a prototype for lgammal_r(). * man/lgamma.3: . Document the new functions. Reviewed by: bde
* Remove an initialized, but otherwise, unused variable.kargl2014-09-042-2/+0
|
* According to the ISO C standard, lgamma(-integer) returnskargl2014-09-012-11/+13
| | | | | | | | | | | | inf and raises the divided-by-zero exception. Compilers constant fold one/zero to inf but do not raise the exception. Introduce a volatile vzero to prevent the constant folding. Move the declaration of zero into the main declaration block. While here, fix a nearby disordering of 'lx,ix' Discussed with: bde
* Fix a tab that somehow became 8 spaces.kargl2014-09-012-10/+5
| | | | | | | | | | | | | Remove parentheses in a return statement to be consistent with the rest of the file. Rename sin_pi() in the float version to sin_pif(). Remove large comment that precedes sin_pif(). The comment duplicates a comment in e_lgamma_r.c where the algorithm is documented. Requested by: bde
* Compute sin(pi*x) without actually doing the pi*x multiplication.kargl2014-08-312-53/+49
| | | | | | | | | | sin_pi(x) is only called for x < 0 and |x| < 2**(p-1) where p is the precision of x. The new argument reduction is an optimization compared to the old code, and it removes a chunk of dead code. Accuracy tests in the intervals (-21,-20), (-20,-19), ... (-1,0) show no differences between the old and new code. Obtained from: bde
* Fix the order of "const volatile" to be consistent withkargl2014-08-302-2/+2
| | | | the rest of msun.
* Make tiny volatile to prevent the compiler(s) fromkargl2014-08-302-2/+5
| | | | | constant folding expressions of the form "1 - tiny", which are used to raise FE_INEXACT.
* When r255294 was committed, it exposed the symbols lgammal, powl,kargl2014-08-091-22/+3
| | | | | | | | | | and tgammal in libm. These functions are part of ISO/IEC 9899:1999 and their prototypes should have been moved into the appropriate __ISO_C_VISIBLE >= 1999 section. After moving the prototypes, remnants of r236148 can be removed. PR: standards/191754 Reviewed by: bde
* * Update the comments to agree with commit r226595.kargl2014-07-131-4/+4
| | | | * While here, fix a nearby typo in a comment.
* * Makefile:kargl2014-07-133-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . Add s_erfl.c to building libm. . Add MLINKS for erfl.3 and erfcl.3. * Symbol.map: . Move erfl and erfcl to their proper location. * ld128/s_erfl.c: . Implementations of erfl and erfcl in the IEEE 754 128-bit format. * ld80/s_erfl.c: . Implementations of erfl and erfcl in the Intel 80-bit format. * man/erf.3: . Document the new functions. . While here, remove an incomplete sentence. * src/imprecise.c: . Remove the stupidity of mapping erfl and erfcl to erf and erfc. * src/math.h: . Move the declarations of erfl and erfcl to their proper place. * src/s_erf.c: . For architectures where double and long double are the same floating point format, use weak references to map erfl to erf and ercl to erfc. Reviewed by: bde (many earlier versions)
* * Use 9 digits instead of 11 digits in efx and efx8.kargl2014-07-131-54/+49
| | | | | | | | | | | | | | | | | | * Update the domain and range of comments for the polynomial approximations, including using the the correct variable names (e.g., pp(x) instead of p(x)). * Use hex values of the form 0x3e0375d4 instead of 0x1.06eba8p-3, which was obtained from printf("%.6a"). * In the domain [0.84375, 1.25], qa(x) can be reduced from a 4th order polynomial to 3rd order. * In the domain [1.25,1/0.35], sa(x) can be reduced from a 4th order polynomial to 3rd order. * In the domain [1/0.35, 11], the 4th order polynomials rb(x) and sb(x) can be reduced to 2nd and 3rd order, respectively.
* * Update the comments that refer to erf[c](nan) and erf[c](+-inf)kargl2014-07-131-4/+4
| | | | to use erf[c]f.
* * Use the volatile qualifier for 'tiny' to prevent compilerskargl2014-07-132-10/+21
| | | | | | | | | | from erronously constant folding expressions of the form '1 - tiny'. This allows erf[f](x) to raise INEXACT. * Use 0.5, 1, and 2, which are exactly representable in radix-2 floating point formats. This reduces diffs between s_erf[fl].c. * While here, add a comment about efx and efx8.
* Whitespace.kargl2014-07-131-25/+18
|
* Remove ia64.marcel2014-07-071-4/+0
| | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan
* Use __fenv_static for all static inline functions.andrew2014-01-251-3/+3
|
* * msun/man/cosh.3:kargl2013-12-313-7/+15
| | | | | | | | | | | | | | | | | | | | * msun/man/sinh.3: * msun/man/tanh.3: . Fix grammar. * msun/src/e_coshl.c: * msun/src/e_sinhl.c: . Fix comment. * msun/src/s_tanhl.c: . Remove unused variables. . Fix location/indentation of comments. . Use comparison involving ints instead of long double. . Re-order polynomial evaluation on ld128 for |x| < 0.25. For now, retain the older order in an "#if 0 ... #else" block. . Use int comparison to short-circuit the |x| < 1.5 condition. Requested by: bde
* * Makefile:kargl2013-12-308-6/+446
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . Hook coshl, sinhl, and tanhl into libm. . Create symbolic links for corresponding manpages. . While here remove a nearby extraneous space. * Symbol.map: * src/math.h: . Move coshl, sinhl, and tanhl to their proper locations. * man/cosh.3: * man/sinh.3: * man/tanh.3: . Update the manpages. * src/e_cosh.c: * src/e_sinh.c: * src/s_tanh.c: . Add weak reference for LBDL_MANT_DIG==53 targets. * src/imprecise.c: . Remove the coshl, sinhl, and tanhl kludge. * src/e_coshl.c: . ld80 and ld128 implementation of coshl(). * src/e_sinhl.c: . ld80 and ld128 implementation of sinhl(). * src/s_tanhl.c: . ld80 and ld128 implementation of tanhl(). Obtained from: bde (mostly), das and kargl
* Yet, another attempt to fix the libm breakage due to thekargl2013-11-071-0/+2
| | | | | | changes in s_roundl.c to use bit twiddling. Reported by: ian
* Fix bulding libm on platforms with LDBL_MANT_DIG == 53.kargl2013-11-071-0/+4
| | | | Reported by: ian
OpenPOWER on IntegriCloud