Commit Graph

44 Commits

Author SHA1 Message Date
Bruce Evans 9faa8dc6cc Use __ieee754_sqrt() instead of sqrt() internally. Similarly for the
float versions.  Using sqrt() was inefficient.

Obtained from:	NetBSD
1997-03-09 16:29:29 +00:00
Bruce Evans 6b04d9918b Include <machine/asm.h> instead of kernel-only <machine/asmacros.h>. 1997-03-09 14:01:11 +00:00
Bruce Evans 8c950c10ca Fixed wrong magic numbers in scaling. hypotf() was very broken for large
and small values:

    hypotf(2.3819765e+38, 2.0416943e+38) was NaN instead of 3.1372484e+38
    hypotf(-3.4028235e+38, 3.3886450e+38) was NaN instead of Inf
    hypotf(-2.8025969e-45, -2.8025969e-45) was 0 instead of 4.2038954e-45

Found by:	ucbtest
1997-03-05 11:54:00 +00:00
Peter Wemm 7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Bruce Evans 2e6184e901 Split up the Bessel function wrapper files so that most wrapper functions
are in their own file.
1997-02-20 13:35:15 +00:00
Bruce Evans 5ddc00e218 Removed misplaced duplicate of comment about implementation details. 1997-02-20 13:14:06 +00:00
Bruce Evans 487ddb8fa4 Compute (1 - x^2) as ((1 - x) * (1 + x)) instead of as (1 - x * x) to
avoid easily avoidable loss of precision when |x| is nearly 1.

Extended (64-bit) precision only moves the meaning of "nearly" here.

This probably could be done better by splitting up the range into
|x| <= 0.5 and |x| > 0.5 like the C version.  However, ucbtest
does't report any errors in this version.  Perhaps the C version
should be used anyway.  It's only 25% slower now on a P5, provided
the C version of sqrt() isn't used, and the C version could be
optimized better.

Errors checked by:	ucbtest
1997-02-20 12:37:49 +00:00
Bruce Evans dab159e3d6 Select between the generic math functions and the i387-specific ones
at runtime.

etc/make.conf:
Nuked HAVE_FPU option.

lib/msun/Makefile:
Always build the i387 objects.  Copy the i387 source files at build
time so that the i387 objects have different names.  This is simpler
than renaming the files in the cvs repository or repeating half of
bsd.lib.mk to add explicit rules.

