History log of /freebsd-current/lib/msun/Makefile
Revision Date Author Comments
# e38f2308 01-Mar-2024 Mark Murray <markm@FreeBSD.org>

lib/msun: Fix tgammal(3) on IEEE 128-bit platforms

Undo the 80-bit "stub" implementation of the 128-bit long double
tgammal(3) function. The latest (as of Feb 2024) version of the
src/contrib/arm-optimised-routines library includes a standalone,
full 128-bit replacement. This needs a small bit of wrapping to
fit it in, but is otherwise a drop-in replacement.

Testing this is hard, as most maths packages blow up as soon as
their 80-bit floating-point capability is exceeded. With 128-bit
tgammal(), this is easy to do, and this is the range that needs to
be checked the most carefully. Using my copy of Maple, I was able
to check that the output was within a few ULP of the correct answer,
right up to the point of 128-bit over- and underflow. Additionally,
the results are no worse, and indeed better than the 80-bit version.

Steve Kargl sent me his libm testing code, which I used to verify
that the excpetions for certain key values were correct. Tested in
this case were +-Inf, +-NaN, +-1 and +-0.

Differential Revision: https://reviews.freebsd.org/D44168
Reviewed by: theraven, andrew, imp


# d04e03c1 27-Jan-2024 Dimitry Andric <dim@FreeBSD.org>

msun: remove fabs from Symbol.map, and adjust comment

We have s_fabs.c, but fabs(3) is already provided by libc due to
historical reasons, so it is not compiled into libm. When the linker
does not use --undefined-version, this leads to a complaint about the
symbol being nonexistent, so remove it from Symbol.map.

While here, adjust the comment about some functions being supplied by
libc: while it is true that all these are indeed in libc, libm still
includes its own versions of frexp(3), isnan(3), isnanf(3), and
isnanl(3).

Reported by: Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after: 3 days


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# b19d8afe 05-Sep-2023 Warner Losh <imp@FreeBSD.org>

msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead

LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the
Makefile than the line:

.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})

so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't
(but did for me since I mounted 13.2R SD image there). Move to defining
our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily.

Sponsored by: Netflix
Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D41661


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# c44ca4c2 09-Sep-2022 Gleb Popov <arrowd@FreeBSD.org>

msun/Makefile: Fix conditional and unbreak the build.
Approved by: imp
Fixes: 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10


# 20adba8b 08-Aug-2022 Gleb Popov <arrowd@FreeBSD.org>

src.conf: Introduce WITHOUT_MACHDEP knob.

Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

Differential Revision: https://reviews.freebsd.org/D36076

MFC after: 3 days


# 03a88e3d 14-Dec-2021 Mark Murray <markm@FreeBSD.org>

* lib/msun/Makefile b/lib/msun/Makefile:
. Disconnect imprecise.c from the build. This file can be deleted.
. Add b_tgammal.c to the build for ld80 and ld128 targets. The ld128
is a 'git mv' of imprecise.c to ld128/b_tgammal.c.

* lib/msun/ld80/b_expl.c:
. New file. Implement __exp__D for ld80 targets. This is based on
bsdsrc/b_exp.c.

* lib/msun/ld80/b_logl.c:
. New file. Implement __log__D for ld80 targets. This is based on
bsdsrc/b_log.c.

* lib/msun/ld80/b_tgammal.c b/lib/msun/ld80/b_tgammal.c
. New file. Implement tgammal(x) for ld80 targets.

Submitted by: Steve Kargl
Differential Revision: https://reviews.freebsd.org/D33444
Reviewed by: pfg


# 455b2ccd 14-Dec-2021 Mark Murray <markm@FreeBSD.org>

* lib/msun/Makefile:
. Disconnect b_exp.c and b_log.c from the build.

* lib/msun/bsdsrc/b_exp.c:
. Replace scalb() usage with C99's ldexp().
. Replace finite(x) usage with C99's isfinite().
. Whitespace changes towards style(9).
. Remove include of "mathimpl.h". It is no longer needed.
. Remove #if 0 ... #endif code, which has been present since svn r93211
(2002-03-26).
. New minimax polynomial coefficients.
. Add comments to explain origins of some constants.
. Use ansi-C prototype. Remove K&R prototype. Add static to prototype.

* lib/msun/bsdsrc/b_log.c:
. Remove include of "mathimpl.h". It is no longer needed.
. Fix comments to actually describe the code.
. Reduce minimax polynomial from degree 4 to degree 3.
This uses newly computed coefficients.
. Use ansi-C prototype. Remove K&R prototype. Add static to prototype.
. Remove volatile in declaration of u1.
. Alphabetize decalaration list.
. Whitespace changes towards style(9).
. In argument reduction of x to g and m, replace use of logb() and
ldexp() with a single call to frexp(). Add code to get 1 <= g < 2.
. Remove #if 0 ... #endif code, which has been present since svn r93211
(2002-03-26).
. The special case m == -1022, replace logb() with ilogb().

* lib/msun/bsdsrc/b_tgamma.c:
. Update comments. Fix comments where needed.
. Add float.h to get LDBL_MANT_DIG for weak reference of tgammal to tgamma.
. Remove include of "mathimpl.h". It is no longer needed.
. Use "math.h" instead of <math.h>.
. Add '#include math_private.h"
. Add struct Double from mathimpl.h and include b_log.c and b_exp.c.
. Remove forward declarations of neg_gam(), small_gam(), smaller_gam,
large_gam() and ratfun_gam() by re-arranging the code to move these
function above their first reference.
. New minimax coefficients for polynomial in large_gam().
. New splitting of a0 into a0hi nd a0lo, which include additional
bits of precision.
. Use ansi-C prototype. Remove K&R prototype.
. Replace the TRUNC() macro with a simple cast of a double entities
to float before assignment (functional changes).
. Replace sin(M_PI*z) with sinpi(z) and cos(M_PI*(0.5-z)) with cospi(0.5-z).

