summaryrefslogtreecommitdiffstats
path: root/lib/msun
Commit message (Collapse)AuthorAgeFilesLines
...
* Use __ldexp_exp() to simplify things and improve accuracy for x neardas2011-10-214-27/+10
| | | | the overflow threshold.
* The cexp() and {,c}{cos,sin}h functions all need to be able to computedas2011-10-216-33/+210
| | | | | | | | | | | exp(x) scaled down by some factor, and the challenge is doing this accurately when exp(x) would overflow. This change replaces all of the tricks we've been using with common __ldexp_exp() and __ldexp_cexp() routines that handle all the scaling. bde plans to improve on this further by moving the guts of exp() into k_exp.c and handling the scaling in a more direct manner. But the current approach is simple and adequate for now.
* Use STRICT_ASSIGN() to ensure that the compiler doesn't screw thingsdas2011-10-214-5/+13
| | | | | | up by storing x in a wider type than it's supposed to. Submitted by: bde
* Per IEEE754r, pow(1, y) is 1 even if y is NaN, and pow(-1, +-Inf) is 1.das2011-10-212-2/+8
| | | | MFC after: 2 weeks
* Bugfix: feenableexcept() and fedisableexcept() should just return thedas2011-10-212-8/+8
| | | | | | old exception mask, not mask | ~FE_ALL_EXCEPT. MFC after: 2 weeks
* It's no longer accurate to say that math.h "constitute[s] the C mathdas2011-10-171-1/+16
| | | | | | library," since complex.h, tgmath.h, and fenv.h are also part of the math library. Replace the outdated sentence with some references to the other parts.
* Add c{cos,sin,tan}{,h}{,f} functions. This is joint work withdas2011-10-1717-12/+871
| | | | bde and kargl.
* - change "is is" to "is" or "it is"eadler2011-10-161-1/+1
| | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days
* Use #include "fenv.h" instead of #include <fenv.h>. This makes itdas2011-10-167-7/+7
| | | | | | more convenient to compile the math library by itself. Requested by: bde
* Fix some non-standard variable declarations.das2011-10-161-10/+10
|
* Optimize the case of pure imaginary arguments. Calls like this aredas2011-10-162-2/+9
| | | | | | common, e.g., in DFT implementations. Discussed with: bde, kargl
* Move the macros GET_LDBL_EXPSIGN() and SET_LDBL_EXPSIGN() intodas2011-10-162-15/+19
| | | | math_private.h, so they can be used elsewhere in the math library.
* Remove an unused variable.das2011-10-161-1/+1
|
* Remove some unnecessary initializations.das2011-10-156-6/+2
| | | | Obtained from: DragonFlyBSD
* Various changes to improve the accuracy and speed of log{2,10}{,f}.das2011-10-156-72/+143
| | | | | | | | | | | | | | | | | - Rename __kernel_log() to k_log1p(). - Move some of the work that was previously done in the kernel log into the callers. This enables further refactoring to improve accuracy or speed, although I don't recall the details. - Use extra precision when adding the final scaling term, which improves accuracy. - Describe and work around compiler problems that break some of the multiprecision calculations. A fix for a small bug is also included: - Add a special case for log*(1). This is needed to ensure that log*(1) == +0 instead of -0, even when the rounding mode is FE_DOWNWARD. Submitted by: bde
* Style fixes and updates to comments.das2011-10-154-32/+34
| | | | Submitted by: bde
* Don't define FP_FAST_FMA on sparc64; with the recent fixes, fma() isdas2011-10-151-5/+2
| | | | | | no longer "fast" on sparc64. (It really wasn't to begin with, since the old implementation was using long doubles, and long doubles are emulated in software on sparc64.)
* Add INSERT_WORD64 and EXTRACT_WORD64 macros for use in s_fma.c.das2011-10-151-0/+24
|
* Replace two lines accidentally removed in r226218. Thanks to bdedas2011-10-151-0/+3
| | | | for noticing this.
* Fix a double-rounding bug in fma{,f,l}. The bug would occur indas2011-10-153-125/+231
| | | | | | | | | | round-to-nearest mode when the result, rounded to twice machine precision, was exactly halfway between two machine-precision values. The essence of the fix is to simulate a "sticky bit" in the pathological cases, which is how hardware implementations break the ties. MFC after: 1 month
* Refactor this code by introducing separate functions to handle thedas2011-10-112-92/+164
| | | | | extra-precision add and multiply operations. This simplifies future work but shouldn't result in any functional change.
* Provide external definitions of all of the standardized functions indas2011-10-1022-91/+288
| | | | | | | | | | | | | | | | | fenv.h that are currently inlined. The definitions are provided in fenv.c via 'extern inline' declaractions. This assumes the compiler handles 'extern inline' as specified in C99, which has been true under FreeBSD since 8.0. The goal is to eventually remove the 'static' keyword from the inline definitions in fenv.h, so that non-inlined references all wind up pointing to the same external definition like they're supposed to. I am deferring the second step to provide a window where newly-compiled apps will still link against old math libraries. (This isn't supported, but there's no need to cause undue breakage.) Reviewed by: stefanf, bde
* In the libm access macros for the double type, z can sometimeskargl2011-06-191-2/+1
| | | | | | | | be used uninitialized. This can lead to spurious exceptions and bit clobbering. Submitted by: bde Approved by: das (mentor)
* Fix clang warnings.benl2011-06-181-1/+1
| | | | Approved by: philip (mentor)
* Clean up the unneeded cpp macro INLINE_REM_PIO2L.kargl2011-05-305-11/+2
| | | | | Reviewed by: das Approved by: das (mentor)
* Improve the accuracy from a max ULP of ~2000 to max ULP < 0.79kargl2011-04-295-98/+321
| | | | | | | | | | | | | | | | | | | | on i386-class hardware for sinl and cosl. The hand-rolled argument reduction have been replaced by e_rem_pio2l() implementations. To preserve history the following commands have been executed: svn cp src/e_rem_pio2.c ld80/e_rem_pio2l.h mv ${HOME}/bde/ld80/e_rem_pio2l.c ld80/e_rem_pio2l.h svn cp src/e_rem_pio2.c ld128/e_rem_pio2l.h mv ${HOME}/bde/ld128/e_rem_pio2l.c ld128/e_rem_pio2l.h The ld80 version has been tested by bde, das, and kargl over the last few years (bde, das) and few months (kargl). An older ld128 version was tested by das. The committed version has only been compiled tested via 'make universe'. Approved by: das (mentor) Obtained from: bde
* Take two. Add the missing file that should have been committedkargl2011-03-123-1/+159
| | | | | | | | | | | with r219571 and re-enable building of cbrtl. 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
* Temporary disable the building of cbrtl until Ikargl2011-03-122-2/+1
| | | | | | | can determine why svn will not allow one to commit a new file. Approved by: das (implicit)
* Implement the long double version for the cube root function, cbrtl.kargl2011-03-126-18/+32
| | | | | | | | 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
* Add cexp() to the complex(3) manpage. Thanks to bde for pointing outdas2011-03-071-14/+12
| | | | that I missed this.
* Remove part of an uncommitted change that snuck into the last commit.das2011-03-071-1/+0
|
* Convert log10f() to use __kernel_log(), which is more accurate and simpler.das2011-03-071-11/+19
|
* Convert log10() to use __kernel_log(), which is more accurate and simpler.das2011-03-071-38/+16
|
* Add cexp() and cexpf().das2011-03-075-2/+317
| | | | Reviewed by: bde (earlier version)
* Fix typos - remove duplicate "the".brucec2011-02-211-1/+1
| | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* Add complex(3) manual page documenting our partial support for C99murray2011-02-202-1/+130
| | | | | | | complex arithmetic in libm. Reviewed by: David Schultz <das@FreeBSD.org> MFC after: 2 weeks
* Fix a bug where the wrong argument was passed to SET_FLOAT_WORD().das2011-02-101-2/+2
| | | | | | | This bug results in a type mismatch that happens to be harmless because of the way SET_FLOAT_WORD() works. Submitted by: bde
* Fix a bug where the wrong argument was passed to INSERT_WORDS().das2011-02-101-2/+2
| | | | | | | This bug results in a type mismatch that happens to be harmless because of the way INSERT_WORDS() works. Submitted by: bde
* For small arguments, these functions use simple approximations,das2011-02-105-5/+5
| | | | | | | e.g. cos(small) = 1, sin(small) = small. This commit tightens the thresholds at which the simple approximations are used. Reviewed by: bde
* Fix a bogus threshold that was copied from the double precision version.das2011-02-101-1/+1
| | | | | | | This commit should have no effect on correctness; it merely changes the threshold at which a simpler approximation can be used. Reviewed by: bde
* Remove duplicate .note.GNU-stack section declaration.kib2011-02-042-4/+0
| | | | Reported by: arundel
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-0768-0/+136
|
* Another minor nit: Make sure the constant here is a float so the compilerdas2010-12-071-1/+1
| | | | doesn't promote the entire expression to double.
* Fix various nits in style and comments that were pointed out by bde.das2010-12-074-13/+16
| | | | Code changes verified with md5.
* Add log2() and log2f().das2010-12-058-12/+149
|
* Add a "kernel" log function, based on e_log.c, which is useful fordas2010-12-052-0/+171
| | | | | | | | | | | | | | | implementing accurate logarithms in different bases. This is based on an approach bde coded up years ago. This function should always be inlined; it will be used in only a few places, and rudimentary tests show a 40% performance improvement in implementations of log2() and log10() on amd64. The kernel takes a reduced argument x and returns the same polynomial approximation as e_log.c, but omitting the low-order term. The low-order term is much larger than the rest of the approximation, so the caller of the kernel function can scale it to the appropriate base in extra precision and obtain a much more accurate answer than by using log(x)/log(b).
* Disable gcc's built-in rint() function when compiling s_nearbyint.c.das2010-12-031-0/+6
| | | | | | | It results in incorrect optimizations that break nearbyint(). PR: 143358 Reviewed by: bde
* Fix bug in jn(3) and jnf(3) that led to -inf resultsuqs2010-11-132-2/+12
| | | | | | | | | | | | | | | | | | | | Explanation by Steve: jn[f](n,x) for certain ranges of x uses downward recursion to compute the value of the function. The recursion sequence that is generated is proportional to the actual desired value, so a normalization step is taken. This normalization is j0[f](x) divided by the zeroth sequence member. As Bruce notes, near the zeros of j0[f](x) the computed value can have giga-ULP inaccuracy. I found for the 1st zero of j0f(x) only the leading decimal digit is correct. The solution to the issue is fairly straight forward. The zeros of j0(x) and j1(x) never coincide, so as j0(x) approaches a zero, the normalization constant switches to j1[f](x) divided by the 2nd sequence member. The expectation is that j1[f](x) is a more accurately computed value. PR: bin/144306 Submitted by: Steven G. Kargl <kargl@troutmask.apl.washington.edu> Reviewed by: bde MFC after: 7 days
* Use __FBSDID() instead of RCSID() in most .S files under lib/msun/i386,dim2010-10-0121-42/+21
| | | | | | | | and one under lib/msun/amd64. This avoids adding the identifiers to the .text section, and moves them to the .comment section instead. Suggested by: bde Approved by: rpaulo (mentor)
* This is exactly the same as the .else, so remove it.imp2010-09-131-2/+0
|
OpenPOWER on IntegriCloud