History log of /seL4-test-master/projects/musllibc/include/math.h
Revision Date Author Comments
# 6739b13a 09-Mar-2014 Szabolcs Nagy <nsz@port70.net>

math.h: make __FLOAT_BITS and __DOUBLE_BITS C89

Remove non-constant aggregate initializer. (Still using long long, but
that is supported by ancient compilers without __extension__ anyway).


# a663c930 26-Nov-2013 Rich Felker <dalias@aerifal.cx>

adjust fallback INFINITY definition for FLT_EVAL_METHOD==2 case

on archs with excess precision, the floating point constant 1e40f may
be evaluated such that it does not actually produce an infinity.
1e5000f is sufficiently large to produce an infinity for all supported
floating point formats. note that this definition of INFINITY is only
used for old or non-GNUC compilers anyway; despite being a portable,
conforming definition, it leads to erroneous warnings on many
compilers and thus using the builtin is preferred.


# 5d01ab4a 20-Nov-2013 Szabolcs Nagy <nsz@port70.net>

math: add (obsolete) bsd drem and finite functions


# 46db3728 20-Nov-2013 Rich Felker <dalias@aerifal.cx>

write floating point limit constants to 21 significant decimal places

this is enough to produce the correct value even if the constant is
interpreted as 80-bit extended precision, which matters on archs with
excess precision (FLT_EVAL_METHOD==2) under at least some
interpretations of the C standard. the shorter representations, while
correct if converted to the nominal precision at translation time,
could produce an incorrect value at extended precision, yielding
results such as (double)DBL_MAX != DBL_MAX.


# e1f1df9c 27-Sep-2013 Szabolcs Nagy <nsz@port70.net>

math: fix comparision macros (isless etc) when FLT_EVAL_METHOD!=0

This is a change in ISO C11 annex F (F.10.11p1), comparision macros
can't round their arguments to their semantic type when the evaluation
format has wider range and precision. (ie. they must be consistent with
the builtin relational operators)


# 9448b051 22-Jul-2013 Rich Felker <dalias@aerifal.cx>

refactor headers, especially alltypes.h, and improve C++ ABI compat

the arch-specific bits/alltypes.h.sh has been replaced with a generic
alltypes.h.in and minimal arch-specific bits/alltypes.h.in.

this commit is intended to have no functional changes except:
- exposing additional symbols that POSIX allows but does not require
- changing the C++ name mangling for some types
- fixing the signedness of blksize_t on powerpc (POSIX requires signed)
- fixing the limit macros for sig_atomic_t on x86_64
- making dev_t an unsigned type (ABI matching goal, and more logical)

in addition, some types that were wrongly defined with long on 32-bit
archs were changed to int, and vice versa; this change is
non-functional except for the possibility of making pointer types
mismatch, and only affects programs that were using them incorrectly,
and only at build-time, not runtime.

the following changes were made in the interest of moving
non-arch-specific types out of the alltypes system and into the
headers they're associated with, and also will tend to improve
application compatibility:
- netdb.h now includes netinet/in.h (for socklen_t and uint32_t)
- netinet/in.h now includes sys/socket.h and inttypes.h
- sys/resource.h now includes sys/time.h (for struct timeval)
- sys/wait.h now includes signal.h (for siginfo_t)
- langinfo.h now includes nl_types.h (for nl_item)

for the types in stdint.h:
- types which are of no interest to other headers were moved out of
the alltypes system.
- fast types for 8- and 64-bit are hard-coded (at least for now); only
the 16- and 32-bit ones have reason to vary by arch.

and the following types have been changed for C++ ABI purposes;
- mbstate_t now has a struct tag, __mbstate_t
- FILE's struct tag has been changed to _IO_FILE
- DIR's struct tag has been changed to __dirstream
- locale_t's struct tag has been changed to __locale_struct
- pthread_t is defined as unsigned long in C++ mode only
- fpos_t now has a struct tag, _G_fpos64_t
- fsid_t's struct tag has been changed to __fsid_t
- idtype_t has been made an enum type (also required by POSIX)
- nl_catd has been changed from long to void *
- siginfo_t's struct tag has been removed
- sigset_t's has been given a struct tag, __sigset_t
- stack_t has been given a struct tag, sigaltstack
- suseconds_t has been changed to long on 32-bit archs
- [u]intptr_t have been changed from long to int rank on 32-bit archs
- dev_t has been made unsigned

summary of tests that have been performed against these changes:
- nsz's libc-test (diff -u before and after)
- C++ ABI check symbol dump (diff -u before, after, glibc)
- grepped for __NEED, made sure types needed are still in alltypes
- built gcc 3.4.6


# 2897bfdd 06-May-2013 Szabolcs Nagy <nsz@port70.net>

remove compound literals from math.h to please c++

