History log of /openbsd-current/include/math.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: OPENBSD_6_3_BASE
# 1.36 10-Mar-2018 kettenis

Implement sicos(3), sincosf(3) and sincosl(3). These functions are common
extensions and modern compilers (such as clang) will use them to optimize
separate calculations of sine and cosine.

ok tom@, patrick@, deraadt@, jmc@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.35 17-Mar-2016 jca

Remove #ifdef __vax__ bits

ok deraadt@ tb@ (who had the same diff)


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.34 19-Jul-2015 martynas

Define new C99 macros:
- MATH_ERRNO, MATH_ERREXCEPTION and math_errhandling
- Optional FP_FAST_FMA{,F,L} macros if fma() executes as fast or faster
than (x * y) + z; which in practice is achievable if gcc implements
__FP_FAST_FMA{,F,L}
Reported by John Marino @ DragonFlyBSD.


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.33 03-May-2014 martynas

- Provide extended-precision math constants req'd by POSIX
- Explicitly cast double-precision constants as needed for
FLT_EVAL_METHOD = 2 archs
OK guenther@, ratchov@


Revision tags: OPENBSD_5_5_BASE
# 1.32 06-Aug-2013 miod

Try and avoid using __builtin_huge_val*() and __builtin_{inf,nan}* on vax
running gcc 3, for gcc will output a reserved operand for these.

ok martynas@ matthew@ espie@ guenther@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.31 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.30 06-Jul-2011 martynas

Finalize work on the math library. It's time to do this monster
commit, and deal with problems (if any) in tree.

Note that this adds the following functions. Ports with hacks might
need adjustments.

nexttoward(3), fma(3), nexttowardf(3), fmaf(3), acoshl(3), asinhl(3),
atanhl(3), coshl(3), sinhl(3), tanhl(3), expl(3), expm1l(3), logl(3),
log10l(3), log1pl(3), log2l(3), modfl(3), cbrtl(3), hypotl(3),
powl(3), erfl(3), erfcl(3), lgammal(3), tgammal(3), ceill(3),
floorl(3), lrintl(3), llrintl(3), roundl(3), lroundl(3), llroundl(3),
truncl(3), fmodl(3), remainderl(3), remquol(3), nextafterl(3),
nexttowardl(3), fmal(3).

With this commit, our library implements all functionality required
by C99. Documentation bits will follow.


# 1.29 25-May-2011 martynas

Also enclose variable names with external linkage in __BEGIN_DECLS.

Doesn't matter much since C++ ABI used by GCC doesn't mangle variable
names; however technically is required by Section 7.5 of the C++ spec.

Discussed with/OK guenther@, matthew@.


# 1.28 28-Apr-2011 martynas

- enable fenv
- add nearbyint, nearbyintf and nearbyintl implemented using fenv


Revision tags: OPENBSD_4_9_BASE
# 1.27 14-Dec-2010 martynas

- make HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, NAN expand to the
constant expressions with the help of gcc post-3.3.
ok millert@, mikeb@. been in snaps for weeks.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.26 25-Jul-2009 martynas

int is big enough to fully represent exponents of all supported fp
formats. which even for 80-bit & 128-bit long doubles is only 15
bits. therefore, scalbln, scalblnf, scalblnl are essentially the
same as scalbn, scalbnf, scalbnl with bounds checking so that
LONG_MIN..INT_MIN, and INT_MAX..LONG_MAX ranges properly raise
exceptions & yield correct values. looks good to millert@


Revision tags: OPENBSD_4_6_BASE
# 1.25 08-Apr-2009 martynas

nuke extern from func decls. ok millert@


Revision tags: OPENBSD_4_5_BASE
# 1.24 11-Dec-2008 martynas

add __infinityf declaration. (only affects vax). pointed out by miod@


# 1.23 09-Dec-2008 martynas

expose extended-precision definitions. ok millert@


# 1.22 09-Sep-2008 martynas

sigh, gamma got lost


# 1.21 07-Sep-2008 martynas

