about summary refs log tree commit diff
path: root/include/math.h
Commit message (Collapse)AuthorAgeFilesLines
* add legacy header values.hrofl0r2013-01-041-0/+1
| | | | | | | | | some programs (procps, babl) expect it, and it doesn't seem to cause any harm to just add it. it's small and straightforward. since math.h also defines MAXFLOAT, we undef it in both places, before defining it.
* math: remove long double version of bessel functions from math.hSzabolcs Nagy2012-12-111-8/+0
| | | | | | | j0l,j1l,jnl,y0l,j1l,jnl are gnu extensions, bsd and posix do not have them. noone seems to use them and there is no plan to implement them any time soon so we shouldn't declare them in math.h.
* fix inefficiency of math.h isless, etc. macrosRich Felker2012-12-051-15/+30
| | | | | | | | | | | previously, everything was going through an intermediate conversion to long double, which caused the extern __fpclassifyl function to get invoked, preventing virtually all optimizations of these operations. with the new code, tests on constant float or double arguments compile to a constant 0 or 1, and tests on non-constant expressions are efficient. I may later add support for __builtin versions on compilers that support them.
* default features: make musl usable without feature test macrosRich Felker2012-09-071-3/+1
| | | | | | | | | | the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
* avoid "inline" in public headers for strict c89 compatibilityRich Felker2012-09-021-4/+5
| | | | | | | | | while musl itself requires a c99 compiler, some applications insist on being compiled with c89 compilers, and use of "inline" in the headers was breaking them. much of this had been avoided already by just skipping the inline keyword in pre-c99 compilers or modes, but this new unified solution is cleaner and may/should result in better code generation in the default gcc configuration.
* math: fix _BSD_SOURCE namespace in math.hnsz2012-08-131-25/+26
|
* remove significandlRich Felker2012-08-131-1/+0
| | | | | | | this function never existed historically; since the float/double functions it's based on are nonstandard and deprecated, there's really no justification for its existence except that glibc has it. it can be added back if there's ever really a need...
* add significand[fl] math functionsRich Felker2012-08-131-0/+4
|
* fix namespace issue in prototypes in math.hRich Felker2012-07-221-2/+2
|
* support _BSD_SOURCE feature test macroRich Felker2012-05-221-2/+8
| | | | | patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
* fix definitions of FP_ILOGB constantsRich Felker2012-05-051-2/+2
| | | | | | | | | | | | | | | two issues: (1) the type was wrong (unsigned instead of signed int), and (2) the value of FP_ILOGBNAN should be INT_MIN rather than INT_MAX to match the ABI. this is also much more useful since INT_MAX corresponds to a valid input (infinity). the standard would allow us to set FP_ILOGB0 to -INT_MAX instead of INT_MIN, which would give us distinct values for ilogb(0) and ilogb(NAN), but the benefit seems way too small to justify ignoring the ABI. note that the macro is just a "portable" (to any twos complement system where signed and unsigned int have the same width) way to write INT_MIN without needing limits.h. it's valid to use this method since these macros are not required to work in #if directives.
* support alternate glibc name pow10 for exp10Rich Felker2012-05-011-0/+3
|
* first try at writing an efficient and "correct" exp10Rich Felker2012-04-301-0/+4
| | | | | | | | | this is a nonstandard function so it's not clear what conditions it should satisfy. my intent is that it be fast and exact for positive integral exponents when the result fits in the destination type, and fast and correctly rounded for small negative integral exponents. otherwise we aim for at most 1ulp error; it seems to differ from pow by at most 1ulp and it's often 2-5 times faster than pow.
* fix incorrect macro name for MATH_ERREXCEPT in math.hRich Felker2012-04-181-1/+1
|
* optimize signbit macroRich Felker2012-03-301-2/+2
|
* make math.h more c++-friendlyRich Felker2012-03-301-2/+5
|
* move nonstandard gamma() etc. to _GNU_SOURCE onlyRich Felker2012-03-171-4/+4
| | | | | it's not even provided in the library at the moment, but could easily be provided with weak aliases if desired.
* c++ seems to want some casts in the float representation-access macrosRich Felker2012-03-171-2/+2
|
* in math.h make lgamma_r and non-double bessel _GNU_SOURCE onlynsz2012-03-151-20/+18
| | | | long double and float bessel functions are no longer xsi extensions
* efficient sincos based on sin and cosnsz2012-03-151-0/+4
|
* first commit of the new libm!Rich Felker2012-03-131-9/+64
| | | | | | | | | | | | | | | | thanks to the hard work of Szabolcs Nagy (nsz), identifying the best (from correctness and license standpoint) implementations from freebsd and openbsd and cleaning them up! musl should now fully support c99 float and long double math functions, and has near-complete complex math support. tgmath should also work (fully on gcc-compatible compilers, and mostly on any c99 compiler). based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from nsz's libm git repo, with some additions (dummy versions of a few missing long double complex functions, etc.) by me. various cleanups still need to be made, including re-adding (if they're correct) some asm functions that were dropped.
* fix nan/infinity macros in math.h, etc.Rich Felker2012-03-021-6/+8
| | | | | | | | | | | the previous version not only failed to work in c++, but also failed to produce constant expressions, making the macros useless as initializers for objects of static storage duration. gcc 3.3 and later have builtins for these, which sadly seem to be the most "portable" solution. the alternative definitions produce exceptions (for NAN) and compiler warnings (for INFINITY) on newer versions of gcc.
* typo in math.h c version checkRich Felker2012-03-021-1/+1
|
* make math.h compatibe with c89Rich Felker2012-03-021-1/+5
|
* add float_t and double_t to math.hRich Felker2012-02-151-0/+2
|
* fix all missing instances of __cplusplus checks/extern "C" in headersRich Felker2011-11-101-0/+8
| | | | patch by Arvid Picciani (aep)
* isgreater etc. relation macros for math.hRich Felker2011-06-081-0/+18
|
* extensive header cleanup for standards conformance & correctnessRich Felker2011-02-141-17/+19
| | | | | thanks to Peter Mazinger (psm) for pointing many of these issues out and submitting a patch on which this commit is loosely based
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+300