Commit Graph

138 Commits

Author SHA1 Message Date
David Schultz
8f3f7c66d0 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>
2004-04-25 02:35:42 +00:00
David Schultz
334c760eea Remove a stale comment referring to values.h, which has never been
part of FreeBSD.

PR:		65939
2004-04-25 02:32:46 +00:00
Bruce Evans
6eb2d83e44 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).
2004-03-12 12:02:03 +00:00
David Schultz
7a773faadc Fix a problem where libm compiled under 5.X would depend on features
that are only in libc.so.5.  This broke some 4.X applications linked
to libm and run under 5.X.

Background:
In C99, isinf() and isnan() cannot be implemented as regular
functions.  We use macros that call libc functions in 5.X, but for
libm-internal use, we need to use the old versions until the next
time libm's major version number is bumped.

Submitted by:	bde
Reported by:	imp, kris
2003-10-27 01:28:07 +00:00
Dag-Erling Smørgrav
2a063d30f6 Better safe than clever.
Submitted by:	das
2003-10-25 19:53:28 +00:00
Dag-Erling Smørgrav
801517fd4e Document fabsl(3).
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2003-10-25 13:45:11 +00:00
Dag-Erling Smørgrav
e334ea2edc - fabsl.c should be named s_fabsl.c for consistency with libmsun's
documented naming scheme (unfortunately the documentation isn't in the
   tree as far as I can tell); no repocopy is required as there is no
   history to preserve.

 - replace simple and almost-correct implementation with slightly hackish
   but definitely correct implementation (tested on i386, alpha, sparc64)
   which requires pulling in fpmath.h and the MD _fpmath.h from libc.

 - try not to make a mess of the Makefile in the process.

 - enterprising minds are encouraged to implement more C99 long double
   functions.
2003-10-25 09:32:18 +00:00
Dag-Erling Smørgrav
4318dce616 Connect fabsl.c to the build. 2003-10-23 08:23:51 +00:00
Dag-Erling Smørgrav
29bd23abf0 Add prototypes for all long double functions in C99. Leave them all
#if 0'd out, except for fabsl(3) which I've implemented.
2003-10-23 08:23:38 +00:00
Dag-Erling Smørgrav
017e4316ae Implement fabsl(3), allowing the world to build with -fno-builtin. 2003-10-23 08:20:47 +00:00
Gordon Tetlow
41d8423f71 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
Bruce Evans
262e4c00bd Fixed some style bugs (misplacement and misformatting of some commented-out
code).
2003-07-23 09:24:44 +00:00
Peter Wemm
3819e84017 Only provide one copy of the math functions. If we provide a MD function,
do not also provide a __generic_XXX version as well.  This is how we
used to runtime select the generic vs i387 versions on the i386 platform.

This saves a pile of #defines in the src/math_private.h file to undo the
__generic_XXX renames in some of the *.c files.
2003-07-23 04:53:47 +00:00
Peter Wemm
d48084b9e5 No longer need the internal __get_hw_float() function. 2003-07-23 04:25:04 +00:00
Peter Wemm
c3e6df78e1 Now that we do not need to do runtime detection for the broken default
fp emulator, stop doing the runtime selection of hardware or emulated
floating point operations on i386.  Note that I have not suppressed the
duplicate compiles yet.

While here, fix the alpha.  It has provided specific copysign/copysignf
functions since the beginning of time, but they have never been used.
2003-07-23 04:23:36 +00:00
Mike Barcroft
6f9622a926 Fix two misuses of __BSD_VISIBLE.
Submitted by:	bde
Approved by:	re
2003-05-22 17:07:57 +00:00
Peter Wemm
8e80f8a438 AMD64 support (another IEEEFP platform) 2003-04-30 21:06:30 +00:00
David Schultz
6d3bd9530d Fix braino in definition of isfinite().
Noticed by:	marcus
Pointy hat to:	das
2003-04-04 13:27:47 +00:00
Ruslan Ermilov
3892c30012 mdoc(7) police: Nits. 2003-03-02 21:04:21 +00:00
Warner Losh
457f6cd2d6 - 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
2003-02-26 13:12:03 +00:00
Mike Barcroft
5d62092f94 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>
2003-02-12 20:03:41 +00:00
Mike Barcroft
8e9b28311e Implement C99's signbit() macro. 2003-02-11 21:56:21 +00:00
Mike Barcroft
8cf5ed5125 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)
2003-02-08 20:37:55 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Jens Schweikhardt
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Archie Cobbs
83999f5a32 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
2002-10-31 23:05:20 +00:00
Mark Murray
bf2f52b5fa Remove duplicate declaration. 2002-10-23 17:35:11 +00:00
Bruce Evans
54e9b36765 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.
2002-10-01 11:44:35 +00:00
Bruce Evans
219cbe1087 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
2002-10-01 11:34:42 +00:00
Archie Cobbs
ae8a4b2f36 Revert previous commit to unbreak world until we figure out the
right way to do it.
2002-09-20 15:43:26 +00:00
Archie Cobbs
f5f1272284 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
2002-09-19 19:47:27 +00:00
Bruce Evans
3e2ec6ea88 e_pow.c:
Fixed pow(x, y) when x is very close to -1.0 and y is a very large odd
integer.  E.g., pow(-1.0 - pow(2.0, -52.0), 1.0 + pow(2.0, 52.0)) was
0.0 instead of being very close to -exp(1.0).