- replace dtoa w/ David's gdtoa, version 2008-03-15
- provide proper dtoa locks
- use the real strtof implementation
- add strtold, __hdtoa, __hldtoa
- add %a/%A support
- don't lose precision in printf, don't round to double anymore
- implement extended-precision versions of libc functions: fpclassify,
isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is
fixed
- separate vax versions of strtof, and __hdtoa
- add complex math support. added functions: cacos, casin, catan,
ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp,
clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf,
casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf,
ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf,
cimagf, conjf, cprojf, crealf
- add fdim, fmax, fmin
- add log2. (adapted implementation e_log.c. could be more acruate
& faster, but it's good enough for now)
- remove wrappers & cruft in libm, supposed to work-around mistakes
in SVID, etc.; use ieee versions. fixes issues in python 2.6 for
djm@
- make _digittoint static
- proper definitions for i386, and amd64 in ieee.h
- sh, powerpc don't really have extended-precision
- add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h
for LDBL_*
- merge lead to frac for m{6,8}k, for gdtoa to work properly
- add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa
to use
- add EXT_IMPLICIT_NBIT definition, which indicates implicit
normalization bit
- add regression tests for libc: fpclassify and printf
- arith.h & gd_qnan.h definitions
- update ieee.h: hppa doesn't have quad-precision, hppa64 does
- add missing prototypes to gdtoaimp
- on 64-bit platforms make sure gdtoa doesn't use a long when it
really wants an int
- etc., what i may have forgotten...
- bump libm major, due to removed&changed symbols
- no libc bump, since this is riding on djm's libc major crank from
a day ago

discussed with / requested by / testing theo, sthen@, djm@, jsg@,
merdely@, jsing@, tedu@, brad@, jakemsr@, and others.
looks good to millert@
parts of the diff ok kettenis@

this commit does not include:
- man page changes


Revision tags: OPENBSD_4_4_BASE
# 1.20 24-Jul-2008 martynas

unXXX prototypes: exp2, remquo, nan, exp2f, remquof, nanf


# 1.19 24-Jul-2008 martynas

- add NAN definition (except on VAX)
- add C99 real-floating macros fpclassify isfinite isinf isnan
isnormal signbit
- add C99 macros isgreater isgreaterequal isless islessequal
islessgreater isunordered
- add function prototypes, __fpclassify __fpclassifyf __fpclassifyl
__isfinite __isfinitef __isfinitel __isinf __isinfl __isnan __isnanl
__isnormal __isnormalf __isnormall __signbit __signbitf __signbitl
ok millert@


# 1.18 22-Jul-2008 martynas

- added HUGE_VALF, HUGE_VALL, INFINITY, FP_INFINITE, FP_NAN,
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, FP_ILOGB0, FP_ILOGBNAN definitions,
per C99
- classify functions into sections, add missing definitions, add
and some '#if 0' functions, and long double definitions, so we see
what's needed to be done
- other stuff is XXX'd, and will be uncommented soon
ok millert@


# 1.17 21-Jul-2008 martynas

- add proper double_t and float_t definitions for each arch
- math.h shouldn't define FLT_EVAL_METHOD, but float.h should (per
C99). remove from math.h, and add proper definitions in float.h
ok millert@


# 1.16 16-Jul-2008 martynas

infnan always returned wrong values, because compiler assumed it
returns integer value, so add missing prototype
ok millert@


# 1.15 11-Jun-2008 martynas

tgamma and tgammaf


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.14 12-Jul-2006 brad

add some more C99 functions: round(3) and roundf(3).

By Steven G. Kargl <kargl at troutmask dot apl dot washington.edu>
From FreeBSD


# 1.13 12-Jul-2006 brad

add missing prototypes for trunc/truncf.


# 1.12 05-May-2006 otto

delint; ok millert@ beck@


Revision tags: OPENBSD_3_9_BASE
# 1.11 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.10 17-Nov-2005 otto

Introduce a few c99 functions: {l,ll}{rint,round}{,f}. From NetBSD via
jason@. Man page fixes by jmc@, prodding by jsg@. ok mickey@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.9 06-Jan-2005 espie

provide float_t, double_t, FLT_EVAL_METHOD (dummy C99 constructs)

okay millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.8 26-Jun-2003 jason

Better value for vax MAXFLOAT


# 1.7 26-Jun-2003 jason

redefine MAXFLOAT in vax terms


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.5 26-May-2001 millert

Change protection of struct exception back from #ifdef __LIBM_PRIVATE
to #ifndef __cplusplus. It turns out there is code outside of libm
that wants to use this. I suppose that's why it is in math.h instead
of math_private.h ;-)


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.4 01-Mar-2000 todd

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.3 02-Mar-1998 millert

