aboutsummaryrefslogtreecommitdiff
path: root/lib/msun
Commit message (Collapse)AuthorAgeFilesLines
* Use the documented machine constraint for SSE registers.Ed Schouten2009-06-111-1/+1
| | | | | | | | | | | The amd64-specific bits of msun use an undocumented constraint, which is less likely to be supported by other compilers (such as Clang). Change the code to use a more common machine constraint. Obtained from: /projects/clangbsd/ Notes: svn path=/head/; revision=194000
* Use ISO C99 style inline semantics in msun.Ed Schouten2009-06-036-15/+30
| | | | | | | | Because we use ISO C99 nowadays, we can just get rid of enforcing GNU89-style inlining. Notes: svn path=/head/; revision=193368
* Use, in uncovered part, the END() macro in order to improve debugging.Attilio Rao2009-05-2552-0/+52
| | | | | | | | | | | | In this specific case, Valgrind won't get confused when analyzing such functions. Sponsored by: Sandvine Incorporated Tested by: emaste MFC: 3 days Notes: svn path=/head/; revision=192760
* Namespace: scalb() is withdrawn from POSIX.David Schultz2009-03-141-1/+4
| | | | Notes: svn path=/head/; revision=189805
* Eliminate __real__ and __imag__ gccisms.David Schultz2009-03-144-15/+42
| | | | Notes: svn path=/head/; revision=189803
* C99 TC2 now wants FP_FAST_FMA* to be defined to 1, if the macros areDavid Schultz2009-02-071-3/+3
| | | | | | | defined at all. See also: defect report #223. Notes: svn path=/head/; revision=188272
* Use __gnu89_inline so that these files will compile with newer versionsDavid Schultz2009-01-135-5/+5
| | | | | | | | | of gcc, where the meaning of 'inline' was changed to match C99. Noticed by: rdivacky Notes: svn path=/head/; revision=187128
* Fix the types of INFINITY and NAN, which were broken in r131851. TheyDavid Schultz2009-01-081-2/+2
| | | | | | | | | | | should both be floats, not doubles. PR: 127795 Submitted by: Christoph Mallon MFC after: 2 weeks Notes: svn path=/head/; revision=186886
* Add support for the FPA floating-point format on ARM. TheMarcel Moolenaar2008-12-231-2/+12
| | | | | | | | | | | | FPA floating-point format is identical to the VFP format, but is always stored in big-endian. Introduce _IEEE_WORD_ORDER to describe the byte-order of the FP representation. Obtained from: Juniper Networks, Inc Notes: svn path=/head/; revision=186461
* Remove some unused variables.David Schultz2008-08-084-4/+1
| | | | | | | Reported by: Intel C Compiler Notes: svn path=/head/; revision=181405
* In the lineDavid Schultz2008-08-083-3/+3
| | | | | | | | | | #pragma STDC CX_LIMITED_RANGE ON the "ON" needs to be in caps. gcc doesn't understand this pragma anyway and assumes it is always on in any case, but icc supports it and cares about the case. Notes: svn path=/head/; revision=181402
* Implement cproj{,f,l}().David Schultz2008-08-076-7/+170
| | | | Notes: svn path=/head/; revision=181377
* Use cpack() and the gcc extension __imag__ to implement cimag() andDavid Schultz2008-08-076-6/+18
| | | | | | | | | | | | | | | conj() instead of using expressions like z * I. The latter is bad for several reasons: 1. It is implemented using arithmetic, which is unnecessary, and can generate floating point exceptions, contrary to the requirements on these functions. 2. gcc implements complex multiplication using a formula that breaks down for infinities, e.g., it gives INFINITY * I == nan + inf I. Notes: svn path=/head/; revision=181374
* Fix some style bogosity from fdlibm.David Schultz2008-08-032-12/+12
| | | | Notes: svn path=/head/; revision=181258
* Minor improvements:David Schultz2008-08-033-20/+20
| | | | | | | | | | - Improve the order of some tests. - Fix style. Submitted by: bde Notes: svn path=/head/; revision=181257
* A few minor corrections, including some from bde:David Schultz2008-08-023-17/+16
| | | | | | | | | | - When y/x is huge, it's faster and more accurate to return pi/2 instead of pi - pi/2. - There's no need for 3 lines of bit fiddling to compute -z. - Fix a comment. Notes: svn path=/head/; revision=181204
* On i386, gcc truncates long double constants to double precisionDavid Schultz2008-08-024-8/+127
| | | | | | | | | | | | | | | | | | | at compile time regardless of the dynamic precision, and there's no way to disable this misfeature at compile time. Hence, it's impossible to generate the appropriate tables of constants for the long double inverse trig functions in a straightforward way on i386; this change hacks around the problem by encoding the underlying bits in the table. Note that these functions won't pass the regression test on i386, even with the FPU set to extended precision, because the regression test is similarly damaged by gcc. However, the tests all pass when compiled with a modified version of gcc. Reported by: bde Notes: svn path=/head/; revision=181152
* Fix some problems with asinf(), acosf(), atanf(), and atan2f():David Schultz2008-08-014-71/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Adjust several constants for float precision. Some thresholds that were appropriate for double precision were never changed when these routines were converted to float precision. This has an impact on performance but not accuracy. (Submitted by bde.) - Reduce the degrees of the polynomials used. A smaller degree suffices for float precision. - In asinf(), use double arithmetic in part of the calculation to avoid a corner case and some complicated arithmetic involving a division and some buggy constants. This improves performance and accuracy. Max error (ulps): asinf acosf atanf before 0.925 0.782 0.852 after 0.743 0.804 0.852 As bde points out, it's cheaper for asin*() and acos*() to use polynomials instead of rational functions, but that's a task for another day. Notes: svn path=/head/; revision=181100
* Add implementations of acosl(), asinl(), atanl(), atan2l(),David Schultz2008-07-3120-69/+900
| | | | | | | | | | and cargl(). Reviewed by: bde sparc64 testing resources from: remko Notes: svn path=/head/; revision=181074
* Set WARNS=1.David Schultz2008-07-311-0/+1
| | | | | | | | I believe I've committed all the bits necessary to make this compile on all supported architectures. :crosses fingers: Notes: svn path=/head/; revision=181064
* The high part of the mantissa is 64 bits on sparc64.David Schultz2008-07-312-2/+2
| | | | Notes: svn path=/head/; revision=181063
* As in other parts of libm, mark a few constants as volatile to preventDavid Schultz2008-07-316-12/+20
| | | | | | | | | spurious optimizations. gcc doesn't support FENV_ACCESS, so when it folds constants, it assumes that the rounding mode is always the default and floating point exceptions never matter. Notes: svn path=/head/; revision=181062
* Sort the .PATH entries to give a more reasonable order of precedence:David Schultz2008-07-181-4/+5
| | | | | | | | | | | | | | | | 1. architecture-specific files 2. long double format-specific files 3. bsdsrc 4. src 5. man The original order was virtually the opposite of this. This should not cause any functional changes at this time. The difference is only significant when one wants to override, say, a generic foo.c with a more specialized foo.c (as opposed to foo.S). Notes: svn path=/head/; revision=180581
* Fix a typo in the cosl() prototype.David Schultz2008-06-281-2/+2
| | | | Notes: svn path=/head/; revision=180074
* Implement fmodl.David Schultz2008-06-195-25/+177
| | | | | | | Document fmodl and fix some errors in the fmod manpage. Notes: svn path=/head/; revision=179882
* Symbol.map is handled by cpp, so use C-style commentsOleksandr Tymoshenko2008-05-031-1/+3
| | | | | | | Approved by: cognet (mentor) Notes: svn path=/head/; revision=178749
* Add mips support to libm, from mips2-jnpr perforce branch.Warner Losh2008-04-264-0/+259
| | | | Notes: svn path=/head/; revision=178582
* Fix some corner cases:David Schultz2008-04-032-10/+20
| | | | | | | | | | | | - fma(x, y, z) returns z, not NaN, if z is infinite, x and y are finite, x*y overflows, and x*y and z have opposite signs. - fma(x, y, z) doesn't generate an overflow, underflow, or inexact exception if z is NaN or infinite, as per IEEE 754R. - If the rounding mode is set to FE_DOWNWARD, fma(1.0, 0.0, -0.0) is -0.0, not +0.0. Notes: svn path=/head/; revision=177875
* Remove a (bogus) remnant of debugging this on sparc64.David Schultz2008-03-311-1/+1
| | | | Notes: svn path=/head/; revision=177793
* Add assembly versions of remquol() and remainderl().David Schultz2008-03-306-4/+228
| | | | Notes: svn path=/head/; revision=177768
* Hook remquol() and remainderl() up to the build.David Schultz2008-03-304-12/+33
| | | | Notes: svn path=/head/; revision=177766
* Implement remainderl() as a wrapper around remquol(). The extra workDavid Schultz2008-03-302-0/+44
| | | | | | | remquol() performs to compute the quotient is negligible. Notes: svn path=/head/; revision=177765
* Implement remquol() based on remquo().David Schultz2008-03-302-0/+183
| | | | Notes: svn path=/head/; revision=177764
* Implement csqrtl().David Schultz2008-03-305-13/+135
| | | | Notes: svn path=/head/; revision=177761
* Hook hypotl() and cabsl() up to the build.David Schultz2008-03-303-6/+7
| | | | Notes: svn path=/head/; revision=177760
* Document hypotl().David Schultz2008-03-301-12/+17
| | | | | | | Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> Notes: svn path=/head/; revision=177759
* Alias hypotl() and cabsl() for platforms where long double is the sameDavid Schultz2008-03-302-2/+12
| | | | | | | as double. Notes: svn path=/head/; revision=177758
* Implement cabsl() in terms of hypotl().David Schultz2008-03-301-0/+20
| | | | | | | Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> Notes: svn path=/head/; revision=177757
* Implement hypotl(). This is bde's conversion of fdlibm hypot(), with minorDavid Schultz2008-03-301-0/+139
| | | | | | | fixes for ld128 by me. Notes: svn path=/head/; revision=177756
* Use fabs[f]() instead of bit fiddling for setting absolute values.Bruce Evans2008-03-302-4/+4
| | | | | | | | | | | | | | This makes little difference in float precision, but in double precision gives a speedup of about 30% on amd64 (A64 CPU) and i386 (A64). This depends on fabs[f]() being inline and efficient. The bit fiddling (or any use of SET_HIGH_WORD(), which libm does too much because it was best on old 32-bit machines) always causes packing overheads and sometimes causes stalls in the packing, since it operates on only part of a variable in the double precision case. It apparently did cause stalls in a critical path here. Notes: svn path=/head/; revision=177751
* Use the expression fabs(x+0.0)-fabs(y+0.0) instead ofBruce Evans2008-03-302-2/+2
| | | | | | | | | | | fabs(x+0.0)+fabs(y+0.0) when mixing NaNs. This improves consistency of the result by making it harder for the compiler to reorder the operands. (FP addition is not necessarily commutative because the order of operands makes a difference on some machines iff the operands are both NaNs.) Notes: svn path=/head/; revision=177749
* Fix a missing mask in a hi+lo decomposition. Thus bug made the extraBruce Evans2008-03-301-1/+1
| | | | | | | | | precision in software useless, so hypotf() had some errors in the 1-2 ulp range unless there is extra precision in hardware (as happens on i386). Notes: svn path=/head/; revision=177746
* Include math.h for the fmaf() prototype.David Schultz2008-03-291-0/+2
| | | | Notes: svn path=/head/; revision=177712
* Fix some rather obscene code that has ambiguous if...if...else...David Schultz2008-03-296-10/+36
| | | | | | | constructs in it. Notes: svn path=/head/; revision=177711
* 1 << 47 needs to be written 1ULL << 47.David Schultz2008-03-021-1/+1
| | | | Notes: svn path=/head/; revision=176747
* Hook up sqrtl() to the build.David Schultz2008-03-025-13/+24
| | | | Notes: svn path=/head/; revision=176722
* MD implementations of sqrtl().David Schultz2008-03-022-0/+76
| | | | Notes: svn path=/head/; revision=176721
* MI implementation of sqrtl(). This is very slow and shouldDavid Schultz2008-03-023-4/+168
| | | | | | | be overridden when hardware sqrt is available. Notes: svn path=/head/; revision=176720
* Fix and improve some magic numbers for the "medium size" case.Bruce Evans2008-02-282-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e_rem_pio2.c: This case goes up to about 2**20pi/2, but the comment about it said that it goes up to about 2**19pi/2. It went too far above 2**pi/2, giving a multiplier fn with 21 significant bits in some cases. This would be harmful except for a numerical accident. It happens that the terms of the approximation to pi/2, when rounded to 33 bits so that multiplications by 20-bit fn's are exact, happen to be rounded to 32 bits so multiplications by 21-bit fn's are exact too, so the bug only complicates the error analysis (we might lose a bit of accuracy but have bits to spare). e_rem_pio2f.c: The bogus comment in e_rem_pio2.c was copied and the code was changed to be bug-for-bug compatible with it, except the limit was made 90 ulps smaller than necessary. The approximation to pi/2 was not modified except for discarding some of it. The same rough error analysis that justifies the limit of 2**20pi/2 for double precision only justifies a limit of 2**18pi/2 for float precision. We depended on exhaustive testing to check the magic numbers for float precision. More exaustive testing shows that we can go up to 2**28pi/2 using a 53+25 bit approximation to pi/2 for float precision, with a the maximum error for cosf() and sinf() unchanged at 0.5009 ulps despite the maximum error in rem_pio2f being ~0.25 ulps. Implement this. Notes: svn path=/head/; revision=176640
* Inline __ieee754__rem_pio2f(). On amd64 (A64) and i386 (A64), thisBruce Evans2008-02-254-0/+15
| | | | | | | | | | | | | | | | gives an average speedup of about 12 cycles or 17% for 9pi/4 < |x| <= 2**19pi/2 and a smaller speedup for larger x, and a small speeddown for |x| <= 9pi/4 (only 1-2 cycles average, but that is 4%). Inlining this is less likely to bust caches than inlining the float version since it is much smaller (about 220 bytes text and rodata) and has many fewer branches. However, the float version was already large due to its manual inlining of the branches and also the polynomial evaluations. Notes: svn path=/head/; revision=176569