Commit Graph

299 Commits

Author SHA1 Message Date
Ken Smith
a84020c2b9 Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by:	ru
Approved by:	re (not needed for commit check but in principle...)
2005-07-22 17:19:05 +00:00
Ruslan Ermilov
01293bdb90 Markup nit.
Approved by:	re (blanket)
2005-06-16 21:56:03 +00:00
Ruslan Ermilov
70db9cd000 Fixed compile warning.
Approved by:	re (blanket)
2005-06-16 21:55:45 +00:00
Ruslan Ermilov
f789cb8293 Assorted markup fixes.
Approved by:	re
2005-06-15 19:04:04 +00:00
Daniel Eischen
7f8fa2cf47 Prevent these functions from using stack outside of their frame.
Reported by:	Marc Olzheim <marcolz at stack dot nl>
OK'd by:	das
2005-05-06 15:44:20 +00:00
Stefan Farfeleder
66116c07a7 Revert the last change, the conversion from long double to double can raise
unwanted underflow exceptions.

Pointed out by:	das
2005-04-28 19:45:55 +00:00
Stefan Farfeleder
8f58ab910f Use double additions to raise the inexact exception to work around problems
with long double addition on sparc64.
2005-04-22 09:57:55 +00:00
Stefan Farfeleder
9eb30792de Fix raising the inexact exception (FE_INEXACT) if the result differs from the
argument.

Noticed by:	das
2005-04-22 08:30:33 +00:00
Andrey A. Chernov
db7354df52 Fix truncl.3 MLINKS 2005-04-17 19:57:52 +00:00
David Schultz
a4ca7ca8ac More optimized math functions. 2005-04-16 21:12:55 +00:00
David Schultz
2f2ee27de4 Implement truncl() based on floorl(). 2005-04-16 21:12:47 +00:00
David Schultz
07f3bc5b9c Add roundl(), lroundl(), and llroundl(). 2005-04-08 01:24:08 +00:00
David Schultz
4bb190a74b These files should include s_lround.c instead of s_lrint.c.
This only matters for efficiency, not for correctness.
2005-04-08 00:52:27 +00:00
David Schultz
fc87986708 Fix a (coincidentally harmless) bug. 2005-04-08 00:52:16 +00:00
David Schultz
46691dfbe7 Fix a long-standing bug in k_rem_pio2(), which led to large errors when
tanf() was called with big arguments close to multiples of pi/2.

Reported by:	ucbtest via bde
2005-04-05 23:27:47 +00:00
David Schultz
d06a0070af Build exp2(), exp2f(), and related documentation. 2005-04-05 02:57:39 +00:00
David Schultz
90232fdf16 Document exp2() and exp2f(), and make other minor tweaks and updates. 2005-04-05 02:57:28 +00:00
David Schultz
f8d6ede6b5 Implement exp2() and exp2f(). 2005-04-05 02:57:15 +00:00
David Schultz
3b9141ee91 Implement and document remquo() and remquof(). 2005-03-25 04:40:44 +00:00
David Schultz
2c2435825a Fix the double rounding problem with subnormals, and
remove the XXX comments, which no longer apply.
2005-03-18 02:27:59 +00:00
David Schultz
21122bea01 Add missing prototypes for fma() and fmaf(), and remove an inaccurate
comment.
2005-03-18 01:47:42 +00:00
David Schultz
9233b45ad9 Make the fenv.h routines work for programs that use SSE for
floating-point arithmetic on i386.  Now I'm going to make excuses
for why this code is kinda scary:

- To avoid breaking the ABI with 5.3-RELEASE, we can't change
  sizeof(fenv_t).  I stuck the saved mxcsr in some discontiguous
  reserved bits in the existing structure.

- Attempting to access the mxcsr on older processors results
  in an illegal instruction exception, so support for SSE must
  be detected at runtime.  (The extra baggage is optimized away
  if either the application or libm is compiled with -msse{,2}.)

I didn't run tests to ensure that this doesn't SIGILL on older 486's
lacking the cpuid instruction or on other processors lacking SSE.
Results from running the fenv regression test on these processors
would be appreciated.  (You'll need to compile the test with
-DNO_STRICT_DFL_ENV.)  If you have an 80386, or if your processor
supports SSE but the kernel didn't enable it, then you're probably out
of luck.

Also, I un-inlined some of the functions that grew larger as a result
of this change, moving them from fenv.h to fenv.c.
2005-03-17 22:21:46 +00:00
David Schultz
56ad27535a Spell 'fedisableexcept' correctly. 2005-03-16 22:34:14 +00:00
David Schultz
2e5fb44003 Document feenableexcept(), fedisableexcept(), and fegetexcept(). 2005-03-16 19:04:28 +00:00
David Schultz
10b01832c3 Replace fegetmask() and fesetmask() with feenableexcept(),
fedisableexcept(), and fegetexcept().  These two sets of routines
provide the same functionality.  I implemented the former as an
undocumented internal interface to make the regression test easier to
write.  However, fe(enable|disable|get)except() is already part of
glibc, and I would like to avoid gratuitous differences.  The only
major flaw in the glibc API is that there's no good way to report
errors on processors that don't support all the unmasked exceptions.
2005-03-16 19:03:46 +00:00
David Schultz
3d266bde6d Replace strong references with weak references. There's no
particularly good reason to do this, except that __strong_reference
does type checking, whereas __weak_reference does not.
On Alpha, the compiler won't accept a 'long double' parameter in
place of a 'double' parameter even thought the two types are
identical.
2005-03-07 21:27:37 +00:00
Stefan Farfeleder
3ddc6e9440 Remove an obsolete sentence from a comment. 2005-03-07 20:28:26 +00:00
David Schultz
c8642491d5 - If z is 0, one of x or y is 0, and the other is infinite, raise
an invalid exception and return an NaN.
- If a long double has 113 bits of precision, implement fma in terms
  of simple long double arithmetic instead of complicated double arithmetic.
