summaryrefslogtreecommitdiffstats
path: root/lib/libm/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix ranges in the method description.martynas2012-08-191-5/+5
|
* At some point we've switched to the VFP floating-point--unlike FPAmartynas2011-07-261-3/+3
| | | | | | | | | it actually stores floats in natural-endian--therefore the existing checks became wrong. Take into account __VFP_FP__, effectively bringing back the old behavior. This way it will work now, and in the future when some of our platforms are switched to FPA, where it's much faster.
* __arm32__ -> __arm__, since our new compiler isn't defining themartynas2011-07-261-4/+4
| | | | former anymore. OK miod@.
* Make huge constants actually long, so they don't overflow and becomemartynas2011-07-252-26/+26
| | | | infinite.
* - Make constants const.martynas2011-07-2014-50/+50
| | | | | | - Fix aliasing issue in s_frexpf.c; spotted by gcc. Many other ones were fixed in NetBSD long ago, but this one was forgotten. It looks like recently they fixed it too.
* For intermediate computations use single or extended counterpartsmartynas2011-07-2016-50/+49
| | | | where appropriate, to avoid precision loss.
* Typo.martynas2011-07-191-1/+1
|
* Make the zero condition properly raise the exception and return.martynas2011-07-091-1/+2
|
* Don't reimplement the same thing twice. OK matthew@.martynas2011-07-091-30/+1
|
* Remove the stupid commented out fabs(3), frexp(3), and modf(3)martynas2011-07-083-187/+0
| | | | | entries and unused implementations. It is clear that this situation won't change.
* Revert (leaving the complex math part alone). Some stuff is dependingmartynas2011-07-082-2/+0
| | | | | on this historical behavior; so we're stuck in this stupid situation. No cookie for me.
* Finalize work on complex math routines, now that we have themartynas2011-07-0844-23/+1805
| | | | extended-precision support. Mostly from Cephes.
* Move fabs(3), frexp(3), and modf(3) to libm--nothing has been usingmartynas2011-07-082-0/+2
| | | | them in libc for a very long time. OK guenther@.
* signbitl -> signbit.martynas2011-07-082-4/+4
|
* Finalize work on the math library. It's time to do this monstermartynas2011-07-0697-45/+11067
| | | | | | | | | | | | | | | | | | commit, and deal with problems (if any) in tree. Note that this adds the following functions. Ports with hacks might need adjustments. nexttoward(3), fma(3), nexttowardf(3), fmaf(3), acoshl(3), asinhl(3), atanhl(3), coshl(3), sinhl(3), tanhl(3), expl(3), expm1l(3), logl(3), log10l(3), log1pl(3), log2l(3), modfl(3), cbrtl(3), hypotl(3), powl(3), erfl(3), erfcl(3), lgammal(3), tgammal(3), ceill(3), floorl(3), lrintl(3), llrintl(3), roundl(3), lroundl(3), llroundl(3), truncl(3), fmodl(3), remainderl(3), remquol(3), nextafterl(3), nexttowardl(3), fmal(3). With this commit, our library implements all functionality required by C99. Documentation bits will follow.
* - Take into account padding for the IEEE extended shape types. Itmartynas2011-07-041-37/+183
| | | | | | | | should be 96-bits on 32-bit architectures, and 128-bits on 64-bit architectures. - Add abstract macros to operate on long doubles by words. To be used soon.
* For tiny x, tanhf = x*(one+x). GCC (at -O2) optimized this intomartynas2011-07-021-0/+2
| | | | | x+x*x, as a result sign got lost for the zero inputs. Explicitly return in this case, similarly like has been done in tanh.
* Call the single, not double-precision version of copysign for themartynas2011-05-311-2/+2
| | | | float arguments.
* For tiny x, tanh = x*(one+x). GCC (at -O2) optimized this intomartynas2011-05-301-2/+4
| | | | | x+x*x, as a result sign got lost for the input of -0. Explicitly return negative zero in this case. Found by Cephes.
* Trick lint into recording the right prototypes in the llib-lm.lnmartynas2011-05-3018-76/+166
| | | | | | | database on platforms without extended-precision floating-point support. Seems like a reasonable approach to millert@.
* Store -1 into signgam in case of a special value of -0.martynas2011-05-282-2/+10
|
* - enable fenvmartynas2011-04-281-0/+59
| | | | - add nearbyint, nearbyintf and nearbyintl implemented using fenv
* Trick GCC optimizer into clipping any extra precision by making wmartynas2011-04-204-7/+11
| | | | | | | volatile; a similar hack was already being used in lrintf(). This will make rint and {,l}lrint family functions actually work; i.e. on m68k rintf(8.6F) was 8.625.
* The {,l}lround{,f} implementations are based on {,l}lrint{,f},martynas2011-04-174-13/+13
| | | | | | | | therefore affected by the same bugs I've fixed a week ago. The high part was being clipped for all exponents greater or equal to 52. Fix this to use RESTYPE_BITS instead; also make the code consistent.
* 20 -> DBL_FRACHBITSmartynas2011-04-171-4/+4
|
* C99: "The nextafter functions return y if x equals y."martynas2011-04-162-2/+2
| | | | | | | | Therefore, in nextafter() and nextafterf(): - if(x==y) return x; /* x=y, return x */ - if(x==y) return y; /* x=y, return y */ This matters for negative zero inputs of x or y.
* The {,l}lrint{,f} functions avoid to shift results by more than 31martynas2011-04-102-8/+8
| | | | | | | | | | | | | bits, because "behavior is implementation defined in this case". However, this is wrong; behavior is undefined if the right operand is greater than or equal to the width of the promoted left operand. This broke {,l}lrint{,f} (64-bit architectures), and llrint{,f} (32-bit architectures) where results are actually 64-bit values. The high part was clipped for all exponents greater or equal to 52. Fix this to use RESTYPE_BITS instead; {,l}lrint{,f} are now able to pass our regression tests, and I think are right now.
* 20 -> DBL_FRACHBITSmartynas2011-04-101-4/+4
|
* The assumption that |1.0 * 2^exp| = 0, exp < -1 cannot be made whenmartynas2011-04-102-8/+8
| | | | we round towards -inf or +inf.
* Fix the cproj family to not return garbage on finite arguments.guenther2010-07-192-2/+6
| | | | ok millert@
* Use crealf() and cimagf() instead of creal() and cimag() when theguenther2010-07-1811-34/+34
| | | | | | argument is a float. Eliminate a cast rendered superfluous as a result. ok kettenis@, millert@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-27103-415/+3
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* Add man pages for the fdim/fmin/fmax family of functions and make sure fdimlkettenis2009-10-261-7/+2
| | | | | | is defined on all architectures. ok jmc@ (man pages) and martynas@
* int is big enough to fully represent exponents of all supported fpmartynas2009-07-251-0/+42
| | | | | | | | formats. which even for 80-bit & 128-bit long doubles is only 15 bits. therefore, scalbln, scalblnf, scalblnl are essentially the same as scalbn, scalbnf, scalbnl with bounds checking so that LONG_MIN..INT_MIN, and INT_MAX..LONG_MAX ranges properly raise exceptions & yield correct values. looks good to millert@
* make ldexpf behavior consistent with the double and extended-precisionmartynas2009-04-193-69/+7
| | | | | | versions; spotted by kettenis@ while here also remove unused ldexp; it lives in libc ok kettenis@, "looks good" millert@
* const static -> static const; since it's deprecated per C99. ok millert@martynas2009-04-051-11/+11
|
* Let this compile with gcc 2.miod2008-12-221-4/+4
|
* use sys/cdefs.h; pointed out by theomartynas2008-12-1019-23/+23
|
* - 80-bit and quad precision trigonometric and other mostmartynas2008-12-0957-137/+3693
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | important functions: acosl, asinl, atanl, atan2l, cosl, sinl, tanl, exp2l, frexpl, ilogbl, ldexpl, logbl, scalbnl, fabsl, hypotl, powl, sqrtl, rintl, copysignl, nanl, fdiml, fmaxl, fminl. mostly taken from freebsd, needed alot of changes to adapt. note, these are all c versions; and are quite slow when architectures have, e.g. sqrt. assembly versions will be added afterwards - make them .weak/__weak_alias to the double precision versions on other archs - no need to have two finites. finite() and finitef() are non-standard 3BSD obsolete versions of isfinite. remove from libm. make them weak_alias in libc to __isfinite and __isfinitef instead. similarly make 3BSD obsolete versions of isinf, isinff, isnan, isnanf weak_aliases to C99's __isinf, __isinff, __isnan, __isnanf - remove unused infinity.c. the c library has infinities for each supported platform - use STRICT_ASSIGN cast hack for _kernel_rem_pio2, so that the double version has a chance of working on i386 with extra precision - avoid storing multiple copies of the pi/2 array, since it won't vary - bump major due to removed finite/finitef. although they will be in libc, which anything is linked to, minor bump might be enough ok millert@. tested by sthen@, jsg@, ajacoutot@, kili@, naddy@
* typo: is -> if. ok millert@martynas2008-09-162-2/+2
|
* gc unused files, the functions are in libc. ok millert@martynas2008-09-164-123/+0
|
* - make much more readable: don't reimplement isnan, signbit eachmartynas2008-09-114-56/+32
| | | | | time we need them ok millert@
* sigh, gamma got lostmartynas2008-09-094-0/+121
|
* - replace dtoa w/ David's gdtoa, version 2008-03-15martynas2008-09-07150-3180/+3512
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - provide proper dtoa locks - use the real strtof implementation - add strtold, __hdtoa, __hldtoa - add %a/%A support - don't lose precision in printf, don't round to double anymore - implement extended-precision versions of libc functions: fpclassify, isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is fixed - separate vax versions of strtof, and __hdtoa - add complex math support. added functions: cacos, casin, catan, ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp, clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf, casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf, ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf, cimagf, conjf, cprojf, crealf - add fdim, fmax, fmin - add log2. (adapted implementation e_log.c. could be more acruate & faster, but it's good enough for now) - remove wrappers & cruft in libm, supposed to work-around mistakes in SVID, etc.; use ieee versions. fixes issues in python 2.6 for djm@ - make _digittoint static - proper definitions for i386, and amd64 in ieee.h - sh, powerpc don't really have extended-precision - add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h for LDBL_* - merge lead to frac for m{6,8}k, for gdtoa to work properly - add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa to use - add EXT_IMPLICIT_NBIT definition, which indicates implicit normalization bit - add regression tests for libc: fpclassify and printf - arith.h & gd_qnan.h definitions - update ieee.h: hppa doesn't have quad-precision, hppa64 does - add missing prototypes to gdtoaimp - on 64-bit platforms make sure gdtoa doesn't use a long when it really wants an int - etc., what i may have forgotten... - bump libm major, due to removed&changed symbols - no libc bump, since this is riding on djm's libc major crank from a day ago discussed with / requested by / testing theo, sthen@, djm@, jsg@, merdely@, jsing@, tedu@, brad@, jakemsr@, and others. looks good to millert@ parts of the diff ok kettenis@ this commit does not include: - man page changes
* revertmartynas2008-08-081-2/+2
|
* make _digittoint staticmartynas2008-08-081-2/+2
|
* - remove isinff, isnanf. this has been moved to libcmartynas2008-07-246-1/+941
| | | | | | | | | | | - remove never-enabled signbit. libc has is now - add C99 implementations, from freebsd, for nan(), nanf() (needed to write _digittoint for it), exp2(), exp2f(), remquo(), remquof(), needed STRICT_ASSIGN macro for math_private.h - bump major man pages will follow exp2{,f} has been requested by chl@ ok millert@
* remez -> Remes here, too. for consistencymartynas2008-07-222-2/+2
|
* rename lround.c lroundf.c llround.c llroundf.c to s_lround.cmartynas2008-07-214-6/+6
| | | | | s_lroundf.c s_llround.c s_llroundf.c, for naming consistency looks fine to millert@
* Reme algorithm -> Remes algorithm. in commentsmartynas2008-07-204-4/+4
|