__FLOAT_BITS and __DOUBLE_BITS macros used union compound literals,
now they are changed into static inline functions. A good C compiler
generates the same code for both and the later is C++ conformant.


# 2ba3f44d 04-Jan-2013 rofl0r <retnyg@gmx.net>

add legacy header values.h

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.


# 64623cd5 11-Dec-2012 Szabolcs Nagy <nsz@port70.net>

math: remove long double version of bessel functions from math.h

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.


# 96b3ea53 05-Dec-2012 Rich Felker <dalias@aerifal.cx>

fix inefficiency of math.h isless, etc. macros

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.


# c1a9658b 07-Sep-2012 Rich Felker <dalias@aerifal.cx>

default features: make musl usable without feature test macros

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.


# fb247faf 01-Sep-2012 Rich Felker <dalias@aerifal.cx>

avoid "inline" in public headers for strict c89 compatibility

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.


# 23e6940a 13-Aug-2012 nsz <nsz@port70.net>

math: fix _BSD_SOURCE namespace in math.h


# ab76321c 13-Aug-2012 Rich Felker <dalias@aerifal.cx>

remove significandl

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...


# 2242bf61 13-Aug-2012 Rich Felker <dalias@aerifal.cx>

add significand[fl] math functions


# b4f632bb 22-Jul-2012 Rich Felker <dalias@aerifal.cx>

fix namespace issue in prototypes in math.h


# 419ae6d5 22-May-2012 Rich Felker <dalias@aerifal.cx>

support _BSD_SOURCE feature test macro

patch by Isaac Dunham. matched closely (maybe not exact) to glibc's
idea of what _BSD_SOURCE should make visible.


# 98c9af50 05-May-2012 Rich Felker <dalias@aerifal.cx>

fix definitions of FP_ILOGB constants

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.


# a917c037 30-Apr-2012 Rich Felker <dalias@aerifal.cx>

support alternate glibc name pow10 for exp10


# f6819755 30-Apr-2012 Rich Felker <dalias@aerifal.cx>

first try at writing an efficient and "correct" exp10

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.


# ed0e3a35 18-Apr-2012 Rich Felker <dalias@aerifal.cx>

fix incorrect macro name for MATH_ERREXCEPT in math.h


# 4dbd9411 30-Mar-2012 Rich Felker <dalias@aerifal.cx>

optimize signbit macro


# 93a18a15 30-Mar-2012 Rich Felker <dalias@aerifal.cx>

make math.h more c++-friendly


# 8e092217 17-Mar-2012 Rich Felker <dalias@aerifal.cx>

move nonstandard gamma() etc. to _GNU_SOURCE only

it's not even provided in the library at the moment, but could easily
be provided with weak aliases if desired.


# 65db6bf5 17-Mar-2012 Rich Felker <dalias@aerifal.cx>

c++ seems to want some casts in the float representation-access macros


# 2cbb24bb 16-Mar-2012 Rich Felker <dalias@aerifal.cx>

remove junk sincos implementations in preparation to merge nsz's real ones


# 40305f74 15-Mar-2012 nsz <nsz@port70.net>

in math.h make lgamma_r and non-double bessel _GNU_SOURCE only
long double and float bessel functions are no longer xsi extensions


# 0144b45b 15-Mar-2012 nsz <nsz@port70.net>

efficient sincos based on sin and cos


# 5657cc58 15-Mar-2012 Rich Felker <dalias@aerifal.cx>

implement sincosf and sincosl functions; add prototypes

presumably broken gcc may generate calls to these, and it's said that
ffmpeg makes use of sincosf.


# b69f695a 12-Mar-2012 Rich Felker <dalias@aerifal.cx>

first commit of the new libm!

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.


# 405ce58d 02-Mar-2012 Rich Felker <dalias@aerifal.cx>

fix nan/infinity macros in math.h, etc.

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.


# 9fcecd7b 02-Mar-2012 Rich Felker <dalias@aerifal.cx>

typo in math.h c version check


# db3e78ce 01-Mar-2012 Rich Felker <dalias@aerifal.cx>

make math.h compatibe with c89


# 414a4cde 15-Feb-2012 Rich Felker <dalias@aerifal.cx>

add float_t and double_t to math.h


# 3ed8c9f2 10-Nov-2011 Rich Felker <dalias@aerifal.cx>

fix all missing instances of __cplusplus checks/extern "C" in headers

patch by Arvid Picciani (aep)


# e0037efc 08-Jun-2011 Rich Felker <dalias@aerifal.cx>

isgreater etc. relation macros for math.h


# 74eea628 14-Feb-2011 Rich Felker <dalias@aerifal.cx>

extensive header cleanup for standards conformance & correctness

thanks to Peter Mazinger (psm) for pointing many of these issues out
and submitting a patch on which this commit is loosely based


# 0b44a031 11-Feb-2011 Rich Felker <dalias@aerifal.cx>

initial check-in, version 0.5.0