History log of /freebsd-10.0-release/lib/msun/src/math.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253766 29-Jul-2013 theraven

Restore the longer form of the _Generic. The short form does not work in C++.


# 253764 29-Jul-2013 theraven

Reenable the isnan(double) / isinf(double) declarations when targeting C89 + SUSv2 mode.


# 253321 13-Jul-2013 theraven

Cleaner support for type qualifiers.

Submitted by: Pasi Parviainen


# 253319 13-Jul-2013 theraven

Ensure that the _Generic() macro in math.h works with qualified types.

tgmath.h contains the same bugs and so should be fixed in the same way.


# 253260 12-Jul-2013 theraven

Fix the build with C++ where __builtin_types_compatible_p is not allowed.


# 253219 11-Jul-2013 theraven

Fix some typoes in math.h cleanup.


# 253215 11-Jul-2013 theraven

Cleanups to math.h that prevent namespace conflicts with C++.

Reviewed by: bde
MFC after: 3 days


# 251599 10-Jun-2013 das

Add implementations of acoshl(), asinhl(), and atanhl(). This is a
merge of the work done by bde and myself.


# 251343 03-Jun-2013 kargl

ld80 and ld128 implementations of expm1l(). This code started life
as a fairly faithful implementation of the algorithm found in

PTP Tang, "Table-driven implementation of the Expm1 function
in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18,
211-222 (1992).

Over the last 18-24 months, the code has under gone significant
optimization and testing.

Reviewed by: bde
Obtained from: bde (most of the optimizations)


# 251292 03-Jun-2013 das

Add logl, log2l, log10l, and log1pl.

Submitted by: bde


# 238722 23-Jul-2012 kargl

Compute the exponential of x for Intel 80-bit format and IEEE 128-bit
format. These implementations are based on

PTP Tang, "Table-driven implementation of the exponential function
in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 15,
144-157 (1989).

PR: standards/152415
Submitted by: kargl
Reviewed by: bde, das
Approved by: das (mentor)


# 236148 27-May-2012 theraven

Allow inclusion of libc++ <cmath> to work after including math.h

Submitted by: Yamaya Takashi
Reviewed by: das
MFC after: 1 week


# 227472 12-Nov-2011 theraven

Expose the unimplemented libm functions in the math.h header. This allows C++'s <cmath> to work without the compiler complaining that the C++ versions are calling implicitly-declared functions. You will still get a linker error when they are called. OpenBSD 5.0 claims to fully implement the C99 <math.h> stuff, so might be worth investigating...

Reviewed by: das
Approved by: dim (mentor)


# 226374 15-Oct-2011 das

Don't define FP_FAST_FMA on sparc64; with the recent fixes, fma() is
no longer "fast" on sparc64. (It really wasn't to begin with, since
the old implementation was using long doubles, and long doubles are
emulated in software on sparc64.)


# 219571 12-Mar-2011 kargl

Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by: bde
Approved by: das


# 216211 05-Dec-2010 das

Add log2() and log2f().


# 209110 12-Jun-2010 das

Introduce __isnanf() as an alias for isnanf(), and make the isnan()
macro expand to __isnanf() instead of isnanf() for float arguments.
This change is needed because isnanf() isn't declared in strict POSIX
or C99 mode.

Compatibility note: Apps using isnan(float) that are compiled after
this change won't link against an older libm.

Reported by: Florian Forster <octo@verplant.org>


# 189805 14-Mar-2009 das

Namespace: scalb() is withdrawn from POSIX.


# 188272 07-Feb-2009 das

C99 TC2 now wants FP_FAST_FMA* to be defined to 1, if the macros are
defined at all. See also: defect report #223.


# 186886 08-Jan-2009 das

Fix the types of INFINITY and NAN, which were broken in r131851. They
should both be floats, not doubles.

PR: 127795
Submitted by: Christoph Mallon
MFC after: 2 weeks


# 181074 31-Jul-2008 das

Add implementations of acosl(), asinl(), atanl(), atan2l(),
and cargl().

Reviewed by: bde
sparc64 testing resources from: remko


# 179882 19-Jun-2008 das

Implement fmodl.
Document fmodl and fix some errors in the fmod manpage.


# 177766 30-Mar-2008 das

Hook remquol() and remainderl() up to the build.


# 177760 30-Mar-2008 das

Hook hypotl() and cabsl() up to the build.


# 176720 01-Mar-2008 das

MI implementation of sqrtl(). This is very slow and should
be overridden when hardware sqrt is available.


# 176388 18-Feb-2008 das

Add tgammaf() as a simple wrapper around tgamma().


# 176360 17-Feb-2008 das

Add implementations of sinl(), cosl(), and tanl().

Submitted by: Steve Kargl <sgk@apl.washington.edu>


# 175460 18-Jan-2008 das

Implement exp2l(). There is one version for machines with 80-bit
long doubles (i386, amd64, ia64) and one for machines with 128-bit
long doubles (sparc64). Other platforms use the double version.
I've only done runtime testing on i386.

Thanks to bde@ for helpful discussions and bugfixes.


# 175309 14-Jan-2008 das

Implement rintl(), nearbyintl(), lrintl(), and llrintl().
Thanks to bde@ for feedback and testing of rintl().


# 174804 20-Dec-2007 das

Grumble. DO declare logbl(), DON'T declare logl() just yet.
bde is going to commit logl() Real Soon Now.
I'm just trying to slow him down with merge conflicts.

Noticed by: bde


# 174801 19-Dec-2007 das

Remove the declaration of logl(). The relevant bits haven't been
committed yet, but the declaration leaked in when I added nan() and
friends.

Reported by: pav


# 174684 16-Dec-2007 das

Implement and document nan(), nanf(), and nanl(). This commit
adds two new directories in msun: ld80 and ld128. These are for
long double functions specific to the 80-bit long double format
used on x86-derived architectures, and the 128-bit format used on
sparc64, respectively.


# 165855 07-Jan-2007 das

Implement modfl().


# 145170 16-Apr-2005 das

Implement truncl() based on floorl().


# 144772 07-Apr-2005 das

Add roundl(), lroundl(), and llroundl().


# 144648 05-Apr-2005 das

Implement exp2() and exp2f().


# 144091 25-Mar-2005 das

Implement and document remquo() and remquof().


# 143777 17-Mar-2005 das

Add missing prototypes for fma() and fmaf(), and remove an inaccurate
comment.


# 143221 07-Mar-2005 das

- Define FP_FAST_FMA for sparc64, since fma() is now implemented using
sparc64's 128-bit long doubles.
- Define FP_FAST_FMAL for ia64.
- Prototypes for fmal, frexpl, ldexpl, nextafterl, nexttoward{,f,l},
scalblnl, and scalbnl.


# 141280 04-Feb-2005 das

Remove wrappers and other cruft intended to support SVID, mistakes in
C90, and other arcana. Most of these features were never fully
supported or enabled by default.

Ok: bde, stefanf


# 140609 22-Jan-2005 das

Add fma() and fmaf(), which implement a fused multiply-add operation.


# 140274 15-Jan-2005 das

Most libm routines depend on the rounding mode and/or set exception
flags, so they are not pure. Remove the __pure2 annotation from them.
I believe that the following routines and their float and long double
counterparts are the only ones here that can be __pure2:

copysign is* fabs finite fmax fmin fpclassify ilogb nan signbit

When gcc supports FENV_ACCESS, perhaps there will be a new annotation
that allows the other functions to be considered pure when FENV_ACCESS
is off.

Discussed with: bde


# 140270 14-Jan-2005 das

Braino. Revert rev 1.50.

Pointy hat to: das


# 140265 14-Jan-2005 das

Set math_errhandling to MATH_ERREXCEPT. Now that we have fenv.h, we
basically support this, subject to gcc's lack of FENV_ACCESS support.
In any case, the previous setting of math_errhandling to 0 is not
allowed by POSIX.


# 140263 14-Jan-2005 das

Remove some #if 0'd code.


# 140172 13-Jan-2005 stefanf

Implement and document ceill().


# 140142 12-Jan-2005 stefanf

Implement floorl().


# 140141 12-Jan-2005 stefanf

Whitespace nit.


# 140088 11-Jan-2005 das

Add MI implementations of [l]lrint[f]() and [l]lround[f]().

Discussed with: bde


# 136385 11-Oct-2004 stefanf

Add and document ilogbl(), a long double version of ilogb().


# 135360 17-Sep-2004 das

Further refine some #ifs:
- 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].


# 132382 19-Jul-2004 das

Fix two bugs in the signbit() macro, which was implemented last year:

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


# 132292 17-Jul-2004 stefanf

Fix minor namespace pollution: The prototypes for f{dim,max,min}(),
nearbyint(), round() and trunc() shouldn't be visible when compiling with
-D_XOPEN_SOURCE=500.


# 132246 16-Jul-2004 das

Tweak the conditions under which certain gcc builtins are used:

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


# 131852 09-Jul-2004 das

Implement the classification macros isfinite(), isinf(), isnan(), and
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


# 131851 09-Jul-2004 das

Define the following macros in terms of [gi]cc builtins when the
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.


# 131676 06-Jul-2004 das

Add C99's nearbyint{,f}() functions as wrappers around rint().
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.


# 131320 30-Jun-2004 das

Implement and document fdim{,f,l}, fmax{,f,l}, and fmin{,f,l}.


# 130768 20-Jun-2004 das

Declare scalbln(), scalblnf(), trunc(), and truncf().


# 130713 19-Jun-2004 stefanf

Our MI implementation of ilogb() returns -INT_MAX for the argument 0.0 rather
than INT_MIN, so adjust FP_ILOGB0 to reflect this. Use <machine/_limits.h> for
INT_MAX's value while there.

Reviewed by: standards@


# 130264 09-Jun-2004 das

Include <sys/cdefs.h> earlier to get the various visibility constants.
Previously, we were relying on <sys/_types.h> to include it implicitly.


# 130179 07-Jun-2004 das

Add round(3) and roundf(3) and the associated documentation.

PR: 59797
Submitted by: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Reviewed by: bde (earlier version, last year)


# 129040 07-May-2004 stefanf

Add an implementation of copysignl(), a long double version of copysign().

Approved by: das (mentor)


# 128628 25-Apr-2004 das

Make sure that symbols are declared in math.h iff the appropriate
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>


# 128627 25-Apr-2004 das

Remove a stale comment referring to values.h, which has never been
part of FreeBSD.

PR: 65939


# 126873 12-Mar-2004 bde

THe log message for the previous commit should have said:

Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
PR: standards/56906


# 126871 12-Mar-2004 bde

Initial support for C99's (or is it POSIX.1-2001's?) MATH_ERRNO,
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).


# 121418 23-Oct-2003 des

Add prototypes for all long double functions in C99. Leave them all
#if 0'd out, except for fabsl(3) which I've implemented.


# 115230 22-May-2003 mike

Fix two misuses of __BSD_VISIBLE.

Submitted by: bde
Approved by: re


# 113077 04-Apr-2003 das

Fix braino in definition of isfinite().

Noticed by: marcus
Pointy hat to: das


# 111546 26-Feb-2003 imp

- gamma_r, lgamma_r, gammaf_r, and lgammaf_r were protected by _REENTRANT
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


# 110769 12-Feb-2003 mike

o Implement C99 classification macros isfinite(), isinf(), isnan(),
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>


# 110734 11-Feb-2003 mike

Implement C99's signbit() macro.


# 110566 08-Feb-2003 mike

Implement fpclassify():
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)


# 106268 31-Oct-2002 archie

Re-apply the previously backed-out commit that fixes the problem where
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


# 105809 23-Oct-2002 markm

Remove duplicate declaration.


# 104281 01-Oct-2002 bde

Fixed a last-minute editing error in previous commit. nfs and/or cvs
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.


# 104280 01-Oct-2002 bde

Merged all interesting difference between the old math.h and the current
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


# 103686 20-Sep-2002 archie

Revert previous commit to unbreak world until we figure out the
right way to do it.


# 103653 19-Sep-2002 archie

Fix a problem with the definition of HUGE_VAL causing the gcc warning
"cast increases required alignment of target type" on some platforms.

Reviewed by: bde


# 93211 26-Mar-2002 bde

Resurrect Lite1's gamma() as C99's tgamma(). Minimal changes.


# 93197 26-Mar-2002 bde

Fixed some minor style bugs.


# 92917 21-Mar-2002 obrien

Remove __P() usage.


# 87805 13-Dec-2001 phantom

Fix style bugs (mostly remove 'extern' from function prototypes)

Inspired by: conversation with bde


# 78172 13-Jun-2001 ru

Added skeleton <complex.h> (aligned with the POSIX.1-200x), mostly
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>.


# 58647 27-Mar-2000 obrien

MFS: Add a "magic" comment to help fixincludes realize it doesn't need to
modify this file when building GCC 2.96 [by hand or via the port].

Submitted by: Zack Weinberg <zack@wolery.cumb.org>


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 35399 23-Apr-1998 pst

Back out last change


# 35380 22-Apr-1998 pst

Fix cabs and cabsf definitions to be prototypes.


# 28971 31-Aug-1997 bde

Hide the declaration of `struct exception' from C++, since it conflicts
with the standard C++ `class exception'. This makes matherr() difficult
to use in C++. Small loss.


# 22993 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

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.


# 8870 30-May-1995 rgrimes

Remove trailing whitespace.


# 2117 19-Aug-1994 jkh

This commit was generated by cvs2svn to compensate for changes in r2116,
which included commits to RCS files with non-trunk default branches.


# 2116 19-Aug-1994 jkh

J.T. Conklin's latest version of the Sun math library.

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