lib/msun/src/*.c:
Renamed all functions that have an i387-specific version by adding
`__generic_' to their names.

lib/msun/src/get_hw_float.c:
New file for getting machdep.hw_float from the kernel.

sys/i386/include/asmacros.h:
Abuse the ENTRY() macro to generate jump vectors and associated code.
This works much like PIC PLT dynamic initialization.  The PIC case is
messy.  The old i387 entry points are renamed.  Renaming is easier
here because the names are given by macro expansions.
1997-02-16 18:26:31 +00:00
Bruce Evans 72d8d94d6f Fixed the i87 version of exp(). It returned NaN for args +-Inf. It had
some small (one or two ULP) inaccuracies.

Found by:	ucbtest
1997-02-16 17:38:11 +00:00
Jordan K. Hubbard c4ebcb3423 Put back .endif clobbered by the previous commit, breaking the
build.
1997-02-15 14:05:42 +00:00
Bruce Evans ec7d3a3282 Disabled the i387 version if log1p(). It just evaluates log(1 + x).
This defeats the point of log1p().  ucbtest reports errors of +-5e+15
ULPs.  A correct version would use the i387 fyl2xp1 instruction for
small x and maybe scale to small x.  The C version does the scaling
reasonably efficiently, and fyl2px1 is slow (at least on P5s), so not
much is lost by always using the C version (only 25% for small x even
with the broken i387 version; 50% for large x).
1997-02-15 05:21:16 +00:00
Wolfram Schneider 75141cc987 Sort cross references. 1997-01-20 23:23:22 +00:00
Jordan K. Hubbard 1130b656e5 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.
1997-01-14 07:20:47 +00:00
Garrett Wollman e76da59456 Delete -D_POSIX_MODE and -D_MULTI_LIBM from CFLAGS. They never had any effect
because _IEEE_LIBM always takes priority, so the definition just served
to confuse.

Reviewed by:	bde
1997-01-08 13:22:28 +00:00
Wolfram Schneider 13608f6661 comma typos 1996-12-23 23:09:55 +00:00
Bruce Evans f4af388575 Removed references to nonexistent functions log2() and log2f(). 1996-12-18 17:47:03 +00:00
Bruce Evans c5dd403925 Fixed fiddling with the control word. Use the stack space reserved for
that purpose instead of space below the stack.
1996-12-14 16:43:53 +00:00
Bruce Evans aa9a769760 Clean up the FPU stack before returning. One stack slot was leaked on
every call.  The damage was sometimes limited by other routines using
and freeing stack slots that should have been empty to being with.
1996-12-14 16:24:42 +00:00
Peter Wemm bc4c97465a consistancy fixup
Submitted by: "Philippe Charnier" <charnier@xp11.frmug.org>
1996-08-30 21:21:52 +00:00
Peter Wemm 345be915f7 cmp -s || install -c ==> install -C 1996-08-30 02:12:07 +00:00
Bruce Evans 2aa9f7ca2c Made rintf() actually work. It was completely broken (when s_rint.c
was compiled with -O) by the precision bug in the i386 version of
gcc (assignments and casts don't clip the precision).  E.g.,
rintf(12.3456789) was 12.125.

Avoid the same bug in rint().  It was only broken for the unusual
case when the i387 precision is 64 bits.  FreeBSD defaults to 53
bit precision to avoid problems like this, but the standard math
emulator always uses 64 bit precision.
1996-08-28 16:34:36 +00:00
Mike Pritchard c119f6297f Fix up the NAME lines forthe ceil and floor man pages to be
less confusing.

Reviewed by:	bde
Partially obtained from: NetBSD-bugs
1996-08-21 21:23:47 +00:00
Jordan K. Hubbard 51295a4d3e General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
Bruce Evans f05bebb3ad Clean up the FP stack before returning. The i387 exp() leaked an FP
register on its first call.  Subsequent calls reused the register so
the leak didn't accumulate.  Fixes PR 1275.
1996-06-01 18:00:07 +00:00
Bruce Evans 40b83e34a7 Don't trash %ebp.
Obtained from: NetBSD
1996-02-25 20:29:46 +00:00
Mike Pritchard 4bd9ba3c2f Fixed some minor formatting problems to silence manck some more.
Corrected some bogus cross references to man pages that we don't/won't
have and either deleted them, or found a more appropriate man page
that we do have.  Various other minor changes to silence manck.

Manck is currently down to about 200 lines of errors, down from
the 500 - 600+ when I started all this.
1996-02-12 01:20:38 +00:00
Mike Pritchard 50ab12d9c0 Correct one small typo in previous commit. 1996-02-09 00:48:52 +00:00
Mike Pritchard c211e812bb Added some missing MLINKS for section 3 man pages.
Also corrected a few minor formatting errors, file location and cross
references in some of the section 3 man pages.

This shuts up a lot of the output from "manck" for section 3.
1996-02-09 00:45:45 +00:00
Bruce Evans 6644bf3e9b Undo the the changes in the previous revision (MANSRC now works right again).
Use ${INSTALL} instead of install.
1995-10-22 19:16:01 +00:00
Bruce Evans 5308354b7e Fixed use of too many args for `.Em'.
Fixed description of domain of y*().
Fixed description of error domain.  (This description is still half
redundant and half wrong, as in many other math man pages.  fdlibm
doesn't support the VAX or Tahoe.)
Fixed capitalization of `Bessel'.
1995-10-22 18:16:39 +00:00
Garrett Wollman 973f098aab Compress manual pages (if desired) in the obj directory rather
than in the installation destination.  Should make release-building
substantially faster.  The msun Makefile changes simple adapt to the new
scheme.
1995-10-02 20:02:05 +00:00
Rodney W. Grimes 6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
Bruce Evans 9f747fa23e Submitted by: J.T. Conklin <jtc@wimsey.com>
Second part of update to fdlibm 5.2: speed up argument reduction for trig
functions in the case pi/4 < |x| < 3pi/4.

Remove unused static constants ("one").
1995-04-07 23:23:27 +00:00
Bruce Evans b29986e0f1 Submitted by: J.T. Conklin <jtc@wimsey.com>
First part of update to fdlibm 5.2: fix jn(n, x) and jnf(n, x).
jn(-1, x) was too large by a factor of 3.
1995-04-07 23:13:43 +00:00
Bruce Evans b2fd1f671d Obtained from: NetBSD
Remove common sources from ${SRCS} when they are replaced by arch-specific
sources.
1995-03-08 01:41:40 +00:00
Jordan K. Hubbard 7a15a32a17 Additions from Thomas Graichen to mention each functions' floating point
counterpart.
Submitted by:	Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
1995-03-01 05:06:48 +00:00
L Jonas Olsson dc400d8541 Add missing z_abs. In BSD tradition this is in libm.a. 1994-11-11 12:56:27 +00:00
Bruce Evans 510cdfd2cf Install math.h. 1994-09-08 10:40:23 +00:00
Jordan K. Hubbard e2014c1dcb Latest fix from jtc:
The fyl2xp1 instruction has such a limited range:
   -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
it's not worth trying to use it.

Also, I'm not sure fyl2xp1's extra precision will
matter once the result is converted from extended
real (80 bits) back to double real (64 bits).

Reviewed by:	jkh
Submitted by:	jtc
1994-08-19 23:52:29 +00:00
Jordan K. Hubbard 6ce4810b0a Make this puppy actually compile now.
Submitted by:	jkh
1994-08-19 11:15:40 +00:00
Jordan K. Hubbard ec8cc6082c Do all the includes: <machine/asm.h> -> <machine/asmacros.h>
Reviewed by:
Submitted by:
1994-08-19 11:14:32 +00:00
Jordan K. Hubbard 2a3617d129 Change includes to reference <machine/asmacros.h>.
Submitted by:	jkh
1994-08-19 11:12:52 +00:00
Jordan K. Hubbard 3a8617a83f 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
1994-08-19 09:40:01 +00:00
Rodney W. Grimes 58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00