PR:		39236
Submitted by:	Stephen L Moshier <steve@moshier.net>

e_powf.c:
Apply the same patch although it is just cosmetic because odd integers
large enough to cause the problem are too large to be precisely represented
as floats.

MFC after:	1 week
2002-06-17 15:28:59 +00:00
Alfred Perlstein
59b19ff14a Fix formatting, this is hard to explain, so I'll show one example.
-       float ynf(int n, float x)       /* wrapper ynf */
+float
+ynf(int n, float x)    /* wrapper ynf */

This is because the __STDC__ stuff was indented.

Reviewed by: md5
2002-05-28 18:15:04 +00:00
Alfred Perlstein
2dcc228679 Assume __STDC__, remove non-__STDC__ code.
Reviewed by: md5
2002-05-28 17:51:46 +00:00
Alfred Perlstein
a82bbc730e Assume __STDC__, remove non-__STDC__ code.
Submitted by: keramida
2002-05-28 17:03:12 +00:00
Benno Rice
7191eaa757 Spread the word of PowerPC. 2002-05-21 04:00:47 +00:00
Ruslan Ermilov
c7b111cba8 Added new bsd.incs.mk which handles installing of header files
via INCS.  Implemented INCSLINKS (equivalent to SYMLINKS) to
handle symlinking include files.  Allow for multiple groups of
include files to be installed, with the powerful INCSGROUPS knob.
Documentation to follow.

Added standard `includes' and `incsinstall' targets, use them
in Makefile.inc1.  Headers from the following makefiles were
not installed before (during `includes' in Makefile.inc1):

	kerberos5/lib/libtelnet/Makefile
	lib/libbz2/Makefile
	lib/libdevinfo/Makefile
	lib/libform/Makefile
	lib/libisc/Makefile
	lib/libmenu/Makefile
	lib/libmilter/Makefile
	lib/libpanel/Makefile

Replaced all `beforeinstall' targets for installing includes
with the INCS stuff.

Renamed INCDIR to INCSDIR, for consistency with FILES and SCRIPTS,
and for compatibility with NetBSD.  Similarly for INCOWN, INCGRP,
and INCMODE.

Consistently use INCLUDEDIR instead of /usr/include.

gnu/lib/libstdc++/Makefile and gnu/lib/libsupc++/Makefile changes
were only lightly tested due to the missing contrib/libstdc++-v3.
I fully tested the pre-WIP_GCC31 version of this patch with the
contrib/libstdc++.295 stuff.

These changes have been tested on i386 with the -DNO_WERROR "make
world" and "make release".
2002-05-12 16:01:00 +00:00
Bruce Evans
46d7c2979e Resurrect Lite1's gamma() as C99's tgamma(). Minimal changes. 2002-03-26 11:59:29 +00:00
Bruce Evans
675902aa73 Fixed some bugs in the description of plain gamma() (and gammaf()).
Give a more detailed and correct history of when gamma() was actually
the gamma function.
2002-03-26 10:18:20 +00:00
Bruce Evans
6898f8c48e Fixed some minor style bugs. 2002-03-26 09:18:09 +00:00
David E. O'Brien
69160b1eb7 Remove __P() usage. 2002-03-21 23:54:04 +00:00
David E. O'Brien
84c63a156a Fix SCM ID's. 2002-03-21 18:06:09 +00:00
David E. O'Brien
118ce04e39 We need an frexp() function. 2002-03-01 01:58:20 +00:00
Jake Burkholder
fbeabbfad6 Add ifdef sparc64. 2002-01-02 06:54:18 +00:00
Alexey Zelkin
ef1ee63e3c Fix style bugs (mostly remove 'extern' from function prototypes)
Inspired by: conversation with bde
2001-12-13 17:22:17 +00:00
Alexey Zelkin
4b667ee0db * remove reference to m68k-dependent sources
* fix comment
2001-12-13 17:18:26 +00:00
Ruslan Ermilov
f598d0519c Grammar nit. 2001-11-21 09:25:14 +00:00
Ruslan Ermilov
487d13c0e7 mdoc(7) police: fixed bugs from rev. 1.15. 2001-11-20 16:40:04 +00:00
David Malone
a9dbc63dc2 gamma(x) actually returns \log(|\Gamma(x)|), so correct the man
page and add an historical note explaining this. This patch is
based on Stephen's.

We still need someone to implement tgamma.

PR:		28972, 31764
Submitted by:	Stephen Montgomery-Smith <stephen@math.missouri.edu>
2001-11-05 10:10:33 +00:00
Dima Dorfman
211feb6175 Match parenthesis and don't give names to return values.
PR:		31214
2001-10-15 13:34:43 +00:00