Submitted by: Steve Kargl
Differential Revision: https://reviews.freebsd.org/D33444
Reviewed by: pfg


# b2e84316 02-Nov-2021 Andrew Turner <andrew@FreeBSD.org>

Use a builtin where possible in msun

Some of the functions in msun can be implemented using a compiler
builtin function to generate a small number of instructions. Implement
this support in fma, fmax, fmin, and sqrt on arm64.

Care must be taken as the builtin can be implemented as a function
call on some architectures that lack direct support. In these cases
we need to use the original code path.

As we don't set errno on failure build with -fno-math-errno so the
toolchain doesn't convert a builtin into a function call when it
detects a failure, e.g. gcc will add a call to sqrt when the input
is negative leading to an infinite loop.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32801


# 046e2d5d 04-Nov-2021 Steve Kargl <kargl@FreeBSD.org>

Implementations of cexpl()

The change implements cexpl() for both ld80 and ld128 architectures.
Testing was done on x86_64 and aarch64 systems.

Along the way sincos[fl]() use an optimization that reduces the argument
to being done one rather than twice. This optimization actually pointed
to a bug in the ld128 version of sincosl(), which is now fixed. In
addition, the minmax polynomial coefficients for sincosl() have been
updated.

A concise log of the file-by-file changes follows.

* include/complex.h:
. Add a prototype for cexpl().

* lib/msun/Makefile:
. Add s_cexpl.c to the build.
. Setup a link for cexpl.3 to cexp.3.

* lib/msun/Symbol.map:
. Expose cexpl symbol in libm shared library.

* lib/msun/ld128/s_cexpl.c:
* Implementation of cexpl() for 128-bit long double architectures.
Tested on an aarch64 system.

* lib/msun/ld80/s_cexpl.c:
* Implementation of cexpl() for Intel 80-bit long double.

* lib/msun/man/cexp.3:
. Document cexpl().

* lib/msun/man/complex.3:
. Add a BUGS section about cpow[fl].

* lib/msun/src/s_cexp.c:
. Include float.h for weak references on 53-bit long double targets.
. Use sincos() to reduce argument reduction cost.

* lib/msun/src/s_cexpf.c:
. Use sincosf() to reduce argument reduction cost.

* lib/msun/src/k_sincosl.h:
. Catch up with the new minmax polynomial coefficients for the kernel for
the 128-bit cosl() implementation.
. BUG FIX: *cs was used where *sn should have been. This means that sinl()
was no computed correctly when iy != 0.

* lib/msun/src/s_cosl.c:
. Include fpmath.h to get access to IEEEl2bits.
. Replace M_PI_4 with pio4, a 64-bit or 113-bit approximation for pi / 4.

PR: 216862
MFC after: 1 week


# ca3d8cb0 26-Oct-2021 Steve Kargl <kargl@FreeBSD.org>

lib/msun: Move the files to appropriate locations in the Makefile

Fixes: dce5f3abed7181cc533ca5ed
PR: 218514
MFC after: 1 week


# dce5f3ab 25-Oct-2021 Steve Kargl <kargl@FreeBSD.org>

[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]

Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle
trignometric functions cospi, sinpi, and tanpi. The attached
patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited
testing on the cospi and sinpi reveal a max ULP less than 0.89;
while tanpi is more problematic with a max ULP less than 2.01
in the interval [0,0.5]. The algorithms used in these functions
are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c.

Note. I no longer have access to a system with ld128 and
adequate support to compile and test the ld128 implementations
of these functions. Given the almost complete lack of input from
others on improvements to libm, I doubt that anyone cares. If
someone does care, the ld128 files contain a number of FIXME comments,
and in particular, while the polynomial coefficients are given
I did not update the polynomial algorithms to properly use the
coefficients.

PR: 218514
MFC after: 2 weeks


# 168234fa 15-Apr-2021 Alex Richardson <arichardson@FreeBSD.org>

lib/msun: Exclude ignored-pragmas from -Werror

This avoids build failures due to the clang 12 warning:
'#pragma FENV_ACCESS' is not supported on this target - ignored

Clang 12 currently emits this warning for all non-x86 architectures.
While this can result in incorrect code generation (e.g. on AArch64 some
exceptions are not raised as expected), this is a pre-existing issue and
we should not fail the build due to this warning.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29743


# bae9fd0b 10-Apr-2021 Dimitry Andric <dim@FreeBSD.org>

Only use -fp-exception-behavior=maytrap on x86, for now

After 3b00222f156d, it turns out that clang only supports strict
floating point semantics for SystemZ and x86 at the moment, while for
other architectures it is still experimental.

Therefore, only use -fp-exception-behavior=maytrap on x86 for now,
otherwise this option results in "error: overriding currently
unsupported use of floating point exceptions on this target
[-Werror,-Wunsupported-floating-point-opt]" on other architectures.

Fixes: 3b00222f156d
PR: 254911
MFC after: 1 week


# 3b00222f 09-Apr-2021 Dimitry Andric <dim@FreeBSD.org>

Avoid raising unexpected floating point exceptions in libm

When using clang with x86_64 CPUs that support AVX, some floating point
transformations may raise exceptions that would not have been raised by
the original code. To avoid this, use the -fp-exception-behavior=maytrap
flag, introduced in clang 10.0.0.

In particular, this fixes a number of test failures with ctanhf(3) and
ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID
exception is then raised, because clang emits vdivps instructions to
perform certain divides. (The vdivps instruction operates on multiple
single-precision float operands simultaneously, but the exceptions may
be influenced by unused parts of the XMM registers. In this particular
case, it was calculating 0 / 0, which results in FE_INVALID.)

If -fp-exception-behavior=maytrap is specified however, clang uses
vdivss instructions instead, which work on one operand, and should not
raise unexpected exceptions.

Reported by: olivier
Reviewed by: arichardson
PR: 254911
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29686


# fac6dee9 12-May-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

Remove tests for obsolete compilers in the build system

Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions
for older compilers.

Reviewed by: imp (earlier version), emaste, jhb
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24802


# 50b06886 01-Feb-2019 Eric van Gyzen <vangyzen@FreeBSD.org>

libm: squelch -Woverflow from gcc6

Sponsored by: Dell EMC Isilon


# 5a4c3b83 20-Jul-2018 Dimitry Andric <dim@FreeBSD.org>

Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

This is a follow-up to r336299.

* lib/msun/Makefile:
. Remove polevll.c

* lib/msun/ld80/e_powl.c:
. Copy contents of polevll.c to here. This is the only consumer of
these functions. Make functions 'static inline'.
. Make reducl a 'static inline' function.

* lib/msun/man/exp.3:
. Remove BUGS section that no longer applies.

* lib/msun/src/math_private.h:
. Remove prototypes of __p1evll() and __polevll()

* lib/msun/src/s_cpow.c:
* lib/msun/src/s_cpowf.c:
* lib/msun/src/s_cpowl.c
. Include math_private.h.
. Use the CMPLX macro from either C99 or math_private.h (depends on
compiler support) instead of the problematic use of complex I.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
PR: 229876
MFC after: 1 week


# c422fbac 19-Jul-2018 Dimitry Andric <dim@FreeBSD.org>

Revert r336497 for now, as it breaks on architectures using gcc, with:

cc1: warnings being treated as errors
/usr/src/lib/msun/src/s_cpow.c: In function 'cpow':
/usr/src/lib/msun/src/s_cpow.c:63: warning: implicit declaration of function 'CMPLX'


# 2ae9055f 19-Jul-2018 Dimitry Andric <dim@FreeBSD.org>

Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

This is a follow-up to r336299.

* lib/msun/Makefile:
. Remove polevll.c

* lib/msun/ld80/e_powl.c:
. Copy contents of polevll.c to here. This is the only consumer of
these functions. Make functions 'static inline'.
. Make reducl a 'static inline' function.

* lib/msun/man/exp.3:
. Remove BUGS section that no longer applies.

* lib/msun/src/math_private.h:
. Remove prototypes of __p1evll() and __polevll()

* lib/msun/src/s_cpow.c:
* lib/msun/src/s_cpowf.c:
* lib/msun/src/s_cpowl.c
. Use the CMPLX macro from either C99 or math_private.h (depends of
compiler support) instead of the problematic use of complex I.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
PR: 229876
MFC after: 1 week


# 6813d08f 14-Jul-2018 Matt Macy <mmacy@FreeBSD.org>

msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd

This corresponds to the latest status (hasn't changed in 9+
years) from openbsd of ld80/ld128 powl, and source cpowf, cpow,
cpowl (the complex power functions for float complex, double
complex, and long double complex) which are required for C99
compliance and were missing from FreeBSD. Also required for
some numerical codes using complex numbered Hamiltonians.

Thanks to jhb for tracking down the issue with making
weak_reference compile on powerpc.

When asked to review, bde said "I don't like it" - but
provided no actionable feedback or superior implementations.

Discussed with: jhb
Submitted by: jmd
Differential Revision: https://reviews.freebsd.org/D15919


# 0c0288a2 13-May-2018 Konstantin Belousov <kib@FreeBSD.org>

Add implementations for clog(3), clogf(3), and clog(3).

PR: 216863
Submitted by: bde, Steven G. Kargl <sgk@troutmask.apl.washington.edu>
MFC after: 2 weeks


# d511b20a 02-Aug-2017 Enji Cooper <ngie@FreeBSD.org>

Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.


# 4b330699 02-Aug-2017 Enji Cooper <ngie@FreeBSD.org>

Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after: 1 weeks


# e1b98d07 28-May-2017 Michal Meloun <mmel@FreeBSD.org>

Implement sincos, sincosf, and sincosl.
The primary benefit of these functions is that argument
reduction is done once instead of twice in independent
calls to sin() and cos().

* lib/msun/Makefile:
. Add s_sincos[fl].c to the build.
. Add sincos.3 documentation.
. Add appropriate MLINKS.

* lib/msun/Symbol.map:
. Expose sincos[fl] symbols in dynamic libm.so.

* lib/msun/man/sincos.3:
. Documentation for sincos[fl].

* lib/msun/src/k_sincos.h:
. Kernel for sincos() function. This merges the individual kernels
for sin() and cos(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/k_sincosf.h:
. Kernel for sincosf() function. This merges the individual kernels
for sinf() and cosf(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/k_sincosl.h:
. Kernel for sincosl() function. This merges the individual kernels
for sinl() and cosl(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/math.h:
. Add prototytpes for sincos[fl]().

* lib/msun/src/math_private.h:
. Add RETURNV macros. This is needed to reset fpsetprec on I386
hardware for a function with type void.

* lib/msun/src/s_sincos.c:
. Implementation of sincos() where sin() and cos() were merged into
one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosf.c:
. Implementation of sincosf() where sinf() and cosf() were merged into
one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosl.c:
. Implementation of sincosl() where sinl() and cosl() were merged into
one routine and possibly re-arranged for better performance.

PR: 215977, 218300
Submitted by: Steven G. Kargl <sgk@troutmask.apl.washington.edu>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10765


# a2877353 17-Feb-2017 Mahdi Mokhtari <mmokhi@FreeBSD.org>

Fix building of r313761 on platforms that
`long double` is alias of `double` (MIPS, etc)

PR: 216850 216851 216852 216856 216857 216858
Reported by: emsate
Reviewed by: bde emaste hselasky
Approved by: bde emaste hselasky
Differential Revision: https://reviews.freebsd.org/D9491


# a11c5077 15-Feb-2017 Mahdi Mokhtari <mmokhi@FreeBSD.org>

Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.

PR: 216850 216851 216852 216856 216857 216858
Submitted by: mmokhi
Reported by: sgk@troutmask.apl.washington.edu
Reviewed by: bde, mat, theraven
Approved by: bde (src committer), mat (mentor)
Differential Revision: https://reviews.freebsd.org/D9491


# fae95359 11-Oct-2016 Ruslan Bukin <br@FreeBSD.org>

Don't use fmaxl/fminl on platforms with no long double support,
use fmax/fmin instead.

This fixes fmaxmin test failure on MIPS64.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D8216


# d6e65178 28-Sep-2016 Ed Maste <emaste@FreeBSD.org>

libm: simplify i387 subdir logic with make's :S substitution


# c389411c 05-Feb-2016 Glen Barber <gjb@FreeBSD.org>

Remove libc, librtld_db, libthr packages, and further increase
the constraints on what needs to be installed in a specific to
maintain consistency during upgrades.

Create a new clibs package containing libraries that are needed
as a bare minimum for consistency.

With much help and input from: kib
Sponsored by: The FreeBSD Foundation


# a70cba95 04-Feb-2016 Glen Barber <gjb@FreeBSD.org>

First pass through library packaging.

Sponsored by: The FreeBSD Foundation


# 3c89d6b0 01-Dec-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Don't override LIB*DIR variables from src.libnames.mk.

In some cases switch to the LIB*SRCDIR value.

These recently were defined in r291327 and r291619.

Sponsored by: EMC / Isilon Storage Division


# 6922f800 09-Nov-2015 Enji Cooper <ngie@FreeBSD.org>

Document powl(3)

PR: 191751
Sponsored by: EMC / Isilon Storage Division


# 18b2ee82 15-Jun-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Revert r284417 it is not necessary anymore


# 4232f826 15-Jun-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Enforce overwritting SHLIBDIR

Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by: many


# bd831db6 11-Jun-2015 Simon J. Gerraty <sjg@FreeBSD.org>

Misc fixes from projects/bmake

Differential Revision: D2748
Reviewed by: brooks imp


# 1119ece4 27-Apr-2015 Enji Cooper <ngie@FreeBSD.org>

Build/install libc, librt, libthr, and msun NetBSD test suites on all
architectures

MFC after: 1 week


# 4cef7be5 17-Nov-2014 Enji Cooper <ngie@FreeBSD.org>

Add reachover Makefiles for contrib/netbsd-tests/lib/librt

A variant of this code has been tested on amd64/i386 for some time by
EMC/Isilon on 10-STABLE/11-CURRENT. It builds on other architectures, but the
code will remain off until it's proven it works on virtual hardware or real
hardware on other architectures

Sponsored by: EMC / Isilon Storage Division


# f7efd14d 15-Sep-2014 Steve Kargl <kargl@FreeBSD.org>

* Makefile:
. Hook e_lgammal[_r].c to the build.
. Create man page links for lgammal[-r].3.

* Symbol.map:
. Sort lgammal to its rightful place.
. Add FBSD_1.4 section for the new lgamal_r symbol.

* ld128/e_lgammal_r.c:
. 128-bit implementataion of lgammal_r().

* ld80/e_lgammal_r.c:
. Intel 80-bit format implementation of lgammal_r().

* src/e_lgamma.c:
. Expose lgammal as a weak reference to lgamma for platforms
where long double is mapped to double.

* src/e_lgamma_r.c:
. Use integer literal constants instead of real literal constants.
Let compiler(s) do the job of conversion to the appropriate type.
. Expose lgammal_r as a weak reference to lgamma_r for platforms
where long double is mapped to double.

* src/e_lgammaf_r.c:
. Fixed the Cygnus Support conversion of e_lgamma_r.c to float.
This includes the generation of new polynomial and rational
approximations with fewer terms. For each approximation, include
a comment on an estimate of the accuracy over the relevant domain.
. Use integer literal constants instead of real literal constants.
Let compiler(s) do the job of conversion to the appropriate type.
This allows the removal of several explicit casts of double values
to float.

* src/e_lgammal.c:
. Wrapper for lgammal() about lgammal_r().

* src/imprecise.c:
. Remove the lgamma.

* src/math.h:
. Add a prototype for lgammal_r().

* man/lgamma.3:
. Document the new functions.

Reviewed by: bde


# 3b5e0d0f 13-Jul-2014 Steve Kargl <kargl@FreeBSD.org>

* Makefile:
. Add s_erfl.c to building libm.
. Add MLINKS for erfl.3 and erfcl.3.

* Symbol.map:
. Move erfl and erfcl to their proper location.

* ld128/s_erfl.c:
. Implementations of erfl and erfcl in the IEEE 754 128-bit format.

* ld80/s_erfl.c:
. Implementations of erfl and erfcl in the Intel 80-bit format.

* man/erf.3:
. Document the new functions.
. While here, remove an incomplete sentence.

* src/imprecise.c:
. Remove the stupidity of mapping erfl and erfcl to erf and erfc.

* src/math.h:
. Move the declarations of erfl and erfcl to their proper place.

* src/s_erf.c:
. For architectures where double and long double are the same
floating point format, use weak references to map erfl to
erf and ercl to erfc.

Reviewed by: bde (many earlier versions)


# 2882a0d3 21-Feb-2014 Dimitry Andric <dim@FreeBSD.org>

For lib/msun, turn off warnings about unknown pragmas, since
lib/msun/src/e_sqrtl.c uses an unsupported STDC FENV_ACCESS pragma.


# a48e1f22 29-Dec-2013 Steve Kargl <kargl@FreeBSD.org>

* Makefile:
. Hook coshl, sinhl, and tanhl into libm.
. Create symbolic links for corresponding manpages.
. While here remove a nearby extraneous space.

* Symbol.map:
* src/math.h:
. Move coshl, sinhl, and tanhl to their proper locations.

* man/cosh.3:
* man/sinh.3:
* man/tanh.3:
. Update the manpages.

* src/e_cosh.c:
* src/e_sinh.c:
* src/s_tanh.c:
. Add weak reference for LBDL_MANT_DIG==53 targets.

* src/imprecise.c:
. Remove the coshl, sinhl, and tanhl kludge.

* src/e_coshl.c:
. ld80 and ld128 implementation of coshl().

* src/e_sinhl.c:
. ld80 and ld128 implementation of sinhl().

* src/s_tanhl.c:
. ld80 and ld128 implementation of tanhl().

Obtained from: bde (mostly), das and kargl


# 0e9dcedc 07-Nov-2013 Steve Kargl <kargl@FreeBSD.org>

Fix bulding libm on platforms with LDBL_MANT_DIG == 53.

Reported by: ian


# 4758b875 06-Sep-2013 David Chisnall <theraven@FreeBSD.org>

Add stub implementations of the missing C++11 math functions.
These are weak and so can be replaced by other versions in applications
that choose to do so, and will give a linker warning when used so that
applications that rely on the extra precision can avoid them.

Note that since the C/C++ specs only guarantee that long double has
precision equal to double, code that actually relies on these functions
having greater precision is unportable at best and broken at worst.


# 998b640b 10-Jun-2013 David Schultz <das@FreeBSD.org>

Add implementations of acoshl(), asinhl(), and atanhl(). This is a
merge of the work done by bde and myself.


# 0b8d0b5b 04-Jun-2013 David Schultz <das@FreeBSD.org>

Style fixes.

Submitted by: bde


# c13c6c32 03-Jun-2013 David Schultz <das@FreeBSD.org>

Add man links for expl(3) and expm1l(3).


# 25a4d6bf 03-Jun-2013 David Schultz <das@FreeBSD.org>

Add logl, log2l, log10l, and log1pl.

Submitted by: bde


# e4afa19c 29-May-2013 David Schultz <das@FreeBSD.org>

I'm happy to finally commit stephen@'s implementations of cacos,
cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@
for working on these.

Submitted by: stephen@
Reviewed by: bde


# 7dbbb6dd 27-May-2013 David Schultz <das@FreeBSD.org>

Fix some regressions caused by the switch from gcc to clang. The fixes
are workarounds for various symptoms of the problem described in clang
bugs 3929, 8100, 8241, 10409, and 12958.

The regression tests did their job: they failed, someone brought it
up on the mailing lists, and then the issue got ignored for 6 months.
Oops. There may still be some regressions for functions we don't have
test coverage for yet.


# 826549e5 21-Apr-2013 Konstantin Belousov <kib@FreeBSD.org>

Merge the 386 and amd64 versions of the fenv.h, to make cc -m32
compilations which use fenv.h work.

Reviewed by: tjil
Sponsored by: The FreeBSD Foundation


# 7750ad47 22-Aug-2012 Marcel Moolenaar <marcel@FreeBSD.org>

Sync FreeBSD's bmake branch with Juniper's internal bmake branch.

Requested by: Simon Gerraty <sjg@juniper.net>


# 8a489dc2 23-Jul-2012 Steve Kargl <kargl@FreeBSD.org>

Hook ld80/s_expl.c or ld128/s_expl.c into the building of libm.

PR: standards/152415
Approved by: das (mentor)


# 7bde21b1 15-Jan-2012 David Schultz <das@FreeBSD.org>

Add an implementation of fenv.h intended for platforms that lack an FPU and
use softfloat.

Thanks to Ian Lepore for testing and debugging this patch. The fenv
regression tests pass (at least for Ian's arm chip) with this change.


# 12188b77 21-Oct-2011 David Schultz <das@FreeBSD.org>

The cexp() and {,c}{cos,sin}h functions all need to be able to compute
exp(x) scaled down by some factor, and the challenge is doing this
accurately when exp(x) would overflow. This change replaces all of
the tricks we've been using with common __ldexp_exp() and
__ldexp_cexp() routines that handle all the scaling.

bde plans to improve on this further by moving the guts of exp() into
k_exp.c and handling the scaling in a more direct manner. But the
current approach is simple and adequate for now.


# 3daee1d6 16-Oct-2011 David Schultz <das@FreeBSD.org>

Add c{cos,sin,tan}{,h}{,f} functions. This is joint work with
bde and kargl.


# 1cd0ec03 12-Mar-2011 Steve Kargl <kargl@FreeBSD.org>

Take two. Add the missing file that should have been committed
with r219571 and re-enable building of cbrtl.

Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by: bde
Approved by: das


# 44bc6ce4 12-Mar-2011 Steve Kargl <kargl@FreeBSD.org>

Temporary disable the building of cbrtl until I
can determine why svn will not allow one to commit
a new file.

Approved by: das (implicit)


# dfe5233b 12-Mar-2011 Steve Kargl <kargl@FreeBSD.org>

Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by: bde
Approved by: das


# f3732b5a 06-Mar-2011 David Schultz <das@FreeBSD.org>

Add cexp() and cexpf().

Reviewed by: bde (earlier version)


# 11725f21 19-Feb-2011 Murray Stokely <murray@FreeBSD.org>

Add complex(3) manual page documenting our partial support for C99
complex arithmetic in libm.

Reviewed by: David Schultz <das@FreeBSD.org>
MFC after: 2 weeks


# 177668d1 05-Dec-2010 David Schultz <das@FreeBSD.org>

Add log2() and log2f().


# 9bb4c87b 02-Dec-2010 David Schultz <das@FreeBSD.org>

Disable gcc's built-in rint() function when compiling s_nearbyint.c.
It results in incorrect optimizations that break nearbyint().

PR: 143358
Reviewed by: bde


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fca5b4f4 12-Sep-2010 Warner Losh <imp@FreeBSD.org>

This is exactly the same as the .else, so remove it.


# 165721e3 12-Sep-2010 Warner Losh <imp@FreeBSD.org>

MFtbemd: Move to using MACHINE_CPUARCH, now that it is safe.


# b12277d1 28-Aug-2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Repair some build breakage introduced in r211725 and garbage collect some
code made obsolete in the same commit.


# 25faff34 23-Aug-2010 Warner Losh <imp@FreeBSD.org>

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


# 3c766d1c 10-Jul-2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

powerpc64 floating-point is identical to powerpc, so use the same
code on both architectures.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5e9470f1 07-Aug-2008 David Schultz <das@FreeBSD.org>

Implement cproj{,f,l}().


# 17303c62 31-Jul-2008 David Schultz <das@FreeBSD.org>

Add implementations of acosl(), asinl(), atanl(), atan2l(),
and cargl().

Reviewed by: bde
sparc64 testing resources from: remko


# d84f6378 31-Jul-2008 David Schultz <das@FreeBSD.org>

Set WARNS=1.

I believe I've committed all the bits necessary to make this compile
on all supported architectures. :crosses fingers:


# 6684d0ac 17-Jul-2008 David Schultz <das@FreeBSD.org>

Sort the .PATH entries to give a more reasonable order of precedence:
1. architecture-specific files
2. long double format-specific files
3. bsdsrc
4. src
5. man
The original order was virtually the opposite of this.

This should not cause any functional changes at this time. The
difference is only significant when one wants to override, say, a
generic foo.c with a more specialized foo.c (as opposed to foo.S).


# f2dc0faa 19-Jun-2008 David Schultz <das@FreeBSD.org>

Implement fmodl.
Document fmodl and fix some errors in the fmod manpage.


# c7392fee 30-Mar-2008 David Schultz <das@FreeBSD.org>

Hook remquol() and remainderl() up to the build.


# 511dd36b 30-Mar-2008 David Schultz <das@FreeBSD.org>

Implement csqrtl().


# 84c1c0a1 30-Mar-2008 David Schultz <das@FreeBSD.org>

Hook hypotl() and cabsl() up to the build.


# e43c8f6a 01-Mar-2008 David Schultz <das@FreeBSD.org>

Hook up sqrtl() to the build.


# 71c11dd5 18-Feb-2008 David Schultz <das@FreeBSD.org>

Add tgammaf() as a simple wrapper around tgamma().


# 234b60cd 17-Feb-2008 David Schultz <das@FreeBSD.org>

Hook up sinl(), cosl(), and tanl() to the build.


# 74d68da6 13-Feb-2008 Bruce Evans <bde@FreeBSD.org>

On arches where long double is the same as double, alias ceil(), floor()
and trunc() to the corresponding long double functions. This is not
just an optimization for these arches. The full long double functions
have a wrong value for `huge', and the arches without full long doubles
depended on it being wrong.


# 3d2cc912 18-Jan-2008 David Schultz <das@FreeBSD.org>

Hook up exp2l() and related docs to the build.


# d3f9671a 13-Jan-2008 David Schultz <das@FreeBSD.org>

Implement rintl(), nearbyintl(), lrintl(), and llrintl().
Thanks to bde@ for feedback and testing of rintl().


# ccef8c4f 17-Dec-2007 Bruce Evans <bde@FreeBSD.org>

Oops, the previous commit was not needed -- the file was committed but
not checked out due to my checkout error.


# 9ed67737 17-Dec-2007 Bruce Evans <bde@FreeBSD.org>

Don't try to build s_nanl.c before it is committed.


# 6821aba9 16-Dec-2007 David Schultz <das@FreeBSD.org>

Add logbl(3) to libm.


# 4b6b5744 16-Dec-2007 David Schultz <das@FreeBSD.org>

Implement and document nan(), nanf(), and nanl(). This commit
adds two new directories in msun: ld80 and ld128. These are for
long double functions specific to the 80-bit long double format
used on x86-derived architectures, and the 128-bit format used on
sparc64, respectively.


# aaf70b23 15-Dec-2007 David Schultz <das@FreeBSD.org>

Implement and document csqrt(3) and csqrtf(3).


# 205bd648 12-Dec-2007 David Schultz <das@FreeBSD.org>

Implement carg(3) and cargf(3).

Rotting in an old src tree since: March 2005


# 419ecd5d 20-May-2007 Daniel Eischen <deischen@FreeBSD.org>

Bump library versions in preparation for 7.0.

Ok'd by: kan


# 00fb440c 13-May-2007 Daniel Eischen <deischen@FreeBSD.org>

Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.
Warning, after symbol versioning is enabled, going back is not easy
(use WITHOUT_SYMVER at your own risk).

Change the default thread library to libthr.

There most likely still needs to be a version bump for at least the
thread libraries. If necessary, this will happen later.


# 9abb1ff6 07-Jan-2007 David Schultz <das@FreeBSD.org>

Implement modfl().


# d7eda462 27-Mar-2006 Daniel Eischen <deischen@FreeBSD.org>

Add symbol versioning to libm.


# 2b6ca0f6 06-Nov-2005 Bruce Evans <bde@FreeBSD.org>

Detach k_rem_pio2f.c from the build since it is now unused. It is a libm
internal so this shouldn't cause version problems.


# 32948b81 05-Nov-2005 Bruce Evans <bde@FreeBSD.org>

The logb() functions are not just ieee754 "test" functions, but are
standard in C99 and POSIX.1-2001+. They are also not deprecated, since
apart from being standard they can handle special args slightly better
than the ilogb() functions.

Move their documentation to ilogb.3. Try to use consistent and improved
wording for both sets of functions. All of ieee854, C99 and POSIX
have better wording and more details for special args.

Add history for the logb() functions and ilogbl(). Fix history for
ilogb().


# a84020c2 22-Jul-2005 Ken Smith <kensmith@FreeBSD.org>

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...)


# db7354df 17-Apr-2005 Andrey A. Chernov <ache@FreeBSD.org>

Fix truncl.3 MLINKS


# 2f2ee27d 16-Apr-2005 David Schultz <das@FreeBSD.org>

Implement truncl() based on floorl().


# 07f3bc5b 07-Apr-2005 David Schultz <das@FreeBSD.org>

Add roundl(), lroundl(), and llroundl().


# d06a0070 04-Apr-2005 David Schultz <das@FreeBSD.org>

Build exp2(), exp2f(), and related documentation.


# 3b9141ee 24-Mar-2005 David Schultz <das@FreeBSD.org>

Implement and document remquo() and remquof().


# 2e5fb440 16-Mar-2005 David Schultz <das@FreeBSD.org>

Document feenableexcept(), fedisableexcept(), and fegetexcept().


# aeb5e711 06-Mar-2005 David Schultz <das@FreeBSD.org>

- 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


# 57276bb6 26-Feb-2005 David Schultz <das@FreeBSD.org>

Un-document the non-extant exp10() and exp10f() functions.
exp10() was a casualty of the transition away from the VAX.


# b21154f6 04-Feb-2005 David Schultz <das@FreeBSD.org>

Remove another vestige of support for a non-IEEE libm.


# 79b99033 04-Feb-2005 David Schultz <das@FreeBSD.org>

Move machine-dependent crud to its own makefile.


# e1b61b5b 04-Feb-2005 David Schultz <das@FreeBSD.org>

Remove wrappers and other cruft intended to support SVID, mistakes in
C90, and other arcana. Most of these features were never fully
supported or enabled by default.

Ok: bde, stefanf


# 29bf6af8 26-Jan-2005 David Schultz <das@FreeBSD.org>

- Move the functions presently described in in ieee(3) to their own
manpages. They are not very related, so separating them makes it
easier to add meaningful cross-references and extend some of the
descriptions.
- Move the part of math(3) that discusses IEEE 754 to the ieee(3)
manpage.


# d5580d09 22-Jan-2005 David Schultz <das@FreeBSD.org>

Add fma() and fmaf(), which implement a fused multiply-add operation.


# cd3cc470 14-Jan-2005 David Schultz <das@FreeBSD.org>

amd64 assembly versions of sqrt(), lrint(), and llrint() using SSE2.


# fe69257d 13-Jan-2005 David Schultz <das@FreeBSD.org>

Import the subset of J.T. Conklin's single-precision x86-optimized
math routines that appear to be (a) correct and (b) faster than their
MI counterparts on my Pentium 4.

Obtained from: NetBSD


# 43295fac 13-Jan-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Implement and document ceill().


# 7e2ee1f0 12-Jan-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Hook up and document floorl().


# 10c9ffa4 11-Jan-2005 David Schultz <das@FreeBSD.org>

Add MI implementations of [l]lrint[f]() and [l]lround[f]().

Discussed with: bde


# 2fd3a32e 11-Oct-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Add and document ilogbl(), a long double version of ilogb().


# 85a8b887 01-Oct-2004 Ken Smith <kensmith@FreeBSD.org>

Bump the library version numbers for the following libraries:

/lib/{libm,libreadline}
/usr/lib/{libhistory,libopie,libpcap}

in preparation for doing the same thing to RELENG_5. HUGE amounts of
help for determining what to bump provided by kris.

Discussed on: freebsd-current
Approved by: re (not required for commit but something like this should be)


# bef54937 07-Aug-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Add man pages for the cimag(), conj() and creal() functions.


# 2208ce0a 04-Aug-2004 David Schultz <das@FreeBSD.org>

Replace s_isnan.c and s_isnanf.c with the more compact s_isnan.c from
libc. The externally-visible effect of this is to add __isnanl() to
libm, which means that libm.so.2 can once again link against libc.so.4
when LD_BIND_NOW is set. This was broken by the addition of fdiml(),
which calls __isnanl().


# ec79bc0d 19-Jul-2004 David Schultz <das@FreeBSD.org>

Fix two bugs in the signbit() macro, which was implemented last year:

- It was added to libc instead of libm. Hopefully no programs rely
on this mistake.

- It didn't work properly on large long doubles because its argument
was converted to type double, resulting in undefined behavior.


# 240dbabf 08-Jul-2004 David Schultz <das@FreeBSD.org>

Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.

The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.

Prodded by: kris


# 9428e108 05-Jul-2004 David Schultz <das@FreeBSD.org>

Add C99's nearbyint{,f}() functions as wrappers around rint().
These trivial implementations are about 25 times slower than
rint{,f}() on x86 due to the FP environment save/restore.
They should eventually be redone in terms of fegetround() and
bit fiddling.


# 4f82cb46 30-Jun-2004 David Schultz <das@FreeBSD.org>

Implement and document fdim{,f,l}, fmax{,f,l}, and fmin{,f,l}.


# c987479d 23-Jun-2004 Marcel Moolenaar <marcel@FreeBSD.org>

s/ARCH/ARCH_SUBDIR/g -- This reduces the chance of possible conflicts
with the user's environment.

Wondered why his cross-builds kept failing: marcel


# c8764bba 20-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Completely remove s_ilogb.S as the assembler implementation gives very little
speed improvement to none at all over the MI version.

Submitted by: bde


# 20954759 20-Jun-2004 David Schultz <das@FreeBSD.org>

Connect scalbln(), trunc(), and the associated documentation to the build.


# d0f13633 07-Jun-2004 David Schultz <das@FreeBSD.org>

Add round(3) and roundf(3) and the associated documentation.

PR: 59797
Submitted by: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Reviewed by: bde (earlier version, last year)


# 54dd6976 06-Jun-2004 David Schultz <das@FreeBSD.org>

Add fenv.h, fenv.c, and the associated documentation to the libm
build. To facilitate this, add ${.CURDIR}/${ARCH} to make's search
path unconditionally.

Reviewed by: standards@


# 8b5cd5a6 30-May-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Add implementations for cimag{,f,l}, creal{,f,l} and conj{,f,l}. They are
needed for cases where GCC's builtin functions cannot be used and for
compilers that don't know about them.

Approved by: das (mentor)


# b60cb13f 07-May-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Add an implementation of copysignl(), a long double version of copysign().

Approved by: das (mentor)


# 325152e8 07-May-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Add an MLINK for fabsl().

Approved by: das (mentor)


# e334ea2e 25-Oct-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

- 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.


# 4318dce6 23-Oct-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Connect fabsl.c to the build.


# 41d8423f 17-Aug-2003 Gordon Tetlow <gordon@FreeBSD.org>

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.


# 262e4c00 23-Jul-2003 Bruce Evans <bde@FreeBSD.org>

Fixed some style bugs (misplacement and misformatting of some commented-out
code).


# 3819e840 22-Jul-2003 Peter Wemm <peter@FreeBSD.org>

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.


# d48084b9 22-Jul-2003 Peter Wemm <peter@FreeBSD.org>

No longer need the internal __get_hw_float() function.


# c3e6df78 22-Jul-2003 Peter Wemm <peter@FreeBSD.org>

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.


# c7b111cb 12-May-2002 Ruslan Ermilov <ru@FreeBSD.org>

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".


# 46d7c297 26-Mar-2002 Bruce Evans <bde@FreeBSD.org>

Resurrect Lite1's gamma() as C99's tgamma(). Minimal changes.


# 118ce04e 28-Feb-2002 David E. O'Brien <obrien@FreeBSD.org>

We need an frexp() function.


# 4b667ee0 13-Dec-2001 Alexey Zelkin <phantom@FreeBSD.org>

* remove reference to m68k-dependent sources
* fix comment


# 6a8ba2f9 03-Oct-2001 Bruce Evans <bde@FreeBSD.org>

Don't install manpage links for the nonexistent functions exp2(),
exp2f(), log2() and log2f().


# 4a558355 27-Mar-2001 Ruslan Ermilov <ru@FreeBSD.org>

MAN[1-9] -> MAN.


# 0414fc4d 26-Mar-2001 Ruslan Ermilov <ru@FreeBSD.org>

Don't use MANDEPEND and MANSRC.


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 6f93bf5f 24-Dec-1998 Doug Rabson <dfr@FreeBSD.org>

Disable building with alpha software completion options until we upgrade
compilers.


# b7f76213 23-Dec-1998 Doug Rabson <dfr@FreeBSD.org>

Implement fpsetmask() and other fp*() functions. Programs should use

#include <ieeefp.h>

to access these functions instead of the i386 specific

#include <machine/floatingpoint.h>

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>


# 05b70667 20-Feb-1998 John Birrell <jb@FreeBSD.org>

Add alpha support. m68k crept in too. Oops. 8-)


# 3bc097d0 15-Apr-1997 Bruce Evans <bde@FreeBSD.org>

Added -D_ARCH_INDIRECT=i387_ to CFLAGS. _ARCH_INDIRECT will soon be used
to control generation of indirections in ENTRY(). Only msun needs it.

Use ${ARCH} consistently.


# 7e546392 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 2e6184e9 20-Feb-1997 Bruce Evans <bde@FreeBSD.org>

Split up the Bessel function wrapper files so that most wrapper functions
are in their own file.


# dab159e3 16-Feb-1997 Bruce Evans <bde@FreeBSD.org>

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.


# c4ebcb34 15-Feb-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Put back .endif clobbered by the previous commit, breaking the
build.


# ec7d3a32 14-Feb-1997 Bruce Evans <bde@FreeBSD.org>

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).


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

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.


# e76da594 08-Jan-1997 Garrett Wollman <wollman@FreeBSD.org>

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


# bc4c9746 30-Aug-1996 Peter Wemm <peter@FreeBSD.org>

consistancy fixup

Submitted by: "Philippe Charnier" <charnier@xp11.frmug.org>


# 345be915 29-Aug-1996 Peter Wemm <peter@FreeBSD.org>

cmp -s || install -c ==> install -C


# 50ab12d9 08-Feb-1996 Mike Pritchard <mpp@FreeBSD.org>

Correct one small typo in previous commit.


# c211e812 08-Feb-1996 Mike Pritchard <mpp@FreeBSD.org>

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.


# 6644bf3e 22-Oct-1995 Bruce Evans <bde@FreeBSD.org>

Undo the the changes in the previous revision (MANSRC now works right again).
Use ${INSTALL} instead of install.


# 973f098a 02-Oct-1995 Garrett Wollman <wollman@FreeBSD.org>

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.


# 6c06b4e2 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# b2fd1f67 07-Mar-1995 Bruce Evans <bde@FreeBSD.org>

Obtained from: NetBSD

Remove common sources from ${SRCS} when they are replaced by arch-specific
sources.


# 510cdfd2 08-Sep-1994 Bruce Evans <bde@FreeBSD.org>

Install math.h.


# 6ce4810b 19-Aug-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

Make this puppy actually compile now.
Submitted by: jkh


# 3a8617a8 19-Aug-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

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