- If a long double is the same as a double, alias fma as fmal.
2005-03-07 05:02:09 +00:00
David Schultz
388bf3b630 Document scalbnl and scalblnl. 2005-03-07 05:00:44 +00:00
David Schultz
6af2c5a60c Document nextafterl and nexttoward{,f,l}. 2005-03-07 05:00:29 +00:00
David Schultz
15a53f77fd Add nexttoward to the list of implemented functions, and explicitly
list the four that are still missing.
2005-03-07 04:59:53 +00:00
David Schultz
66d672d8cb Document fmal. 2005-03-07 04:59:43 +00:00
David Schultz
94e03502dc Remove ldexp and ldexpf. The former is in libc, and the latter is
identical to scalbnf, which is now aliased as ldexpf.  Note that the
old implementations made the mistake of setting errno and were the
only libm routines to do so.
2005-03-07 04:59:30 +00:00
David Schultz
aeb5e711f3 - Remove s_ldexpf.c (now aliased to scalbn.)
- Add nexttoward{,f,l} and nextafterl.  On all platforms,
  nexttowardl is an alias for nextafterl.
- Add fmal.
- Add man pages for new routines: fmal, nextafterl,
  nexttoward{,f,l}, scalb{,l}nl.

Note that on platforms where long double is the same as double, we
generally just alias the double versions of the routines, since doing
so avoids extra work on the source code level and redundant code in
the binary.  In particular:

		ldbl53		ldbl64/113
fmal       	s_fma.c		s_fmal.c
ldexpl     	s_scalbn.c	s_scalbnl.c
nextafterl 	s_nextafter.c	s_nextafterl.c
nexttoward 	s_nextafter.c	s_nexttoward.c
nexttowardf	s_nexttowardf.c	s_nexttowardf.c
nexttowardl	s_nextafter.c	s_nextafterl.c
scalbnl    	s_scalbn.c	s_scalbnl.c
2005-03-07 04:59:11 +00:00
David Schultz
228ad57d05 - 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.
2005-03-07 04:58:43 +00:00
David Schultz
beed720c37 Alias scalbn as ldexpl and scalbnl on platforms where long double is
the same as double.
2005-03-07 04:58:03 +00:00
David Schultz
7b6a19039d - Implement scalblnl.
- In scalbln and scalblnf, check the bounds of the second argument.
  This is probably unnecessary, but strictly speaking, we should
  report an error if someone tries to compute scalbln(x, INT_MAX + 1ll).
2005-03-07 04:57:50 +00:00
David Schultz
caacab9b5f Implement nexttowardf. This is used on both platforms with 11-bit
exponents and platforms with 15-bit exponents for long doubles.
2005-03-07 04:57:38 +00:00
David Schultz
ef94de735a Implement nexttoward and nextafterl; the latter is also known as
nexttowardl.  These are not needed on machines where long doubles
look like IEEE-754 doubles, so the implementation only supports
the usual long double formats with 15-bit exponents.

Anything bizarre, such as machines where floating-point and integer
data have different endianness, will cause problems.  This is the case
with big endian ia64 according to libc/ia64/_fpmath.h.  Please contact
me if you managed to get a machine running this way.
2005-03-07 04:56:46 +00:00
David Schultz
a506506a1c - Try harder to trick gcc into not optimizing away statements
that are intended to raise underflow and inexact exceptions.
- On systems where long double is the same as double, nextafter
  should be aliased as nexttoward, nexttowardl, and nextafterl.
2005-03-07 04:55:58 +00:00
David Schultz
e0fe8e4440 Implement frexpl. 2005-03-07 04:54:51 +00:00
David Schultz
f8a40fca14 Alias frexp as frexpl on platforms where a long double is the same as
a double.
2005-03-07 04:54:39 +00:00
David Schultz
65e60ab108 Implement fmal. 2005-03-07 04:54:20 +00:00
David Schultz
b1f37dcef4 - Define the LDBL_PREC to be the number of significant bits in a long
double's mantissa.
- Add an assembly version of fmal.
2005-03-07 04:54:02 +00:00
David Schultz
99401fa2e9 - Define the LDBL_PREC to be the number of significant bits in a long
double's mantissa.
- Add an assembly version of scalbnl.
2005-03-07 04:53:48 +00:00
David Schultz
4be31f0664 Define the LDBL_PREC to be the number of significant bits in a long
double's mantissa.
2005-03-07 04:53:36 +00:00
David Schultz
4442891961 Add an assembly version of fmal. 2005-03-07 04:53:11 +00:00
David Schultz
cd7d05b5a2 Add scalbnl, also known as as ldexpl. 2005-03-07 04:52:58 +00:00
David Schultz
4b2011300b Alias scalbnf as ldexpf. The two are identical in binary
floating-point formats.
2005-03-07 04:52:43 +00:00
David Schultz
1b32579f23 Fix a mistake in the exponent range. 2005-03-06 19:08:18 +00:00