We don't need two math.h headers incvs server: nothing known about
`math.h'. The one in libm is more up to date but the one in the
include dir is what gets installed.


Revision tags: OPENBSD_2_2_BASE
# 1.2 21-Sep-1997 niklas

Well, as we are heading for a release people are encouraged to rebuild their
entire trees for testing anyway, I might as well do this intrusive touching
of include files now. Added openBSD tags.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.35 17-Mar-2016 jca

Remove #ifdef __vax__ bits

ok deraadt@ tb@ (who had the same diff)


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.34 19-Jul-2015 martynas

Define new C99 macros:
- MATH_ERRNO, MATH_ERREXCEPTION and math_errhandling
- Optional FP_FAST_FMA{,F,L} macros if fma() executes as fast or faster
than (x * y) + z; which in practice is achievable if gcc implements
__FP_FAST_FMA{,F,L}
Reported by John Marino @ DragonFlyBSD.


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.33 03-May-2014 martynas

- Provide extended-precision math constants req'd by POSIX
- Explicitly cast double-precision constants as needed for
FLT_EVAL_METHOD = 2 archs
OK guenther@, ratchov@


Revision tags: OPENBSD_5_5_BASE
# 1.32 06-Aug-2013 miod

Try and avoid using __builtin_huge_val*() and __builtin_{inf,nan}* on vax
running gcc 3, for gcc will output a reserved operand for these.

ok martynas@ matthew@ espie@ guenther@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.31 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.30 06-Jul-2011 martynas

Finalize work on the math library. It's time to do this monster
commit, and deal with problems (if any) in tree.

Note that this adds the following functions. Ports with hacks might
need adjustments.

nexttoward(3), fma(3), nexttowardf(3), fmaf(3), acoshl(3), asinhl(3),
atanhl(3), coshl(3), sinhl(3), tanhl(3), expl(3), expm1l(3), logl(3),
log10l(3), log1pl(3), log2l(3), modfl(3), cbrtl(3), hypotl(3),
powl(3), erfl(3), erfcl(3), lgammal(3), tgammal(3), ceill(3),
floorl(3), lrintl(3), llrintl(3), roundl(3), lroundl(3), llroundl(3),
truncl(3), fmodl(3), remainderl(3), remquol(3), nextafterl(3),
nexttowardl(3), fmal(3).

With this commit, our library implements all functionality required
by C99. Documentation bits will follow.


# 1.29 25-May-2011 martynas

Also enclose variable names with external linkage in __BEGIN_DECLS.

Doesn't matter much since C++ ABI used by GCC doesn't mangle variable
names; however technically is required by Section 7.5 of the C++ spec.

Discussed with/OK guenther@, matthew@.


# 1.28 28-Apr-2011 martynas

- enable fenv
- add nearbyint, nearbyintf and nearbyintl implemented using fenv


Revision tags: OPENBSD_4_9_BASE
# 1.27 14-Dec-2010 martynas

- make HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, NAN expand to the
constant expressions with the help of gcc post-3.3.
ok millert@, mikeb@. been in snaps for weeks.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.26 25-Jul-2009 martynas

int is big enough to fully represent exponents of all supported fp
formats. which even for 80-bit & 128-bit long doubles is only 15
bits. therefore, scalbln, scalblnf, scalblnl are essentially the
same as scalbn, scalbnf, scalbnl with bounds checking so that
LONG_MIN..INT_MIN, and INT_MAX..LONG_MAX ranges properly raise
exceptions & yield correct values. looks good to millert@


Revision tags: OPENBSD_4_6_BASE
# 1.25 08-Apr-2009 martynas

nuke extern from func decls. ok millert@


Revision tags: OPENBSD_4_5_BASE
# 1.24 11-Dec-2008 martynas

add __infinityf declaration. (only affects vax). pointed out by miod@


# 1.23 09-Dec-2008 martynas

expose extended-precision definitions. ok millert@


# 1.22 09-Sep-2008 martynas

sigh, gamma got lost


# 1.21 07-Sep-2008 martynas

- replace dtoa w/ David's gdtoa, version 2008-03-15
- provide proper dtoa locks
- use the real strtof implementation
- add strtold, __hdtoa, __hldtoa
- add %a/%A support
- don't lose precision in printf, don't round to double anymore
- implement extended-precision versions of libc functions: fpclassify,
isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is
fixed
- separate vax versions of strtof, and __hdtoa
- add complex math support. added functions: cacos, casin, catan,
ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp,
clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf,
casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf,
ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf,
cimagf, conjf, cprojf, crealf
- add fdim, fmax, fmin
- add log2. (adapted implementation e_log.c. could be more acruate
& faster, but it's good enough for now)
- remove wrappers & cruft in libm, supposed to work-around mistakes
in SVID, etc.; use ieee versions. fixes issues in python 2.6 for
djm@
- make _digittoint static
- proper definitions for i386, and amd64 in ieee.h
- sh, powerpc don't really have extended-precision
- add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h
for LDBL_*
- merge lead to frac for m{6,8}k, for gdtoa to work properly
- add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa
to use
- add EXT_IMPLICIT_NBIT definition, which indicates implicit
normalization bit
- add regression tests for libc: fpclassify and printf
- arith.h & gd_qnan.h definitions
- update ieee.h: hppa doesn't have quad-precision, hppa64 does
- add missing prototypes to gdtoaimp
- on 64-bit platforms make sure gdtoa doesn't use a long when it
really wants an int
- etc., what i may have forgotten...
- bump libm major, due to removed&changed symbols
- no libc bump, since this is riding on djm's libc major crank from
a day ago

discussed with / requested by / testing theo, sthen@, djm@, jsg@,
merdely@, jsing@, tedu@, brad@, jakemsr@, and others.
looks good to millert@
parts of the diff ok kettenis@

this commit does not include:
- man page changes


Revision tags: OPENBSD_4_4_BASE
# 1.20 24-Jul-2008 martynas

unXXX prototypes: exp2, remquo, nan, exp2f, remquof, nanf


# 1.19 24-Jul-2008 martynas

- add NAN definition (except on VAX)
- add C99 real-floating macros fpclassify isfinite isinf isnan
isnormal signbit
- add C99 macros isgreater isgreaterequal isless islessequal
islessgreater isunordered
- add function prototypes, __fpclassify __fpclassifyf __fpclassifyl
__isfinite __isfinitef __isfinitel __isinf __isinfl __isnan __isnanl
__isnormal __isnormalf __isnormall __signbit __signbitf __signbitl
ok millert@


# 1.18 22-Jul-2008 martynas

- added HUGE_VALF, HUGE_VALL, INFINITY, FP_INFINITE, FP_NAN,
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, FP_ILOGB0, FP_ILOGBNAN definitions,
per C99
- classify functions into sections, add missing definitions, add
and some '#if 0' functions, and long double definitions, so we see
what's needed to be done
- other stuff is XXX'd, and will be uncommented soon
ok millert@


# 1.17 21-Jul-2008 martynas

- add proper double_t and float_t definitions for each arch
- math.h shouldn't define FLT_EVAL_METHOD, but float.h should (per
C99). remove from math.h, and add proper definitions in float.h
ok millert@


# 1.16 16-Jul-2008 martynas

infnan always returned wrong values, because compiler assumed it
returns integer value, so add missing prototype
ok millert@


# 1.15 11-Jun-2008 martynas

tgamma and tgammaf


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.14 12-Jul-2006 brad

add some more C99 functions: round(3) and roundf(3).

By Steven G. Kargl <kargl at troutmask dot apl dot washington.edu>
From FreeBSD


# 1.13 12-Jul-2006 brad

add missing prototypes for trunc/truncf.


# 1.12 05-May-2006 otto

delint; ok millert@ beck@


Revision tags: OPENBSD_3_9_BASE
# 1.11 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


# 1.10 17-Nov-2005 otto

Introduce a few c99 functions: {l,ll}{rint,round}{,f}. From NetBSD via
jason@. Man page fixes by jmc@, prodding by jsg@. ok mickey@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.9 06-Jan-2005 espie

provide float_t, double_t, FLT_EVAL_METHOD (dummy C99 constructs)

okay millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.8 26-Jun-2003 jason

Better value for vax MAXFLOAT


# 1.7 26-Jun-2003 jason

redefine MAXFLOAT in vax terms


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.5 26-May-2001 millert

Change protection of struct exception back from #ifdef __LIBM_PRIVATE
to #ifndef __cplusplus. It turns out there is code outside of libm
that wants to use this. I suppose that's why it is in math.h instead
of math_private.h ;-)


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.4 01-Mar-2000 todd

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.3 02-Mar-1998 millert

We don't need two math.h headers incvs server: nothing known about
`math.h'. The one in libm is more up to date but the one in the
include dir is what gets installed.


Revision tags: OPENBSD_2_2_BASE
# 1.2 21-Sep-1997 niklas

Well, as we are heading for a release people are encouraged to rebuild their
entire trees for testing anyway, I might as well do this intrusive touching
of include files now. Added openBSD tags.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision