Home | History | Annotate | Download | only in include
History log of /src/include/math.h
RevisionDateAuthorComments
 1.72  09-Sep-2024  riastradh math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.

XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.

PR standards/56234: missing C99 frobs in <math.h>
 1.71  09-Sep-2024  riastradh math.h: Define FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL.

These are not strictly necessary to define, really, so we haven't
exactly been nonconformant. But they tell programs when they can
enable fast paths by using the fma(3) family of functions.

PR standards/56234: missing C99 frobs in <math.h>
 1.70  07-May-2024  riastradh branches: 1.70.2;
math.h: Move declarations under appropriate namespace tests.

Not sure about _REENTRANT, but if gamma_r and lgamma_r go under that
(even if _NETBSD_SOURCE isn't defined), then lgammal_r probably
should too.
 1.69  22-Jan-2024  kre It seems that we need prototypes for long double math functions, even
when !__HAVE_LONG_DOUBLE -- they still exist, but just aren't...

This might unbreak several more builds.
 1.68  22-Jan-2024  kre This set of changes seem to be sufficient to make at least the
amd64 port build again after the long double math function infusion
from yesterday.

Feel free (without consulting me, I'm just hacking about) to revert
any of this and do it a better way.

Note: this is not intended to be complete, in particular, in <math.h>
I added prototypes only for the functions that are needed for a
successful build, not all of the new ones...
 1.67  27-Aug-2022  christos branches: 1.67.2;
Add sincos{,f,l} from FreeBSD
 1.66  22-Feb-2020  joerg Correct C99 / C++11 feature testing. Document remaining missing symbols.
 1.65  24-Jun-2018  christos branches: 1.65.2; 1.65.4;
Fix the rest of the functions that have been made visible by xopen5,
posix 2017, and c99.
 1.64  24-Jun-2018  christos PR/53393: coypu: move rint to the right section.
 1.63  16-Sep-2013  martin branches: 1.63.24;
Allow archs to provide __isinf() and __isnan() as inline functions instead
of macros.
 1.62  19-Apr-2013  joerg If __FLT_EVAL_METHOD__ exists and is in {0,1,2}, provide float_t and
double_t.
 1.61  11-Feb-2013  matt FP_ILOGBNAN should be INT_MAX
 1.60  09-Feb-2013  matt Define FP_ILOGB0 and FP_ILOGBNAN
 1.59  28-Jan-2013  matt Add missing long double functions
 1.58  05-May-2012  christos branches: 1.58.2;
oops, forgot to commit: add tgamma and tgammaf
 1.57  05-Feb-2012  matt branches: 1.57.2;
Use __INFINITY in preference to __builtin_inff(). Currently only VAX defines
__INFINITY and allows to use __builtin_huge_valf() instead since gcc4.5 will
error out unconditionally if __builtin_inf() is used.
 1.56  28-Jul-2011  joerg branches: 1.56.2;
Add ilogbl(3).
 1.55  26-Jul-2011  joerg Add scalbnl to libm.
 1.54  06-Feb-2011  christos remquo{,f} from FreeBSD via Stathis Kamperis
 1.53  15-Sep-2010  christos branches: 1.53.2;
Commit SoC long double support from Stathis Kamperis
 1.52  02-May-2010  dholland typo in comment
 1.51  23-Feb-2010  joerg PR 36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
INFINITY are constant expressions.

Use the GCC builtins if possible to implement them.
 1.50  11-Jan-2010  christos branches: 1.50.2;
Add exp2 and exp2m
 1.49  04-Oct-2009  christos oops forgot to commit that one--- Add f{dim,min,max}{,l,f}
 1.48  22-Feb-2009  martin Make NAN a compile time constant (with help from the compiler). Suggested
by krister. Fixes PR 40695.
Make references to the old construct (which we can't remove for binary
compatibility reasons) emit a linker warning.
 1.47  25-Apr-2008  christos branches: 1.47.8; 1.47.10; 1.47.12; 1.47.16;
make name const.
 1.46  22-Feb-2007  drochner branches: 1.46.10;
-get cabs() and cabsf() out of public view - these are historical and
conflict with C99 functions which are builtins in newer gcc
(actually, the old cabs() is ABI compatible with the new _complex one
on i386, but this is purely accidental)
remove public prototypes and manpages, move the code into a compat
subdirectory as libc does so that binary compatibility is kept
-add a manpage for the isgreater() etc macros, borrowed from FreeBSD
 1.45  06-Feb-2007  drochner add the isgreater() at al. comparision macros defined in C99 and SUSv3;
use just the primitive macros for now (identical to FreeBSD/DragonFly)
which don't use gcc internals, the rest can go in after some testing;
addresses PR standards/25520
 1.44  25-Mar-2006  xtraeme Add trunc() and truncf() C99 functions, from FreeBSD.
 1.43  23-Mar-2006  kleink Add nan(3), nanf(3), and nanl(3); welcome libm.so.0.4.
 1.42  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.41  21-Jul-2005  christos Add log2f
 1.40  03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.39  12-Jul-2004  kleink Move round() to the C99 section.
 1.38  10-Jul-2004  junyoung lib/24252: Add C99 functions round(3) and roundf(3).
libm minor unchanged; ride a recent bump.

From FreeBSD.
 1.37  01-Jul-2004  drochner being here, add the (l)lround(f) functions to libm
(almost the same like lrint)
 1.36  30-Jun-2004  drochner shut up lint's "long long" warnings
 1.35  30-Jun-2004  drochner Add (l)lrint(f).
Being here, move some C99 function declarations into the appropriate
section (as discussed with kleink).
 1.34  04-Mar-2004  kleink branches: 1.34.2;
* Turn isinf(3) and isnan(3) into C99-style macros.
* Make it possible for ports to override these (i.e., VAX).
* Remove isnanl(), which was internal to libc only.
 1.33  04-Mar-2004  kleink Make lint happy for __fpmacro_unary_floating() users.
 1.32  20-Jan-2004  kleink Move FP_ROP and FP_DIRTYZERO from <math.h> to <vax/math.h> (where they
would have ended up if I hadn't missed the latter file in the commit).
 1.31  20-Jan-2004  matt Add FP_ROP and FP_DIRTYZERO to MD range for VAX.
 1.30  17-Jan-2004  uwe Close the comment after #endif.
 1.29  15-Jan-2004  kleink Add C99 fpclassify(), isfinite(), isnormal(), and signbit() macros.
 1.28  26-Oct-2003  kleink C99 7.12#4: provide INFINITY, which defaults to HUGE_VALF.
If infinities are not available, the machine-dependent header must define
__INFINITY as a positive constant of type float that overflows.
 1.27  25-Oct-2003  kleink C99: provide HUGE_VALF and HUGE_VALL.
 1.26  17-May-2003  thorpej Add long double support.
 1.25  28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.24  19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.23  05-Jan-2001  christos branches: 1.23.2;
protect the incomplete cabs declarations with #ifndef __MATH_PRIVATE__ so that
the code that defines the functions can declare them properly.
 1.22  13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.21  04-Jan-2000  kleink branches: 1.21.2;
const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.20  23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.19  16-Aug-1999  kleink Add missing isinff() declaration.
 1.18  31-Jan-1999  christos This file has still missing prototypes: cabs and cabsf... At least comment
what the arguments should be.
 1.17  15-Nov-1998  christos s/void/const void/
 1.16  15-Nov-1998  christos cast to void * first to avoid lint warning.
 1.15  07-Sep-1998  kleink Oops, isinf() was never included in any X/Open interface specification.
 1.14  26-Jul-1998  mycroft const poisoning.
 1.13  11-May-1998  kleink Fix comment typo in previous.
 1.12  07-May-1998  kleink Reorganize name space protection.
 1.11  08-Apr-1998  tv C++ has a very different concept of "exception." Delimit struct exception
and matherr() with #ifndef __cplusplus.
 1.10  26-Oct-1994  cgd new RCS ID format.
 1.9  10-Aug-1994  jtc Added prototypes for float versions of math functions.
Removed prototypes for internal functions.
 1.8  01-Mar-1994  jtc Add cabs() and drem(), for BSD libm compatibility.
 1.7  14-Feb-1994  cgd Add missing _. reported by several folks.
 1.6  11-Feb-1994  jtc New math.h, based on fdlibm's fdlibm.h.
 1.5  11-Oct-1993  jtc Moved definition of M_FOO constants into !_ANSI_SOURCE && !_POSIX_SOURCE
conditional.
 1.4  04-Aug-1993  jtc Use __pure qualifier.
 1.3  09-Jul-1993  cgd update for better FP routines, from AT&T & elsewhere
 1.2  21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  02-Feb-1998  perry import lite-2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.21.2.1  23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.2.2  22-Mar-2002  nathanw Catch up to -current.
 1.23.2.1  11-Mar-2002  nathanw Catch up to -current.
 1.34.2.2  16-Jul-2004  he Pull up revision 1.39 (via patch, requested by junyoung in ticket #666):
Move round() and roundf() to the C99 section, thereby fixing
a namespace issue.
 1.34.2.1  15-Jul-2004  he Pull up revision 1.38 (via patch, requested by junyoung in ticket #664):
Add C99 functions round(3) and roundf(3).
Bump the teeny version number for libm.
 1.46.10.1  18-May-2008  yamt sync with head.
 1.47.16.2  29-Apr-2011  matt Use GCC builtin for NAN (sync with current)
 1.47.16.1  21-Apr-2010  matt sync to netbsd-5
 1.47.12.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.47.10.2  25-Apr-2008  christos make name const.
 1.47.10.1  25-Apr-2008  christos file math.h was added on branch christos-time_t on 2008-04-25 21:20:58 +0000
 1.47.8.2  12-Mar-2010  riz Pull up following revision(s) (requested by snj in ticket #1330):
lib/libm/man/fmax.3: revision 1.1-1.2
lib/libm/src/s_fmin.c: revision 1.1-1.2
lib/libm/src/s_fdim.c: revision 1.1
lib/libm/src/s_fmaxl.c: revision 1.1
lib/libm/Makefile: revision 1.90
include/math.h: revision 1.49
lib/libm/src/s_fmaxf.c: revision 1.1
lib/libm/src/s_fmax.c: revision 1.1
lib/libm/shlib_version: revision 1.10
distrib/sets/lists/base/md.sparc64: revision 1.63 (via patch)
distrib/sets/lists/base/shl.mi: revision 1.495 (via patch)
lib/libm/src/s_fminl.c: revision 1.1
distrib/sets/lists/comp/mi: revision 1.1317
lib/libm/man/fdim.3: revision 1.1-1.3
lib/libm/src/s_fminf.c: revision 1.1
distrib/sets/lists/base/md.amd64: revision 1.70 (via patch)
add f{min,max,dim}{,l,f} from FreeBSD
These functions are going to first appear in 5.1, not 6.0.
 1.47.8.1  06-Mar-2010  sborrill Pull up the following revisions(s) (requested by joerg in ticket #1315):
include/math.h: revision 1.51

Address PR#36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
INFINITY are constant expressions.
Use the GCC builtins if possible to implement them.
 1.50.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.50.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.50.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.53.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.56.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.2.2  23-May-2012  yamt sync with head.
 1.56.2.1  17-Apr-2012  yamt sync with head
 1.57.2.1  09-May-2012  riz Pull up following revision(s) (requested by christos in ticket #232):
distrib/sets/lists/comp/mi: revision 1.1756
lib/libm/Makefile: revision 1.124
lib/libm/src/math_private.h: revision 1.17
lib/libm/src/b_tgamma.c: revision 1.1
lib/libm/man/lgamma.3: revision 1.22
lib/libm/src/b_log.c: revision 1.1
lib/libm/src/b_exp.c: revision 1.1
include/math.h: revision 1.58
lib/libm/src/s_tgammaf.c: revision 1.1
add tgamma{,f}
Add tgamma{,f} from FreeBSD via rudolf, netbsd at eq dot cz
oops, forgot to commit: add tgamma and tgammaf
 1.58.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.58.2.2  23-Jun-2013  tls resync from head
 1.58.2.1  25-Feb-2013  tls resync with head
 1.63.24.1  25-Jun-2018  pgoyette Sync with HEAD
 1.65.4.1  28-Feb-2022  martin Pull up following revision(s) (requested by gdt in ticket #1430):

include/math.h: revision 1.66

Correct C99 / C++11 feature testing. Document remaining missing symbols.
 1.65.2.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.67.2.1  11-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #950):

include/math.h: revision 1.71
include/math.h: revision 1.72
distrib/sets/lists/debug/mi: revision 1.448
tests/lib/libm/t_errhandling.c: revision 1.1
tests/lib/libm/t_errhandling.c: revision 1.2
tests/lib/libm/t_errhandling.c: revision 1.3
distrib/sets/lists/tests/mi: revision 1.1337
tests/lib/libm/Makefile: revision 1.50

math.h: Define FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL.

These are not strictly necessary to define, really, so we haven't
exactly been nonconformant. But they tell programs when they can
enable fast paths by using the fma(3) family of functions.

PR standards/56234: missing C99 frobs in <math.h>

math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.
XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.
PR standards/56234: missing C99 frobs in <math.h>

math.h: Add missing file for math_errhandling test.
PR standards/56234: missing C99 frobs in <math.h>

Add __TEST_FENV define to fix vax build

libm/t_errhandling.c: Put __TEST_FENV before any #includes.

This pattern avoids any potential problem with transitive inclusions
of fenv.h. (No change here because nothing else this file includes
transitively pulls in fenv.h, but being in the habit of doing it this
way avoids a class of problems.)

PR standards/56234: missing C99 frobs in <math.h>
 1.70.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed