summaryrefslogtreecommitdiffstats
path: root/lib/msun/src/math.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Whitespace nit.stefanf2005-01-121-1/+1
|
* Add MI implementations of [l]lrint[f]() and [l]lround[f]().das2005-01-111-0/+8
| | | | Discussed with: bde
* Add and document ilogbl(), a long double version of ilogb().stefanf2004-10-111-0/+2
|
* Further refine some #ifs:das2004-09-171-2/+2
| | | | | | | - Simplify the logic by using __GNUC_PREREQ__. Suggested by stefanf. - Make math.h compile with old (pre-8.0) versions of icc. Submitted by sf [sic].
* Fix two bugs in the signbit() macro, which was implemented last year:das2004-07-191-1/+6
| | | | | | | | - It was added to libc instead of libm. Hopefully no programs rely on this mistake. - It didn't work properly on large long doubles because its argument was converted to type double, resulting in undefined behavior.
* Fix minor namespace pollution: The prototypes for f{dim,max,min}(),stefanf2004-07-171-6/+6
| | | | | nearbyint(), round() and trunc() shouldn't be visible when compiling with -D_XOPEN_SOURCE=500.
* Tweak the conditions under which certain gcc builtins are used:das2004-07-161-2/+2
| | | | | | | | | | | | - Unlike the builtin relational operators, builtin floating-point constants were not available until gcc 3.3, so account for this.[1] - Apparently some versions of the Intel C Compiler fallaciously define __GNUC__ without actually being compatible with the claimed gcc version. Account for this, too.[2] [1] Noticed by: Christian Hiris <4711@chello.at> [2] Submitted by: Alexander Leidinger <Alexander@Leidinger.net>
* Implement the classification macros isfinite(), isinf(), isnan(), anddas2004-07-091-6/+28
| | | | | | | | | | | | | | | | | | | | | isnormal() the hard way, rather than relying on fpclassify(). This is a lose in the sense that we need a total of 12 functions, but it is necessary for binary compatibility because we have never bumped libm's major version number. In particular, isinf(), isnan(), and isnanf() were BSD libc functions before they were C99 macros, so we can't reimplement them in terms of fpclassify() without adding a dependency on libc.so.5. I have tried to arrange things so that programs that could be compiled in FreeBSD 4.X will generate the same external references when compiled in 5.X. At the same time, the new macros should remain C99-compliant. The isinf() and isnan() functions remain in libc for historical reasons; however, I have moved the functions that implement the macros isfinite() and isnormal() to libm where they belong. Moreover, half a dozen MD versions of isinf() and isnan() have been replaced with MI versions that work equally well. Prodded by: kris
* Define the following macros in terms of [gi]cc builtins when thedas2004-07-091-0/+29
| | | | | | | | | | | | | | | | | | builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, and NAN. These macros now expand to floating-point constant expressions rather than external references, as required by C99. Other compilers will retain the historical behavior. Note that it is not possible say, e.g. #define HUGE_VAL 1.0e9999 because the above may result in diagnostics at translation time and spurious exceptions at runtime. Hence the need for compiler support for these features. Also use builtins to implement the macros isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), and isunordered() when such builtins are available. Although the old macros are correct, the builtin versions are much faster, and they avoid double-expansion problems.
* Add C99's nearbyint{,f}() functions as wrappers around rint().das2004-07-061-0/+2
| | | | | | | These trivial implementations are about 25 times slower than rint{,f}() on x86 due to the FP environment save/restore. They should eventually be redone in terms of fegetround() and bit fiddling.
* Implement and document fdim{,f,l}, fmax{,f,l}, and fmin{,f,l}.das2004-06-301-3/+12
|
* Declare scalbln(), scalblnf(), trunc(), and truncf().das2004-06-201-0/+4
|
* Our MI implementation of ilogb() returns -INT_MAX for the argument 0.0 ratherstefanf2004-06-191-2/+3
| | | | | | | than INT_MIN, so adjust FP_ILOGB0 to reflect this. Use <machine/_limits.h> for INT_MAX's value while there. Reviewed by: standards@
* Include <sys/cdefs.h> earlier to get the various visibility constants.das2004-06-091-2/+1
| | | | Previously, we were relying on <sys/_types.h> to include it implicitly.
* Add round(3) and roundf(3) and the associated documentation.das2004-06-071-0/+2
| | | | | | PR: 59797 Submitted by: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu> Reviewed by: bde (earlier version, last year)
* Add an implementation of copysignl(), a long double version of copysign().stefanf2004-05-071-0/+2
| | | | Approved by: das (mentor)
* Make sure that symbols are declared in math.h iff the appropriatedas2004-04-251-65/+68
| | | | | | | | | | | | | | namespaces are visible. Previously, math.h failed to hide some C99-, XSI-, and BSD-specific symbols in certain compilation environments. The referenced PR has a nice listing of the appropriate conditions for making symbols visible in math.h. The only non-stylistic difference between the patch in the PR and this commit is that I superfluously test for __BSD_VISIBLE in a few places to be more explicit about which symbols have historically been part of the FreeBSD environment. PR: 65939 Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
* Remove a stale comment referring to values.h, which has never beendas2004-04-251-6/+1
| | | | | | part of FreeBSD. PR: 65939
* Initial support for C99's (or is it POSIX.1-2001's?) MATH_ERRNO,bde2004-03-121-0/+6
| | | | | | | | | | | MATH_ERREXCEPTION and math_errhandling, so that C99 applications at least have the possibility of determining that errno is not set for math functions. Set math_errhandling to the non-standard-conforming value of 0 for now to indicate that we don't support either method of reporting errors. We intentionally don't support MATH_ERRNO because errno is a mistake, and we are missing support for MATH_ERREXCEPTION (<fenv.h>, compiler support for <fenv.h>, and actually setting the exception flags correctly).
* Add prototypes for all long double functions in C99. Leave them alldes2003-10-231-0/+67
| | | | #if 0'd out, except for fabsl(3) which I've implemented.
* Fix two misuses of __BSD_VISIBLE.mike2003-05-221-2/+2
| | | | | Submitted by: bde Approved by: re
* Fix braino in definition of isfinite().das2003-04-041-1/+1
| | | | | Noticed by: marcus Pointy hat to: das
* - gamma_r, lgamma_r, gammaf_r, and lgammaf_r were protected by _REENTRANTimp2003-02-261-4/+4
| | | | | | | | | | in math.h; the consensus here was that __BSD_VISIBLE was correct instead. - gamma_r, lgamma_r, gammaf_r, and lgammaf_r had no documentation in the lgamma(3) manpage. Reviewed by: standards@ Submitted by: Ben Mesander
* o Implement C99 classification macros isfinite(), isinf(), isnan(),mike2003-02-121-12/+24
| | | | | | | | | isnormal(). The current isinf() and isnan() are perserved for binary compatibility with 5.0, but new programs will use the macros. o Implement C99 comparison macros isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), isunordered(). Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
* Implement C99's signbit() macro.mike2003-02-111-0/+2
|
* Implement fpclassify():mike2003-02-081-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a MD header private to libc called _fpmath.h; this header contains bitfield layouts of MD floating-point types. o Add a MI header private to libc called fpmath.h; this header contains bitfield layouts of MI floating-point types. o Add private libc variables to lib/libc/$arch/gen/infinity.c for storing NaN values. o Add __double_t and __float_t to <machine/_types.h>, and provide double_t and float_t typedefs in <math.h>. o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF, HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via <machine/float.h>. o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based on the size of its argument. __fpclassifyl() is never called on alpha because (sizeof(long double) == sizeof(double)), which is good since __fpclassifyl() can't deal with such a small `long double'. This was developed by David Schultz and myself with input from bde and fenner. PR: 23103 Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU> (significant portions) Reviewed by: bde, fenner (earlier versions)
* Re-apply the previously backed-out commit that fixes the problem wherearchie2002-10-311-2/+5
| | | | | | | | HUGE_VAL is not properly aligned on some architectures. The previous fix now works because the two versions of 'math.h' (include/math.h and lib/msun/src/math.h) have since been merged into one. PR: bin/43544
* Remove duplicate declaration.markm2002-10-231-1/+0
|
* Fixed a last-minute editing error in previous commit. nfs and/or cvsbde2002-10-011-0/+0
| | | | | replaced a 14-byte change in the middle of the file with 14 NULs at EOF despite or because of aborting the initial commit to pick up the change.
* Merged all interesting difference between the old math.h and the currentbde2002-10-011-0/+0
| | | | | | | | | | | | | one into the latter and removed the former. This works around the bug that some broken Makefiles add -I.../src/include to CFLAGS, resulting in the old math.h being preferred and differences between the headers possibly being fatal. The merge mainly involves declaring some functions as __pure2 although they are not yet all strictly free of side effects. PR: 43544
* Revert previous commit to unbreak world until we figure out thearchie2002-09-201-5/+2
| | | | right way to do it.
* Fix a problem with the definition of HUGE_VAL causing the gcc warningarchie2002-09-191-2/+5
| | | | | | "cast increases required alignment of target type" on some platforms. Reviewed by: bde
* Resurrect Lite1's gamma() as C99's tgamma(). Minimal changes.bde2002-03-261-0/+1
|
* Fixed some minor style bugs.bde2002-03-261-2/+2
|
* Remove __P() usage.obrien2002-03-211-118/+118
|
* Fix style bugs (mostly remove 'extern' from function prototypes)phantom2001-12-131-122/+121
| | | | Inspired by: conversation with bde
* Added skeleton <complex.h> (aligned with the POSIX.1-200x), mostlyru2001-06-131-2/+0
| | | | | | | | to fix the "-nostdinc WARNS=X" breakage caused by broken prototypes for cabs() and cabsl() in <math.h>. Reimplemented cabs() and cabsl() using new complex numbers types and moved prototypes from <math.h> to <complex.h>.
* MFS: Add a "magic" comment to help fixincludes realize it doesn't need toobrien2000-03-271-0/+2
| | | | | | modify this file when building GCC 2.96 [by hand or via the port]. Submitted by: Zack Weinberg <zack@wolery.cumb.org>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Back out last changepst1998-04-231-2/+2
|
* Fix cabs and cabsf definitions to be prototypes.pst1998-04-221-3/+3
|
* Hide the declaration of `struct exception' from C++, since it conflictsbde1997-08-311-1/+5
| | | | | with the standard C++ `class exception'. This makes matherr() difficult to use in C++. Small loss.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Remove trailing whitespace.rgrimes1995-05-301-8/+8
|
* J.T. Conklin's latest version of the Sun math library.jkh1994-08-191-0/+273
-- Begin comments from J.T. Conklin: The most significant improvement is the addition of "float" versions of the math functions that take float arguments, return floats, and do all operations in floating point. This doesn't help (performance) much on the i386, but they are still nice to have. The float versions were orginally done by Cygnus' Ian Taylor when fdlibm was integrated into the libm we support for embedded systems. I gave Ian a copy of my libm as a starting point since I had already fixed a lot of bugs & problems in Sun's original code. After he was done, I cleaned it up a bit and integrated the changes back into my libm. -- End comments Reviewed by: jkh Submitted by: jtc
OpenPOWER on IntegriCloud